Jump to content

[1.7.10] Difference between the Leafblocks


Recommended Posts

Hi Guys,

sorry for my bad English, but anyway I need help with the Leafblocks.


I want that the Oakleaves drop apples everytime I break them with an specific item. Now I have to separate between all the Leafblocks (They have all the same ID, Metadata,...). Any ideas?


public class SaplingDrop extends Event {

    public void onDrops(BlockEvent.HarvestDropsEvent event) {

        int meta;
        Block block = event.block;
        EntityPlayer player= event.harvester;
        World world = event.world;
        int x = event.x;
        int y = event.y;
        int z = event.z;

        if (block == Blocks.leaves /** && meta = *//) {

            LogHelper.info("ICH BIN DURCH 1");
            if(player.getHeldItem() !=null)
                LogHelper.info("ICH BIN DURCH 2");
                if(player.getHeldItem().getItem() == ModItems.applePickerWood)
                        LogHelper.error("ICH BIN DURCH 3");
                        world.spawnEntityInWorld(new EntityItem(world,x,y,z, new ItemStack(Items.apple, 3)));

Link to comment
Share on other sites

-According to the game they all have the same Metadata (4); i have checked that with all leafblocks that I manually placed...

-in my test the harvest event works fine and i also have tried the BlockBreak event. And I want to spawn it manually.

and yes I have read the docs...


But I can't find a way to trigger the event with the Damage Value, because I need the Damage Value to seperate the different leafblocks.

Link to comment
Share on other sites

I've changed my original answer, if I place a leaveblock manually it always had the Metadata of 4 (in my dev enviroment)

and thanks for "event.harvester!=null"; in the flat world I had no issue, but in a "normal" world I got and StackOverflow......


And with the spawnEntity I now that it will spawn, maybe I will this change later.

And with event.blockMetadata I have checked the Meta in the flatworld just to find out what I have to use.


Now that I looked at my code again I've realised that I had a logic fail in there... Now it works fine^^

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.