Skip to content

Instantly share code, notes, and snippets.

@SanAndreaP
Created March 24, 2012 16:20
Show Gist options
  • Save SanAndreaP/2184780 to your computer and use it in GitHub Desktop.
Save SanAndreaP/2184780 to your computer and use it in GitHub Desktop.
public boolean blockActivated(World world, int i, int j, int k,
EntityPlayer entityplayer) {
super.onBlockClicked(world, i, j, k, entityplayer);
if( entityplayer != null &&
entityplayer.getCurrentEquippedItem() != null &&
world.getBlockMetadata(i, j, k) != 7 &&
entityplayer.getCurrentEquippedItem().isItemEqual(new ItemStack(Item.dyePowder, 1, 15))) {
growTree(world, i, j, k, world.rand);
entityplayer.getCurrentEquippedItem().stackSize--;
if(entityplayer.getCurrentEquippedItem().stackSize <= 0)
entityplayer.destroyCurrentEquippedItem();
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment