Permalink
Browse files

Fix for an ocassional crash caused by skulls.

  • Loading branch information...
Ri5ux committed Dec 17, 2018
1 parent 396170a commit 4422e056ae316a3bddb5de80404bac8f921602e5
Showing with 37 additions and 31 deletions.
  1. +37 −31 src/main/java/org/avp/client/render/tile/RenderSkull.java
@@ -16,44 +16,50 @@
@Override
public void render(TileEntitySkull skull, double posX, double posY, double posZ, float renderPartialTicks, int destroyStage, float alpha)
{
BlockSkull block = (BlockSkull) skull.getBlockType();
if (skull != null)
{
BlockSkull block = (BlockSkull) skull.getBlockType();

OpenGL.pushMatrix();
float scale = 0.64F;
OpenGL.pushMatrix();
float scale = 0.64F;

OpenGL.translate(posX + 0.5F, posY, posZ + 0.5F);
OpenGL.scale(scale, -scale, scale);
OpenGL.enable(GL11.GL_ALPHA_TEST);
OpenGL.disableCullFace();
OpenGL.rotate(skull);
OpenGL.translate(posX + 0.5F, posY, posZ + 0.5F);
OpenGL.scale(scale, -scale, scale);
OpenGL.enable(GL11.GL_ALPHA_TEST);
OpenGL.disableCullFace();
OpenGL.rotate(skull);

if (skull.getSkullBlock().getSkullTexture() != null)
{
skull.getSkullBlock().getSkullTexture().bind();
}
if (skull.getSkullBlock() != null)
{
if (skull.getSkullBlock().getSkullTexture() != null)
{
skull.getSkullBlock().getSkullTexture().bind();
}

skull.getSkullBlock().preRenderTransforms();
skull.getSkullBlock().preRenderTransforms();

if (block.canChangeOrientation())
{
if (skull.getOrientation() == EnumOrientation.FLAT)
{
OpenGL.translate(-0.4, 0.71F, 0);
OpenGL.rotate(-53.5F, 0, 0, 1);
}
if (block.canChangeOrientation())
{
if (skull.getOrientation() == EnumOrientation.FLAT)
{
OpenGL.translate(-0.4, 0.71F, 0);
OpenGL.rotate(-53.5F, 0, 0, 1);
}

if (skull.getOrientation() == EnumOrientation.WALL)
{
OpenGL.translate(-0.25, -0.1, 0);
OpenGL.rotate(37.5F, 0, 0, 1);
}
}
if (skull.getOrientation() == EnumOrientation.WALL)
{
OpenGL.translate(-0.25, -0.1, 0);
OpenGL.rotate(37.5F, 0, 0, 1);
}
}

for (ModelRenderer m : skull.getSkullBlock().getSkullModelRenderers())
{
m.render(Model.DEFAULT_SCALE);
for (ModelRenderer m : skull.getSkullBlock().getSkullModelRenderers())
{
m.render(Model.DEFAULT_SCALE);
}
}
OpenGL.enableCullFace();
OpenGL.popMatrix();
}
OpenGL.enableCullFace();
OpenGL.popMatrix();
}
}

0 comments on commit 4422e05

Please sign in to comment.