@Override public boolean onBlockStartBreak(ItemStack itemstack, BlockPos pos, EntityPlayer player) { if(!ToolHelper.isBroken(itemstack) && this instanceof IAoeTool && ((IAoeTool) this).isAoeHarvestTool()) { for(BlockPos extraPos : ((IAoeTool) this).getAOEBlocks(itemstack, player.getEntityWorld(), player, pos)) { breakExtraBlock(itemstack, player.getEntityWorld(), player, extraPos, pos); } } // this is a really dumb hack. // Basically when something with silktouch harvests a block from the offhand // the game can't detect that. so we have to switch around the items in the hands for the break call // it's switched back in onBlockDestroyed if(DualToolHarvestUtils.shouldUseOffhand(player, pos, player.getHeldItemMainhand())) { ItemStack off = player.getHeldItemOffhand(); switchItemsInHands(player); // remember, off is in the mainhand now NBTTagCompound tag = TagUtil.getTagSafe(off); tag.setLong(TAG_SWITCHED_HAND_HAX, player.getEntityWorld().getTotalWorldTime()); off.setTagCompound(tag); } return breakBlock(itemstack, pos, player); }
tool = DualToolHarvestUtils.getItemstackToUse(player, world.getBlockState(mop.getBlockPos())); if(tool.getItem() instanceof IAoeTool) { ImmutableList<BlockPos> extraBlocks = ((IAoeTool) tool.getItem()).getAOEBlocks(tool, world, player, mop.getBlockPos()); for(BlockPos pos : extraBlocks) { event.getContext().drawSelectionBox(player, new RayTraceResult(new Vec3d(0, 0, 0), null, pos), 0, event.getPartialTicks()); if(tool.getItem() instanceof IAoeTool && ((IAoeTool) tool.getItem()).isAoeHarvestTool()) { BlockPos pos = controllerMP.currentBlock; drawBlockDamageTexture(Tessellator.getInstance(), event.getPartialTicks(), world, ((IAoeTool) tool.getItem()).getAOEBlocks(tool, world, player, pos));