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.

Geenium

Members
  • Joined

  • Last visited

  1. I'm sorry, but how would I do that.
  2. I'm rather new to forge and I'm currently doing some basic tests. I have an item that has durability and I reduce the durability when the item is used to break blocks or is right clicked whilst being held. When the item breaks I am putting a different item into the player's mainhand. The problem is I can't put a new item into the player's hand when the item breaks from right clicking but works fine if the item breaks from breaking a block with it. These methods are in my new item class. @Override public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) { damageTrinketInHand(stack, entityLiving); return true; } @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer player, EnumHand handIn) { ItemStack stack = player.getHeldItemMainhand(); damageTrinketInHand(stack, player); return new ActionResult<>(EnumActionResult.SUCCESS, stack); } private void damageTrinketInHand(ItemStack stack, EntityLivingBase entityLiving) { stack.damageItem(1, entityLiving); if (entityLiving.getHeldItemMainhand().isEmpty()) { System.out.println("Trinket broken"); entityLiving.setHeldItem(EnumHand.MAIN_HAND, new ItemStack(ModItems.BROKEN_TRINKET)); } } I should point out that I can place items into another slot i.e. offhand and this will work for both ways the item can break, but currently it specifically won't work when putting a new item into the slot that the intial item was in before the item broke by right clicking with it.

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.