Jump to content

[1.4.7] OnItemUse Help


christopher7332

Recommended Posts

I'm trying to create a item that when you click on a certain block, it will change into a different block that you can collect. Here is my code so far:

public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int par4, int par5, int par6, int par7)
        {
                 if(world.getBlockId(par4, par5, par6) == ModpackExtras.minedawnoreblock.blockID)
                 {
    					 itemstack.damageItem(1, entityplayer);
                         entityplayer.inventory.addItemStackToInventory(new ItemStack(ModpackExtras.glowshardblock));
                         return true;
                 } else
                 {
                         return false;
                 }
        }

I set it to give you it instead of changing into the block for testing purposes. I went to try it, but it did not activate or do anything. I tried taking out the if statement to see if it was getting caught up on checking the block, but it did not work. Please help.

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.

Guest
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.

Announcements



×
×
  • Create New...

Important Information

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