Created
January 24, 2016 10:43
-
-
Save AndersBillLinden/ab3b97b92951f3aff319 to your computer and use it in GitHub Desktop.
harvest block in PlayerInteractEvent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SubscribeEvent | |
public boolean onPlayerInteract(PlayerInteractEvent event) | |
{ | |
World world = event.world; | |
EntityPlayer player = event.entityPlayer; | |
ItemStack item = player.getCurrentEquippedItem(); | |
if (item != null && item.getItem() == IronGolemFarmMod.redstonePickaxe && | |
event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) | |
{ | |
BlockPos pos = event.pos; | |
IBlockState bs = world.getBlockState(pos); | |
Block block = bs.getBlock(); | |
block.harvestBlock(world, player, pos, bs, null); | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment