Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void renderTileEntityAt(TileEntityQuarry te, double xIn, double yIn, double zIn, float partialTicks, int destroyStage)
- {
- super.renderTileEntityAt(te, xIn, yIn, zIn, partialTicks, destroyStage);
- EntityPlayer entityplayer = Minecraft.getMinecraft().thePlayer;
- BlockPos start = te.getStart();
- BlockPos end = te.getEnd();
- BlockPos current = te.getCurrent();
- Tessellator tes = Tessellator.getInstance();
- VertexBuffer buff = tes.getBuffer();
- Random rnd = new Random((long)(xIn + yIn + zIn));
- float r = 1.0f;//rnd.nextFloat();
- float g = 0.0f;//rnd.nextFloat();
- float b = 0.0f;//rnd.nextFloat();
- double driftX = entityplayer.lastTickPosX + (entityplayer.posX - entityplayer.lastTickPosX) * (double)partialTicks;
- double driftY = entityplayer.lastTickPosY + (entityplayer.posY - entityplayer.lastTickPosY) * (double)partialTicks;
- double driftZ = entityplayer.lastTickPosZ + (entityplayer.posZ - entityplayer.lastTickPosZ) * (double)partialTicks;
- double yMin = (double)(current.getY()) - driftY;
- double yMax = (double)(end.getY()+1) - driftY;
- double xMin = (double)(start.getX() < end.getX() ? start.getX() : end.getX()) - driftX;
- double zMin = (double)(start.getZ() < end.getZ() ? start.getZ() : end.getZ()) - driftZ;
- int xSize = Math.abs(start.getX() - end.getX());
- int zSize = Math.abs(start.getZ() - end.getZ());
- GlStateManager.disableTexture2D();
- GlStateManager.disableBlend();
- GlStateManager.glLineWidth(1.0F);
- buff.begin(3, DefaultVertexFormats.POSITION_COLOR);
- int step = 2;
- for (int j = step; j <= xSize; j += step)
- {
- double xOff = xMin + j;
- //North Face
- buff.pos(xOff, yMin, zMin ).color(r, g, b, 0.0F).endVertex();
- buff.pos(xOff, yMin, zMin ).color(r, g, b, 1.0F).endVertex();
- buff.pos(xOff, yMax, zMin ).color(r, g, b, 1.0F).endVertex();
- buff.pos(xOff, yMax, zMin ).color(r, g, b, 0.0F).endVertex();
- //South Face
- buff.pos(xOff, yMin, zMin + 16.0D).color(r, g, b, 0.0F).endVertex();
- buff.pos(xOff, yMin, zMin + 16.0D).color(r, g, b, 1.0F).endVertex();
- buff.pos(xOff, yMax, zMin + 16.0D).color(r, g, b, 1.0F).endVertex();
- buff.pos(xOff, yMax, zMin + 16.0D).color(r, g, b, 0.0F).endVertex();
- }
- for (int j = step; j <= zSize; j += step)
- {
- double zOff = zMin + j;
- //West Face
- buff.pos(xMin, yMin, zOff).color(r, g, b, 0.0F).endVertex();
- buff.pos(xMin, yMin, zOff).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin, yMax, zOff).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin, yMax, zOff).color(r, g, b, 0.0F).endVertex();
- //East Face
- buff.pos(xMin + 16.0D, yMin, zOff).color(r, g, b, 0.0F).endVertex();
- buff.pos(xMin + 16.0D, yMin, zOff).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin + 16.0D, yMax, zOff).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin + 16.0D, yMax, zOff).color(r, g, b, 0.0F).endVertex();
- }
- //Horizontal Y rings
- for (int y = start.getY(); y <= end.getY(); y += step)
- {
- double yOff = (double)y - driftY;
- buff.pos(xMin, yOff, zMin ).color(r, g, b, 0.0F).endVertex();
- buff.pos(xMin, yOff, zMin ).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin, yOff, zMin + 16.0D).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin + 16.0D, yOff, zMin + 16.0D).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin + 16.0D, yOff, zMin ).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin, yOff, zMin ).color(r, g, b, 1.0F).endVertex();
- buff.pos(xMin, yOff, zMin ).color(r, g, b, 0.0F).endVertex();
- }
- tes.draw();
- GlStateManager.glLineWidth(1.0F);
- GlStateManager.enableBlend();
- GlStateManager.enableTexture2D();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement