Posted April 9, 20169 yr I am changing a tick counter in an item every frame, and as a result the ItemStack is "changing" and thus appears to reset the block breakage. Is there a method I can override to prevent this?
April 10, 20169 yr Rather than incrementing a counter every tick, store the start time and compare with the current time. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
April 10, 20169 yr Author Hmm... I considered doing that. I will try that now. Also, is there a way to allocate an Item to a new ItemStack class? Edit: Oh yeah, that still will not work, as the tick counter does affect other NBT data periodically.
April 10, 20169 yr Nope, you can't effectively sub-class ItemStack to add your own stuff, though you can with EntityItem. http://i.imgur.com/NdrFdld.png[/img]
April 10, 20169 yr Author Right, but is there a way to not cause it to refresh the block break whenever NBT data changes? It really makes things problematic.
April 10, 20169 yr Yes, there should be an Item method called something like #shouldCauseReequipAnimation - the syncing of the NBT to the client is what causes the re-equip animation which in turn interrupts block breaking. Be sure to still return true if the stack has indeed changed. http://i.imgur.com/NdrFdld.png[/img]
April 10, 20169 yr Author I am overriding that - but it still does not prevent block break from resetting...
April 10, 20169 yr Show your implementation. There's also always the possibility that it is a bug. http://i.imgur.com/NdrFdld.png[/img]
April 10, 20169 yr Author Implementation of shouldCauseReequipAnimation? @Override public boolean shouldCauseReequipAnimation(ItemStack oldStack, ItemStack newStack, boolean slotChanged) { return !oldStack.isItemEqual(newStack) || oldStack.getTagCompound().getBoolean("glowing") != newStack.getTagCompound().getBoolean("glowing"); }
April 10, 20169 yr That looks fine, so perhaps it's a bug? 1.9 did add 2 hands, after all, so I imagine quite a lot must have changed in the background. You could try following the call hierarchy of #shouldCauseReequipAnimation and see if there is anything amiss. http://i.imgur.com/NdrFdld.png[/img]
April 10, 20169 yr Author Even when it simply returns false, it still does not allow it to break the block, so it probably has nothing to do with that method, but I will have a little look.
April 10, 20169 yr It's possible I've misunderstood what that method does - it may only actually affect the reequip animation and have nothing to do with the block-breaking process, though I am/was pretty sure they were related. I've never had occasion to test while breaking a block, though I have had occasion to override the method So, either that method isn't the right one, or it is currently bugged in 1.9. http://i.imgur.com/NdrFdld.png[/img]
April 10, 20169 yr Author I don't see any situation where you do not want it to play the re-equip animation, but do want to reset the block break animation.
April 10, 20169 yr Author Can I just get a confirmation that this is bugged, there is a method that I forgot to override or an event that I need to use?
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.