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.

mbkgr

Members
  • Joined

  • Last visited

  1. I understand my mistake on that document It's OK now.Thank you so much.
  2. I have two classes, one ServerEvent and the other one is ClientEvent.So I need to use ServerEvent and OnlyIn(DIST.DEDICATED_SERVER) Is that right ?
  3. I solved it.But there is a another problem.When player does event, event triggers 4 time.How can I solve that ? @SubscribeEvent public static void rightClick(PlayerInteractEvent.RightClickItem event) { PlayerEntity player = event.getPlayer(); if (player.getHeldItemMainhand().getItem() == Items.DIAMOND_ORE && player.getHeldItemOffhand().getItem() == Items.COAL) { gblnDiablo.LOGGER.info("Player tried to upgrade"); ItemStack giveItem = new ItemStack(Items.DIAMOND, 1); player.inventory.addItemStackToInventory(giveItem); } }
  4. Thank you again for answer.I understand that I should work java more and harder...
  5. Thank you I found it but I cant figured it out... How can I solve it ?
  6. Thank you for reply. Where can I find it ? And also how can I find the other event usages ?
  7. Hello Guys, I want to do when a player right click to certain item do something. But When I do PlayerInteractEvent.LeftClickEmpty it works. Can anyone help me ? (FORGE 1.15.2) public static void itemUpgrade(PlayerInteractEvent.RightClickEmpty event) { PlayerEntity player = event.getPlayer(); String msg = TextFormatting.RED + "Success!"; String msg2 = TextFormatting.RED + "Failed!"; if (player.getHeldItemMainhand().getItem() == RegistryHandler.DRAGON_STEEL_SWORD.get() && player.getHeldItemOffhand().getItem() == RegistryHandler.DRAGON_STEEL.get()) { gblnDiablo.LOGGER.info("Player tried upgrade"); if (Math.random() < 0.7D) { ItemStack giveItem = new ItemStack(RegistryHandler.DRAGON_STEEL_SWORD_1.get(), 1); player.sendMessage(new StringTextComponent(msg)); giveItem.setCount(1); ItemHandlerHelper.giveItemToPlayer(player, giveItem); } else { ((PlayerEntity) player).inventory.clearMatchingItems(p -> new ItemStack(RegistryHandler.DRAGON_STEEL_SWORD.get(), (int) (1)).getItem() == p.getItem(), (int) 1); ((PlayerEntity) player).inventory.clearMatchingItems(p -> new ItemStack(RegistryHandler.DRAGON_STEEL.get(), (int) (1)).getItem() == p.getItem(), (int) 1); /* player.inventory.clearMatchingItems((p) -> { return (new ItemStack(player.getHeldItemMainhand().getItem(), 1)).getItem() == p.getItem(); }, 1); */ /* player.inventory.clearMatchingItems((p) -> { return (new ItemStack(player.getHeldItemOffhand().getItem(), 1)).getItem() == p.getItem(); }, 1); */ player.sendMessage(new StringTextComponent(msg2)); } } }

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.