Skip to content

Instantly share code, notes, and snippets.

@quat1024
Created April 16, 2017 22:28
Show Gist options
  • Save quat1024/f4b236f7ef914a02456e5fc7a88eab49 to your computer and use it in GitHub Desktop.
Save quat1024/f4b236f7ef914a02456e5fc7a88eab49 to your computer and use it in GitHub Desktop.
public class TeRenderWaypointBasic extends TileEntitySpecialRenderer<TeWaypointBasic> {
ResourceLocation logSideTex = new ResourceLocation("minecraft:textures/blocks/log_oak.png");
ResourceLocation logEndTex = new ResourceLocation("minecraft:textures/blocks/log_oak_top");
//HERE WE GO BITCHES
public void renderTileEntityAt(TeWaypointBasic te, double x, double y, double z, float pt, int destroyStage) {
TextureManager textureManager = Minecraft.getMinecraft().renderEngine;
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
textureManager.bindTexture(logSideTex);
renderBox(buffer, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1);
tessellator.draw();
GlStateManager.popMatrix();
}
void renderBox(VertexBuffer buffer, float x1, float y1, float z1, float x2, float y2, float z2, float u1, float v1, float u2, float v2) {
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
buffer.normal(0,0,1);
buffer.pos(x1, y1, z1).tex(u1, v1).color(255, 255, 255, 255).endVertex();
buffer.pos(x2, y1, z1).tex(u2, v1).color(255, 255, 255, 255).endVertex();
buffer.pos(x2, y2, z1).tex(u2, v2).color(255, 255, 255, 255).endVertex();
buffer.pos(x1, y2, z1).tex(u1, v2).color(255, 255, 255, 255).endVertex();
//todo the rest of the faces x)
}
public boolean isGlobalRenderer(TeWaypointBasic te) {
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment