Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Most of the block is rendered by ISBRH
- //Only the door (which animates) will be rendered with TESR like this.
- //Image 1: http://ctrlv.in/716615 - Correct, looking down
- //Image 2: http://ctrlv.in/716616 - Look up a little and they bug out.
- @Override
- public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float scale) {
- LootCrateEntity te = (LootCrateEntity) tileEntity;
- ItemStack item = te.getStackInSlot(1);
- //Rotation stuff removed for debug
- String uuid = Minecraft.getMinecraft().thePlayer.getUniqueID().toString();
- if (te.playerList.contains(uuid)) {
- renderDoor(te, x, y, z, 135, true);
- } else {
- //More stuff removed for debug
- renderDoor(te, x, y, z, 10, false);
- }
- }
- public void renderDoor(LootCrateEntity te, double x, double y, double z, float rotation, boolean open) {
- GL11.glPushMatrix();
- GL11.glTranslated(x, y, z);
- //Rotation && extra icons etc removed for debug
- IIcon icon = te.blockType.getIcon(8, 1);
- double u0 = (double) icon.getMinU();
- double u1 = (double) icon.getMaxU();
- double v0 = (double) icon.getMinV();
- double v1 = (double) icon.getMaxV();
- tess.startDrawingQuads();
- tess.addVertexWithUV(0.25, 0.499, 0.75, u1, v1);
- tess.addVertexWithUV(0.25, 0.499, 0.8125, u1, v0);
- tess.addVertexWithUV(0.75, 0.499, 0.8125, u0, v0);
- tess.addVertexWithUV(0.75, 0.499, 0.75, u0, v1);
- tess.setColorOpaque(204, 204, 204); //NORTH (inside)
- tess.addVertexWithUV(0.75, 0.5, 0.75, u1, v1);
- tess.addVertexWithUV(0.75, 0, 0.75, u1, v0);
- tess.addVertexWithUV(0.25, 0, 0.75, u0, v0);
- tess.addVertexWithUV(0.25, 0.5, 0.75, u0, v1);
- tess.setColorOpaque(153, 153, 153); //EAST (right side)
- tess.addVertexWithUV(0.75, 0.5, 0.8125, u1, v1);
- tess.addVertexWithUV(0.75, 0, 0.8125, u1, v0);
- tess.addVertexWithUV(0.75, 0, 0.75, u0, v0);
- tess.addVertexWithUV(0.75, 0.5, 0.75, u0, v1);
- tess.setColorOpaque(204, 204, 204); //SOUTH (outside)
- tess.addVertexWithUV(0.25, 0.5, 0.8125, u1, v1);
- tess.addVertexWithUV(0.25, 0, 0.8125, u1, v0);
- tess.addVertexWithUV(0.75, 0, 0.8125, u0, v0);
- tess.addVertexWithUV(0.75, 0.5, 0.8125, u0, v1);
- tess.setColorOpaque(153, 153, 153); //WEST (left side)
- tess.addVertexWithUV(0.25, 0.5, 0.75, u1, v1);
- tess.addVertexWithUV(0.25, 0, 0.75, u1, v0);
- tess.addVertexWithUV(0.25, 0, 0.8125, u0, v0);
- tess.addVertexWithUV(0.25, 0.5, 0.8125, u0, v1);
- tess.setColorOpaque(128, 128, 128); //BOTTOM
- tess.addVertexWithUV(0.25, 0, 0.8125, u1, v1);
- tess.addVertexWithUV(0.25, 0, 0.75, u1, v0);
- tess.addVertexWithUV(0.75, 0, 0.75, u0, v0);
- tess.addVertexWithUV(0.75, 0, 0.8125, u0, v1);
- tess.draw();
- GL11.glPopMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement