Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package buildermod.client;
- import net.minecraft.client.renderer.RenderHelper;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.ResourceLocation;
- import org.lwjgl.opengl.GL11;
- import buildermod.common.TileEntityBuilder;
- public class TileEntityBuilderRenderer extends TileEntitySpecialRenderer {
- private static final ResourceLocation RSC_BUILDER = new ResourceLocation("buildermod:textures/entities/builder2.png");
- ModelBuilderPost post = new ModelBuilderPost();
- ModelBuilder builder = new ModelBuilder();
- public void renderTileEntityAt(TileEntityBuilder entity, double x, double y, double z, float f) {
- int dir = entity.getWorldObj().getBlockMetadata(entity.xCoord, entity.yCoord, entity.zCoord) & 3;
- bindTexture(RSC_BUILDER);
- GL11.glPushMatrix();
- GL11.glDisable(GL11.GL_CULL_FACE);
- GL11.glTranslated(x + .5, y + 1, z + .5);
- GL11.glScaled(1, -1, -1);
- GL11.glColor3f(1, 1, 1);
- GL11.glRotated(90 * (dir + 2), 0, 1, 0);
- builder.renderAll();
- // GL11.glRotated(-90 * dir, 0, 1, 0);
- if (entity.hasWork()) {
- int size = entity.getModel().getSize();
- if (size <= 0)
- return;
- // GL11.glEnable(GL11.GL_BLEND);
- // OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA,
- // GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
- Tessellator tess = Tessellator.instance;
- RenderHelper.disableStandardItemLighting();
- tess.startDrawing(GL11.GL_QUAD_STRIP);
- float x1 = -0.563f;
- float x2 = size - 0.437f;
- float z1 = 0.437f;
- float z2 = size + 0.563f;
- float[] xx = { x1, x1, x2, x2, x1 };
- float[] zz = { z1, z2, z2, z1, z1 };
- for (int i = 0; i < 5; i++) {
- tess.addVertexWithUV(xx[i], 1, zz[i], (size + .25) * i / 2,
- 31.0 / 64);
- tess.addVertexWithUV(xx[i], 2.0 / 16, zz[i], (size + .25) * i
- / 2, 0);
- }
- tess.draw();
- GL11.glEnable(GL11.GL_CULL_FACE);
- GL11.glTranslated((x1 + x2) / 2, 0, (z1 + z2) / 2);
- for (int i = 0; i < 4; i++) {
- for (int j = 0; j < size; j += 9) {
- GL11.glTranslated(-size / 2.0 + j, 0, size / 2.0);
- post.renderAll();
- GL11.glTranslated(size / 2.0 - j, 0, -size / 2.0);
- }
- GL11.glRotated(90, 0, 1, 0);
- }
- // GL11.glRotated(180 - 90 * dir, 0, 1, 0);
- // GL11.glTranslated(-.5, .5, .5);
- }
- GL11.glPopMatrix();
- }
- @Override
- public void renderTileEntityAt(TileEntity entity, double x, double y, double z, float f) {
- renderTileEntityAt((TileEntityBuilder) entity, x, y, z, f);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement