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 need to respond when the player's armor or equipped weapons break, on the client side. 

 

I am aware of PlayerDestroyItemEvent, but that only triggers when a tool or weapon breaks while used on its intended material - it does not fire for armor, or eg. a pickaxe that breaks while mining sand. 

There's LivingEquipmentChangeEvent, but that also triggers when the player changes their armor on purpose, and doesn't cover tools or weapons.

I tried LivingAttackEvent, LivingHurtEvent, and LivingDamageEvent for the armor, but they also do not always fire when the player's armor breaks (for example, if the armor breaks due to a cactus but blocks all of the damage).

Lastly, monitoring the player's inventory every tick will also not work, because as with LivingEquipmentChangeEvent I can't distinguish between the armor/tools breaking and the player just unequipping/dropping it intentionally.

 

I did find ItemDurabilityTrigger, which appears to do exactly what I want (though I'm not sure about server/client side) ... but it's not an event, and therefore seems to require that I do some reflection/ASM stuff, which I am wary of.

 

Is there a way do this?

ItemDurabilityTrigger is an ICriterionTrigger for use with advancements.

There is not a Forge hook for this. But you could, conceivably, add a listener to the existing trigger, but keep in mind this is a server side effect only.

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.

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.