Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************************************
- * Copyright (c) 2014, Superloup10
- *
- * Wolf's Addons is distributed under the terms of the Minecraft Mod Public
- * License 1.0, or MMPL. Please check the contents of the license located in
- * https://www.dropbox.com/s/6l16rc7b1aks211/MMPL-1.0.txt
- ******************************************************************************/
- package wolf.addons.client.render;
- import net.minecraft.client.renderer.Tessellator;
- import net.minecraft.client.renderer.WorldRenderer;
- import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
- import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
- import net.minecraft.tileentity.TileEntity;
- import net.minecraft.util.EnumFacing;
- import net.minecraft.util.ResourceLocation;
- import org.lwjgl.opengl.GL11;
- import wolf.addons.common.tileentity.TileEntityCable;
- public class TESRCable extends TileEntitySpecialRenderer
- {
- // private static final ModelCable model = new ModelCable();
- // private static final ModelCable2 model2 = new ModelCable2();
- // private static final ResourceLocation texture = new ResourceLocation("wolf_addons:textures/blocks/cable.png");
- // private static final ResourceLocation texture2 = new ResourceLocation("wolf_addons:textures/blocks/cable2.png");
- private static final ResourceLocation texture = new ResourceLocation("wolf_addons:textures/blocks/cable1.png");
- private boolean drawInside = true;
- private float pixel = 1F / 16F;
- private float pixel_texture = 1F / 32F;
- public TESRCable()
- {
- this.setRendererDispatcher(TileEntityRendererDispatcher.instance);
- }
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale, int p_180535_9_)
- {
- GL11.glTranslated(x, y, z);
- GL11.glDisable(GL11.GL_LIGHTING);
- this.bindTexture(texture);
- this.renderCore((TileEntityCable)te);
- GL11.glEnable(GL11.GL_LIGHTING);
- GL11.glTranslated(-x, -y, -z);
- /*
- * TileEntityCable tileEntity = (TileEntityCable)te; if(tileEntity.render[0])// South this.renderDirectional((TileEntityCable)te, x, y, z, scale, 0F); if(tileEntity.render[1])// North this.renderDirectional((TileEntityCable)te, x, y, z, scale, 180F); if(tileEntity.render[2])// West this.renderDirectional((TileEntityCable)te, x, y, z, scale, 270F); if(tileEntity.render[3])// East
- * this.renderDirectional((TileEntityCable)te, x, y, z, scale, 90F); if(tileEntity.render[4])// Down this.renderDirectionalAxeNegY((TileEntityCable)te, x, y, z, scale); if(tileEntity.render[5])// Up this.renderDirectionalAxePosY((TileEntityCable)te, x, y, z, scale); this.renderCore((TileEntityCable)te, x, y, z, scale, p_180535_9_);
- */
- }
- /*
- * private void renderDirectionalAxePosY(TileEntityCable te, double x, double y, double z, float scale) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, -1.3103F, -0.69F); this.bindTexture(texture2); model2.renderAll(); GL11.glPopMatrix(); } private void
- * renderDirectionalAxeNegY(TileEntityCable te, double x, double y, double z, float scale) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); GL11.glScalef(1.0F, 1.0F, 1.05F); GL11.glTranslatef(0.0F, -1.313F, -1.24F); this.bindTexture(texture2); model2.renderAll(); GL11.glPopMatrix(); } private
- * void renderDirectional(TileEntityCable te, double x, double y, double z, float scale, float angle) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.55D, y + 1.5D, z + 0.5D); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(angle, 0.0F, 1.0F, 0.0F); this.bindTexture(texture2); model2.renderAll(); GL11.glPopMatrix(); }
- */
- private void renderDirectional(EnumFacing direction)
- {
- switch(direction)
- {
- case NORTH:
- break;
- case SOUTH:
- break;
- case UP:
- break;
- case DOWN:
- break;
- case WEST:
- break;
- case EAST:
- break;
- }
- Tessellator tessellator = Tessellator.getInstance();
- WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- worldrenderer.startDrawingQuads();
- {
- }
- tessellator.draw();
- }
- private void renderCore(TileEntityCable te/* , double x, double y, double z, float scale, int p_180535_9_ */)
- {
- Tessellator tessellator = Tessellator.getInstance();
- WorldRenderer worldrenderer = tessellator.getWorldRenderer();
- worldrenderer.startDrawingQuads();
- {
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- if(drawInside)
- {
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 0 * pixel_texture, 5 * pixel_texture);
- worldrenderer.addVertexWithUV(1 - 11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 0 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 11 * pixel / 2, 5 * pixel_texture, 0 * pixel_texture);
- worldrenderer.addVertexWithUV(11 * pixel / 2, 11 * pixel / 2, 1 - 11 * pixel / 2, 5 * pixel_texture, 5 * pixel_texture);
- }
- }
- tessellator.draw();
- /*
- * GL11.glPushMatrix(); GL11.glTranslated(x + 0.5D, y + 1.5D, z + 0.5D); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(0F, 0.0F, 1.0F, 1.0F); this.bindTexture(texture); model.renderAll(); GL11.glPopMatrix();
- */
- }
- private void drawVertex(WorldRenderer worldrenderer, double x, double y, double u, double v)
- {
- x = 11 * pixel / 2;
- y = 1 - 11 * pixel / 2;
- u = 5 * pixel_texture;
- v = 0 * pixel_texture;
- worldrenderer.addVertexWithUV(y, x, y, u, u);
- worldrenderer.addVertexWithUV(y, y, y, u, v);
- worldrenderer.addVertexWithUV(x, y, y, v, v);
- worldrenderer.addVertexWithUV(x, y, y, v, u);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement