Created
October 8, 2017 20:04
-
-
Save elucent/74eecc1c508df305e152c5f050457756 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void render(TileDistillery te, double x, double y, double z, float partialTicks, int destroyStage, float alpha){ | |
IInventory chamber = (IInventory)te.modules.get(te.CHAMBER); | |
if (!chamber.getStackInSlot(0).isEmpty()){ | |
GlStateManager.pushMatrix(); | |
GlStateManager.translate(x+0.5, y+0.5, z+0.5); | |
GlStateManager.rotate(-te.face.getHorizontalAngle()+180, 0, 1, 0); | |
GlStateManager.translate(0d, 12d/16d, -16d/16d); | |
GlStateManager.rotate((ELEvents.ticks%360+partialTicks), 0, 1, 0); | |
int ct = this.getModelCount(chamber.getStackInSlot(0)); | |
GlStateManager.translate(0, 0, -((ct+1)/2.0d)*0.0625d); | |
for (int i = 0; i < ct; i ++){ | |
GlStateManager.translate(0, 0, 0.0625d); | |
Minecraft.getMinecraft().getRenderItem().renderItem(chamber.getStackInSlot(0), TransformType.GROUND); | |
} | |
GlStateManager.popMatrix(); | |
} | |
Minecraft.getMinecraft().getTextureManager().bindTexture(JAR); | |
Tessellator tess = Tessellator.getInstance(); | |
BufferBuilder buf = tess.getBuffer(); | |
GlStateManager.disableCull(); | |
GlStateManager.enableBlend(); | |
GlStateManager.enableAlpha(); | |
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); | |
int dfunc = GL11.glGetInteger(GL11.GL_DEPTH_FUNC); | |
GlStateManager.depthFunc(GL11.GL_LEQUAL); | |
int func = GL11.glGetInteger(GL11.GL_ALPHA_TEST_FUNC); | |
float ref = GL11.glGetFloat(GL11.GL_ALPHA_TEST_REF); | |
GlStateManager.alphaFunc(GL11.GL_ALWAYS, 0); | |
GlStateManager.depthMask(false); | |
GlStateManager.pushMatrix(); | |
GlStateManager.translate(x+0.5, y+0.5, z+0.5); | |
GlStateManager.rotate(-te.face.getHorizontalAngle()+180, 0, 1, 0); | |
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); | |
Primitives.addCubeToBuffer(buf, | |
-6d/16d, 8d/16d, -10d/16d, | |
6d/16d, 20d/16d, -22d/16d, | |
new Vec4d[]{ | |
new Vec4d(0,0,0.75d,0.75d), | |
new Vec4d(0,0,0.75d,0.75d), | |
new Vec4d(0,0,0.75d,0.75d), | |
new Vec4d(0,0,0.75d,0.75d), | |
new Vec4d(0,0,0.75d,0.75d), | |
new Vec4d(0,0,0.75d,0.75d) | |
}, | |
1f, 1f, 1f, 1f, | |
true, true, true, true, true, true); | |
tess.draw(); | |
GlStateManager.depthMask(true); | |
GlStateManager.alphaFunc(func, ref); | |
GlStateManager.depthFunc(dfunc); | |
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA); | |
GlStateManager.disableBlend(); | |
Minecraft.getMinecraft().getTextureManager().bindTexture(VENTS); | |
float phase = 1440f*(te.progress+(te.progress > 0 ? Minecraft.getMinecraft().getRenderPartialTicks() : 0))/200f; | |
double aCoeff = (1f+Math.sin(Math.toRadians(phase-90f)))/2f; | |
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); | |
Primitives.addCubeToBuffer(buf, | |
-6d/16d, 40d/16d+aCoeff*0.5f, -6d/16d, | |
6d/16d, 42d/16d+aCoeff*0.5f, 6d/16d, | |
new Vec4d[]{ | |
new Vec4d(0.625d,0.5d,0.375d,0.0625d), | |
new Vec4d(0.625d,0.5d,0.375d,0.0625d), | |
new Vec4d(0.625d,0.5d,0.375d,0.375d), | |
new Vec4d(0.625d,0.5d,0.375d,0.375d), | |
new Vec4d(0.625d,0.5d,0.375d,0.0625d), | |
new Vec4d(0.625d,0.5d,0.375d,0.0625d) | |
}, | |
1f, 1f, 1f, 1f, | |
true, true, true, true, true, true); | |
Primitives.addCubeToBuffer(buf, | |
-5d/16d, 40d/16d, -5d/16d, | |
5d/16d, 40d/16d+aCoeff*0.5f, 5d/16d, | |
new Vec4d[]{ | |
new Vec4d(0.3125d,0.5d+0.3125d*(1.0f-aCoeff),0.3125d,0.3125d*aCoeff), | |
new Vec4d(0.3125d,0.5d+0.3125d*(1.0f-aCoeff),0.3125d,0.3125d*aCoeff), | |
new Vec4d(0d,0.5d,0.3125d,0.3125d), | |
new Vec4d(0d,0.5d,0.3125d,0.3125d), | |
new Vec4d(0.3125d,0.5d+0.3125d*(1.0f-aCoeff),0.3125d,0.3125d*aCoeff), | |
new Vec4d(0.3125d,0.5d+0.3125d*(1.0f-aCoeff),0.3125d,0.3125d*aCoeff) | |
}, | |
1f, 1f, 1f, 1f, | |
true, true, true, true, true, true); | |
tess.draw(); | |
if (te.progress > 0){ | |
GlStateManager.rotate(720.0f*((float)((float)te.progress+Minecraft.getMinecraft().getRenderPartialTicks())/200f),0,1,0); | |
} | |
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); | |
Primitives.addCubeToBuffer(buf, | |
-6d/16d, 29d/16d, -6d/16d, | |
6d/16d, 37d/16d, 6d/16d, | |
new Vec4d[]{ | |
new Vec4d(0.375d,0,0.375d,0.25d), | |
new Vec4d(0.375d,0,0.375d,0.25d), | |
new Vec4d(0,0,0.375d,0.375d), | |
new Vec4d(0,0,0.375d,0.375d), | |
new Vec4d(0.375d,0,0.375d,0.25d), | |
new Vec4d(0.375d,0,0.375d,0.25d) | |
}, | |
1f, 1f, 1f, 1f, | |
true, true, true, true, true, true); | |
tess.draw(); | |
for (float i = 0; i < 360f; i += 72f){ | |
GlStateManager.rotate(72f,0,1,0); | |
buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL); | |
Primitives.addCubeToBuffer(buf, | |
-3d/16d, 30d/16d, 4d/16d, | |
3d/16d, 36d/16d, 10d/16d, | |
new Vec4d[]{ | |
new Vec4d(0.75d,0,0.1875d,0.1875d), | |
new Vec4d(0.75d,0,0.1875d,0.1875d), | |
new Vec4d(0.75d,0.25d,0.1875d,0.1875d), | |
new Vec4d(0.75d,0.25d,0.1875d,0.1875d), | |
new Vec4d(0.5d,0.25d,0.1875d,0.1875d), | |
new Vec4d(0.5d,0.25d,0.1875d,0.1875d) | |
}, | |
1f, 1f, 1f, 1f, | |
true, true, true, true, true, true); | |
tess.draw(); | |
} | |
GlStateManager.popMatrix(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment