/** * Draws the selection box for the player. Args: entityPlayer, rayTraceHit, i, itemStack, partialTickTime */ public static void drawSelectionBox(EntityPlayer player, RayTraceResult rayTraceResult, float pTickTime, CustomHitBox customHitBox) { if (rayTraceResult.typeOfHit == Type.BLOCK) { GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F); GlStateManager.glLineWidth(2.0F); GlStateManager.disableTexture2D(); GlStateManager.depthMask(false); IBlockState state = player.world.getBlockState(rayTraceResult.getBlockPos()); if (state.getMaterial() != Material.AIR) { //block.setBlockBoundsBasedOnState(thePlayer.worldObj, rayTraceResult.blockX, rayTraceResult.blockY, rayTraceResult.blockZ); double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * pTickTime; double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * pTickTime; double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * pTickTime; drawOutlinedBoundingBox(customHitBox.addExtraSpace(extraSpace).offsetForDraw(-d0, -d1, -d2)); } GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } }