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.

Ayfri

Members
  • Joined

  • Last visited

  1. I just want to spawn an Item on my mod when I right click with empty hand on a log, I make this : package fr.ayfri.testmod.init; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.tags.BlockTags; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; public class BlockEventHandler { public static final BlockEventHandler INSTANCE = new BlockEventHandler(); @SubscribeEvent public void OnRightClickBlock(PlayerInteractEvent.RightClickBlock e) { if(e.getWorld().getBlockState(e.getPos()).getBlock().isIn(BlockTags.LOGS) && e.getEntityPlayer().getHeldItemMainhand().isEmpty()) { System.out.println("wood log touched"); ItemEntity wood_piece = new ItemEntity(e.getWorld(), e.getPos().getX(), e.getPos().getY(), e.getPos().getZ(), new ItemStack(ModItems.wood_piece)); e.getWorld().addEntity(wood_piece); } return; } } But when I right click on a log, it says "wood log touched" but it doesn't spawn any Item, can you help me to figure out why ?

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.