Evening all,
Trying my first mod here, I've got some code that renders a highlight around air blocks.
The code works perfectly, until we come across snow covered blocks, Then it crashes the client with little to no information as to why. Here is the code, and the error below. (the try catch is just for debugging)
try
{
EntityPlayerSP player = Minecraft.getMinecraft().player;
World world = player.getEntityWorld();
if (player.getHeldItemMainhand().getItem() == StrapItems.BASIC_STRAP)
{
ItemBasicStrap myItem = (ItemBasicStrap) player.getHeldItemMainhand().getItem();
RayTraceResult tracer = player.rayTrace(myItem.BlockRange, 1.0F);
BlockPos pos = tracer.getBlockPos();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.glLineWidth(3.0F);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
Block state = world.getBlockState(pos).getBlock();
double x = player.lastTickPosX + (player.posX - player.lastTickPosX) * event.getPartialTicks();
double y = player.lastTickPosY + (player.posY - player.lastTickPosY) * event.getPartialTicks();
double z = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * event.getPartialTicks();
RenderGlobal.drawSelectionBoundingBox(state.FULL_BLOCK_AABB.offset(-x, -y, -z).offset(pos).grow(0.002), 1.0F, 1.0F, 1.0F, 0.4F);
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
}
catch (Exception ex)
{
logger.info("AIR STRAPS AIR STRAPS AIR STRAPS >> {}", ex.getMessage());
}
Error
Any help would be greatly appreciated!!