Example #1
0
 public void harvestBlock(
     World worldIn, EntityPlayer playerIn, BlockPos pos, IBlockState state, TileEntity te) {
   if (!worldIn.isRemote
       && playerIn.getCurrentEquippedItem() != null
       && playerIn.getCurrentEquippedItem().getItem() == Items.shears) {
     playerIn.triggerAchievement(StatList.mineBlockStatArray[Block.getIdFromBlock(this)]);
     spawnAsEntity(
         worldIn,
         pos,
         new ItemStack(
             Item.getItemFromBlock(this),
             1,
             ((BlockPlanks.EnumType) state.getValue(VARIANT_PROP)).func_176839_a()));
   } else {
     super.harvestBlock(worldIn, playerIn, pos, state, te);
   }
 }
 /** Do not make give this method the name canInteractWith because it clashes with Container */
 public boolean isUseableByPlayer(EntityPlayer playerIn) {
   return this.worldObj.getTileEntity(this.pos) != this
       ? false
       : playerIn.getDistanceSq(
               (double) this.pos.getX() + 0.5D,
               (double) this.pos.getY() + 0.5D,
               (double) this.pos.getZ() + 0.5D)
           <= 64.0D;
 }