private boolean doDuctHighlight(RayTraceResult target, EntityPlayer player, float partialTicks) { if (target.typeOfHit != Type.BLOCK) { return false; } RayTracer.retraceBlock(player.world, player, target.getBlockPos()); TileEntity tile = player.world.getTileEntity(target.getBlockPos()); if (tile instanceof ICustomHitBox) { ICustomHitBox hitbox = (ICustomHitBox) tile; if (hitbox.shouldRenderCustomHitBox(target.subHit, player)) { RenderHitbox.drawSelectionBox(player, target, partialTicks, hitbox.getCustomHitBox(target.subHit, player)); return true; } } return false; }
private boolean doAttachmentHighlight(RayTraceResult target, EntityPlayer player, float partialTicks) { if (!(ItemHelper.getHeldStack(player).getItem() instanceof ItemAttachment) || target.typeOfHit != Type.BLOCK) { return false; } RayTracer.retraceBlock(player.world, player, target.getBlockPos()); ItemStack stack = ItemHelper.getHeldStack(player); Attachment attachment = ItemAttachment.getAttachment(stack, player, player.world, target.getBlockPos(), target.sideHit); if (attachment == null || !attachment.canAddToTile(attachment.baseTile)) { return false; } Cuboid6 c = attachment.getCuboid(); c.max.subtract(c.min); RenderHitbox.drawSelectionBox(player, target, partialTicks, new CustomHitBox(c.max.y, c.max.z, c.max.x, attachment.baseTile.x() + c.min.x, attachment.baseTile.y() + c.min.y, attachment.baseTile.z() + c.min.z)); attachment.drawSelectionExtra(player, target, partialTicks); return true; }