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.

TheGlobefish

Members
  • Joined

  • Last visited

Everything posted by TheGlobefish

  1. Hello, I'm new to modding, and I am trying to get an item (baked potato) to drop from leaves occasionally. I registered the eventbus: MinecraftForge.EVENT_BUS.register(new YeastEventHandler()); in my init method, and have this code in my YeastEventHandler: package com.yeast.yeastmod; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class YeastEventHandler { @SubscribeEvent public void checkLeave(BlockEvent.HarvestDropsEvent event) { System.out.println("Some event called"); //Check the block state to find out if the Block is Leaves if(event.state == Blocks.leaves) { //Add the new drop, we can't set event.drops because it is final. This will add it to the list of possible drops for leaves System.out.println("This is a leaf."); event.drops.add(new ItemStack(Items.baked_potato)); } } } When I break any block, my console says "Some event called", confirming that it knows I broke the block. However, when I break a leaf block, I do not get the output "This is a leaf." I have tried using "Blocks.leaves" and "Blocks.leaves2", and both ways my code cannot detect if the block I broke is a leaf. What am I doing wrong? Any help is appreciated, -TheGlobefish

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.