Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ThaumicGenRenderer extends TileEntitySpecialRenderer {
- private static final ResourceLocation TEX = new ResourceLocation(Knowledge.MODID+":"+"textures/models/ThaumicGen_model.png");
- private ModelThaumicGen model;
- public ThaumicGenRenderer() {
- this.model = new ModelThaumicGen();
- }
- @Override
- public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
- GL11.glPushMatrix();
- GL11.glTranslatef((float)x, (float)y, (float)z);
- GL11.glRotatef(0F, 0, 0, 0);
- GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
- GL11.glEnable(GL11.GL_BLEND);
- GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
- TileEntityThaumicGen t = (TileEntityThaumicGen)te;
- renderBlockYour(t, t.getWorldObj(), t.xCoord, t.yCoord, t.zCoord, TKBlocks.dummytg);
- //GL11.glDisable(GL11.GL_BLEND);
- GL11.glPopMatrix();
- }
- private void renderBlockYour(TileEntityThaumicGen te, World world, int i, int j, int k, Block block) {
- TileEntityThaumicGen t = (TileEntityThaumicGen)te;
- Tessellator tessellator = Tessellator.instance;
- float f = block.getLightValue(world, i, j, k);
- int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
- int l1 = l % 65536;
- int l2 = l / 65536;
- tessellator.setColorOpaque_F(f, f, f);
- OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2);
- int dir = world.getBlockMetadata(i, j, k);
- switch(t.getFacing().ordinal()) {
- case 2:
- GL11.glRotatef(180, 0, 1, 0);
- GL11.glTranslatef(0F, -1.5F, 1F); // +0.5, -0.5, +1
- break;
- case 3:
- GL11.glRotatef(0, 0, 1, 0);
- GL11.glTranslatef(1F, -1.5F, 0F);
- break;
- case 4:
- GL11.glRotatef(90, 0, 1, 0);
- GL11.glTranslatef(1F, -1.5F, 1F);
- break;
- case 5:
- GL11.glRotatef(270, 0F, 1F, 0F);
- GL11.glTranslatef(0F, -1.5F, 0F);
- break;
- default: break;
- }
- GL11.glRotatef(dir * (-90F), 0F, 1F, 0F);
- GL11.glTranslatef(-0.5F, 0F, -0.5F);
- Minecraft.getMinecraft().renderEngine.bindTexture(TEX);
- this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- this.model.renderFloor((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- //this.model.renderGlass((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
- }
- }
- public class ModelThaumicGen extends ModelBase {
- public ModelRenderer Jar;
- public ModelRenderer Top;
- public ModelRenderer Bottom;
- public ModelRenderer JarInside;
- public ModelRenderer CoilA;
- public ModelRenderer CoilB;
- public ModelRenderer CoilC;
- public ModelRenderer CoilD;
- public ModelRenderer CoilA_1;
- public ModelRenderer CoilB_1;
- public ModelRenderer CoilC_1;
- public ModelRenderer CoilD_1;
- public ModelRenderer ConnectorA;
- public ModelRenderer ConnectorB;
- public ModelRenderer ConnectorC;
- public ModelRenderer ConnectorD;
- public ModelRenderer TrimFBA;
- public ModelRenderer TrimFBB;
- public ModelRenderer TrimFBC;
- public ModelRenderer TrimFBD;
- public ModelRenderer TrimLRC;
- public ModelRenderer TrimLRD;
- public ModelRenderer TrimLRA;
- public ModelRenderer TrimLRB;
- public ModelRenderer TrimTDA;
- public ModelRenderer TrimTDB;
- public ModelRenderer TrimTDC;
- public ModelRenderer TrimTDD;
- public ModelRenderer ConnectorA_1;
- public ModelRenderer ConnectorB_1;
- public ModelRenderer ConnectorC_1;
- public ModelRenderer ConnectorD_1;
- public ModelThaumicGen() {
- this.textureWidth = 64;
- this.textureHeight = 64;
- this.ConnectorA = new ModelRenderer(this, 0, 17);
- this.ConnectorA.setRotationPoint(-7.0F, 18.0F, 0.0F);
- this.ConnectorA.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
- this.setRotateAngle(ConnectorA, 0.0F, 0.0F, -0.19198621771937624F);
- this.TrimFBC = new ModelRenderer(this, 60, 43);
- this.TrimFBC.setRotationPoint(7.0F, -2.0F, -7.0F);
- this.TrimFBC.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
- this.setRotateAngle(TrimFBC, 1.5707963267948966F, 0.0F, 0.0F);
- this.CoilC = new ModelRenderer(this, 56, 20);
- this.CoilC.setRotationPoint(-3.3F, -5.000000000000003F, 3.3F);
- this.CoilC.addBox(-2.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F);
- this.setRotateAngle(CoilC, -0.19198621771937624F, 0.0F, -0.19198621771937624F);
- this.CoilB = new ModelRenderer(this, 56, 20);
- this.CoilB.setRotationPoint(-3.3F, -5.000000000000003F, -3.3F);
- this.CoilB.addBox(-2.0F, 0.0F, -2.0F, 2, 3, 2, 0.0F);
- this.setRotateAngle(CoilB, 0.19198621771937624F, 0.0F, -0.19198621771937624F);
- this.Bottom = new ModelRenderer(this, 0, 0);
- this.Bottom.setRotationPoint(0.0F, 24.0F, 0.0F);
- this.Bottom.addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12, 0.0F);
- this.setRotateAngle(Bottom, 0.0F, 0.0F, 3.141592653589793F);
- this.TrimTDC = new ModelRenderer(this, 60, 43);
- this.TrimTDC.setRotationPoint(7.0F, -2.0F, 6.0F);
- this.TrimTDC.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
- this.Jar = new ModelRenderer(this, 0, 32);
- this.Jar.setRotationPoint(0.0F, -2.4F, 0.0F);
- this.Jar.addBox(-6.0F, 0.0F, -6.0F, 12, 20, 12, 0.0F);
- this.TrimFBA = new ModelRenderer(this, 60, 43);
- this.TrimFBA.setRotationPoint(-6.0F, -2.0F, -7.0F);
- this.TrimFBA.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
- this.setRotateAngle(TrimFBA, 1.5707963267948966F, 0.0F, 0.0F);
- this.TrimTDA = new ModelRenderer(this, 60, 43);
- this.TrimTDA.setRotationPoint(-6.0F, -2.0F, 6.0F);
- this.TrimTDA.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
- this.CoilD = new ModelRenderer(this, 56, 20);
- this.CoilD.setRotationPoint(3.3F, -5.000000000000003F, -3.3F);
- this.CoilD.addBox(0.0F, 0.0F, -2.0F, 2, 3, 2, 0.0F);
- this.setRotateAngle(CoilD, 0.19198621771937624F, 0.0F, 0.19198621771937624F);
- this.CoilD_1 = new ModelRenderer(this, 56, 29);
- this.CoilD_1.setRotationPoint(3.0F, -1.0F, -2.0F);
- this.CoilD_1.addBox(0.0F, -1.4F, -2.0F, 1, 3, 1, 0.0F);
- this.setRotateAngle(CoilD_1, 0.19198621771937624F, 0.0F, 0.19198621771937624F);
- this.CoilA = new ModelRenderer(this, 56, 20);
- this.CoilA.setRotationPoint(3.3F, -5.000000000000003F, 3.3F);
- this.CoilA.addBox(0.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F);
- this.setRotateAngle(CoilA, -0.19198621771937624F, 0.0F, 0.19198621771937624F);
- this.TrimFBB = new ModelRenderer(this, 60, 43);
- this.TrimFBB.setRotationPoint(-6.0F, 19.0F, -7.0F);
- this.TrimFBB.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
- this.setRotateAngle(TrimFBB, 1.5707963267948966F, 0.0F, 0.0F);
- this.ConnectorD = new ModelRenderer(this, 18, 21);
- this.ConnectorD.setRotationPoint(0.0F, 18.0F, -7.0F);
- this.ConnectorD.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
- this.setRotateAngle(ConnectorD, 0.19198621771937624F, 0.0F, 0.0F);
- this.JarInside = new ModelRenderer(this, 28, 0);
- //this.JarInside.setRotationPoint(0.0F, 0.0F, 0.0F);
- this.JarInside.setRotationPoint(0.0F, 10.2F, 0.0F);
- this.JarInside.addBox(-6.0F, 0.0F, -6.0F, 12, 0, 12, 0.0F);
- this.ConnectorA_1 = new ModelRenderer(this, 0, 17);
- this.ConnectorA_1.setRotationPoint(-7.0F, -1.9999999999999791F, 0.0F);
- this.ConnectorA_1.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
- this.setRotateAngle(ConnectorA_1, 0.0F, 0.0F, -2.949606435870417F);
- this.TrimLRA = new ModelRenderer(this, 60, 43);
- this.TrimLRA.setRotationPoint(-6.0F, -2.0F, -7.0F);
- this.TrimLRA.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
- this.setRotateAngle(TrimLRA, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
- this.TrimLRD = new ModelRenderer(this, 60, 43);
- this.TrimLRD.setRotationPoint(-6.0F, 19.0F, -7.0F);
- this.TrimLRD.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
- this.setRotateAngle(TrimLRD, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
- this.CoilB_1 = new ModelRenderer(this, 56, 29);
- this.CoilB_1.setRotationPoint(-2.0F, -1.0F, -2.0F);
- this.CoilB_1.addBox(-2.0F, -1.4F, -2.0F, 1, 3, 1, 0.0F);
- this.setRotateAngle(CoilB_1, 0.19198621771937624F, 0.0F, -0.19198621771937624F);
- this.CoilC_1 = new ModelRenderer(this, 56, 29);
- this.CoilC_1.setRotationPoint(-2.0F, -1.0F, 3.0F);
- this.CoilC_1.addBox(-2.0F, -1.4F, 0.0F, 1, 3, 1, 0.0F);
- this.setRotateAngle(CoilC_1, -0.19198621771937624F, 0.0F, -0.19198621771937624F);
- this.TrimTDD = new ModelRenderer(this, 60, 43);
- this.TrimTDD.mirror = true;
- this.TrimTDD.setRotationPoint(7.0F, -2.0F, -7.0F);
- this.TrimTDD.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
- this.ConnectorC = new ModelRenderer(this, 18, 21);
- this.ConnectorC.setRotationPoint(0.0F, 18.0F, 7.0F);
- this.ConnectorC.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
- this.setRotateAngle(ConnectorC, -0.19198621771937624F, 0.0F, 0.0F);
- this.TrimLRB = new ModelRenderer(this, 60, 43);
- this.TrimLRB.setRotationPoint(-6.0F, -2.0F, 6.0F);
- this.TrimLRB.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
- this.setRotateAngle(TrimLRB, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
- this.ConnectorC_1 = new ModelRenderer(this, 18, 21);
- this.ConnectorC_1.setRotationPoint(0.0F, -1.9999999999999791F, 7.0F);
- this.ConnectorC_1.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
- this.setRotateAngle(ConnectorC_1, -0.19198621771937624F, 0.0F, 3.141592653589793F);
- this.Top = new ModelRenderer(this, 0, 0);
- this.Top.setRotationPoint(0.0F, -8.0F, 0.0F);
- this.Top.addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12, 0.0F);
- this.ConnectorB_1 = new ModelRenderer(this, 0, 17);
- this.ConnectorB_1.setRotationPoint(7.0F, -1.9999999999999791F, 0.0F);
- this.ConnectorB_1.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
- this.setRotateAngle(ConnectorB_1, 0.0F, 0.0F, 2.949606435870417F);
- this.TrimTDB = new ModelRenderer(this, 60, 43);
- this.TrimTDB.setRotationPoint(-6.0F, -2.0F, -7.0F);
- this.TrimTDB.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
- this.ConnectorB = new ModelRenderer(this, 0, 17);
- this.ConnectorB.setRotationPoint(7.0F, 18.0F, 0.0F);
- this.ConnectorB.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
- this.setRotateAngle(ConnectorB, 0.0F, 0.0F, 0.19198621771937624F);
- this.TrimLRC = new ModelRenderer(this, 60, 43);
- this.TrimLRC.setRotationPoint(-6.0F, 19.0F, 6.0F);
- this.TrimLRC.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
- this.setRotateAngle(TrimLRC, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
- this.CoilA_1 = new ModelRenderer(this, 56, 29);
- this.CoilA_1.setRotationPoint(3.0F, -1.0F, 3.0F);
- this.CoilA_1.addBox(0.0F, -1.4F, 0.0F, 1, 3, 1, 0.0F);
- this.setRotateAngle(CoilA_1, -0.19198621771937624F, 0.0F, 0.19198621771937624F);
- this.ConnectorD_1 = new ModelRenderer(this, 18, 21);
- this.ConnectorD_1.setRotationPoint(0.0F, -1.9999999999999791F, -7.0F);
- this.ConnectorD_1.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
- this.setRotateAngle(ConnectorD_1, 0.19198621771937624F, 0.0F, 3.141592653589793F);
- this.TrimFBD = new ModelRenderer(this, 60, 43);
- this.TrimFBD.setRotationPoint(7.0F, 19.0F, -7.0F);
- this.TrimFBD.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
- this.setRotateAngle(TrimFBD, 1.5707963267948966F, 0.0F, 0.0F);
- }
- @Override
- public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
- this.ConnectorA.render(f5);
- this.TrimFBC.render(f5);
- this.CoilC.render(f5);
- this.CoilB.render(f5);
- this.Bottom.render(f5);
- this.TrimTDC.render(f5);
- this.TrimFBA.render(f5);
- this.TrimTDA.render(f5);
- this.CoilD.render(f5);
- this.CoilD_1.render(f5);
- this.CoilA.render(f5);
- this.TrimFBB.render(f5);
- this.ConnectorD.render(f5);
- this.ConnectorA_1.render(f5);
- this.TrimLRA.render(f5);
- this.TrimLRD.render(f5);
- this.CoilB_1.render(f5);
- this.CoilC_1.render(f5);
- this.TrimTDD.render(f5);
- this.ConnectorC.render(f5);
- this.TrimLRB.render(f5);
- this.ConnectorC_1.render(f5);
- this.Top.render(f5);
- this.ConnectorB_1.render(f5);
- this.TrimTDB.render(f5);
- this.ConnectorB.render(f5);
- this.TrimLRC.render(f5);
- this.CoilA_1.render(f5);
- this.ConnectorD_1.render(f5);
- this.TrimFBD.render(f5);
- }
- public void renderFloor(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
- GL11.glPushMatrix();
- GL11.glTranslatef(this.JarInside.offsetX, this.JarInside.offsetY, this.JarInside.offsetZ);
- GL11.glTranslatef(this.JarInside.rotationPointX * f5, this.JarInside.rotationPointY * f5, this.JarInside.rotationPointZ * f5);
- GL11.glScaled(1.07D, 1.0D, 1.07D);
- GL11.glTranslatef(-this.JarInside.offsetX, -this.JarInside.offsetY, -this.JarInside.offsetZ);
- GL11.glTranslatef(-this.JarInside.rotationPointX * f5, -this.JarInside.rotationPointY * f5, -this.JarInside.rotationPointZ * f5);
- this.JarInside.render(f5);
- GL11.glPopMatrix();
- }
- public void renderGlass(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
- GL11.glPushMatrix();
- GL11.glTranslatef(this.Jar.offsetX, this.Jar.offsetY, this.Jar.offsetZ);
- GL11.glTranslatef(this.Jar.rotationPointX * f5, this.Jar.rotationPointY * f5, this.Jar.rotationPointZ * f5);
- GL11.glScaled(1.07D, 1.04D, 1.07D);
- GL11.glTranslatef(-this.Jar.offsetX, -this.Jar.offsetY, -this.Jar.offsetZ);
- GL11.glTranslatef(-this.Jar.rotationPointX * f5, -this.Jar.rotationPointY * f5, -this.Jar.rotationPointZ * f5);
- this.Jar.render(f5);
- GL11.glPopMatrix();
- }
- /**
- * This is a helper function from Tabula to set the rotation of model parts
- */
- public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
- modelRenderer.rotateAngleX = x;
- modelRenderer.rotateAngleY = y;
- modelRenderer.rotateAngleZ = z;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement