Jump to content

[1.8] Issue with Event Handler


Recommended Posts


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 {

    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,


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.