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.

notdeadbro

Members
  • Joined

  • Last visited

  1. public void itemAttributeModifier(ItemAttributeModifierEvent event) { ItemStack stack = event.getItemStack(); Item item = stack.getItem(); if (item == Items.DIAMOND_SWORD) { stack.addAttributeModifier(Attributes.ATTACK_DAMAGE, new AttributeModifier("damage", 1.0D, AttributeModifier.Operation.MULTIPLY_BASE), EquipmentSlotType.MAINHAND); } } It continues to call the addAttributeModifier infinitely. In game, the tooltip ends up just overflowing with attribute modifiers.
  2. Also, a side note, is anyone aware of why the diamond sword is not getting its updated tooltip? Here's my code:
  3. Well, I'm not sure if I'm being stupid, but the ItemAttributeModifierEvent is obviously an event executed every tick, so it just adds the attribute modifier over and over again.
  4. Sorry for late reply, but is there a way to specifically set the item's attack damage with this? I see that you can use addAttributeModifier but that is not as practical, especially for my case.
  5. Would this change the damage value of the sword that is displayed in the tooltip as well? Like this: I want to literally be able to change its attack damage value.
  6. I want to be able to change how much damage the diamond sword does in my mod. I know that I need to use reflections to accomplish this, but I'm not sure exactly how, and I've been trying for hours. Can someone possibly tell me how to write a reflection that can do this? I'm aware that this is not a Java school but this is my last resort.

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.