Posted December 31, 201311 yr Hello everyone. I am working on a mod and I hit a little break, I need to make something that breaks a block slowly like a tool but when the person presses right click. I think it's OP to make an item that breaks stuff every tick. If anyone uses Thaumcraft, they should know about the wand of excavation or how it's called in the new versions, I haven't done mods in a while. I would like to have something that works kinda like that, how could I do that?
January 2, 201411 yr Don't know exactly, but I believe that there is something like onBlockRightClick or something like that I believe? Did I help? Gimme a thanks!
January 2, 201411 yr Author OnItemUseFirst does that, but how could I make it so it breaks the block slowly?
January 2, 201411 yr You could try to create some sort of cooldown before the block is harvested. I'm always happy to help others! Java is not my main programming language but I have alot experience in PHP/HTML/JS/CSS3/C#/SQL
January 2, 201411 yr I have the thaumcraft source and he use onItemUse and just break the block instant. And there is no cool down or something. But you could make it like this that you add with itemNBT a custom cooldown. like this: Note its a custom Function you only need to call it in the onItemUseFunction public boolean onItemUseage(ItemStack stack, World world, int x, int y, int z) //More is { if(stack.hasTagCompound()) { NBTTagCompound nbt = stack.getTagCompound().getCompoundTag("tool"); if(nbt.getInteger("coolDown") <= 0) { //Here do your break code nbt.setInteger("coolDown", 20); return true; } } return false; } public void onUpdate(ItemStack stack, World par2, EntityPlayer player) { if(stack.hasTagCompound()) { NBTTagCompoun nbt = stack.getTagCompound().getCompoundTag("tool"); if(nbt.getInteger("coolDown") > 0) { int between = nbt.getInteger("coolDown"); nbt.setInteger("coolDown", between-1); } } }
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.