Skip to content

Instantly share code, notes, and snippets.

@maruohon
Created July 2, 2016 12:48
private void renderWireFrames(BlockPos pos, EntityPlayer player, float partialTicks)
{
List<BakedQuad> quads = this.quadsForWires.get(pos);
if (quads == null)
{
return;
}
double dx = player.lastTickPosX + (player.posX - player.lastTickPosX) * partialTicks;
double dy = player.lastTickPosY + (player.posY - player.lastTickPosY) * partialTicks;
double dz = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * partialTicks;
GlStateManager.pushMatrix();
GlStateManager.translate(pos.getX() - dx, pos.getY() - dy, pos.getZ() - dz);
GlStateManager.color(1f, 1f, 1f, 1f);
GlStateManager.glLineWidth(2.0f);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
for (BakedQuad quad : quads)
{
buffer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.BLOCK);
buffer.addVertexData(quad.getVertexData());
buffer.putColorMultiplier(1f, 1f, 1f, 4);
buffer.putColorMultiplier(1f, 1f, 1f, 3);
buffer.putColorMultiplier(1f, 1f, 1f, 2);
buffer.putColorMultiplier(1f, 1f, 1f, 1);
tessellator.draw();
}
GlStateManager.popMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment