Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

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.

  • 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.

  • 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.

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.

  • 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");
}

  • 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.

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 :P

 

So, either that method isn't the right one, or it is currently bugged in 1.9.

  • 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.

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.