Added new pipe texture, model messed up

This commit is contained in:
Calclavia 2014-02-16 22:57:41 +08:00
parent 1cbfa10eea
commit 327c78d0a6
15 changed files with 189 additions and 263 deletions

View file

@ -1,13 +1,11 @@
// Date: 9/20/2012 12:00:21 AM
// Template version 1.1
// Java generated by Techne
// Keep in mind that you still need to fill in some blanks
// - ZeuX
package resonantinduction.mechanical.fluid.pipe; package resonantinduction.mechanical.fluid.pipe;
import org.lwjgl.opengl.GL11;
import calclavia.lib.render.RenderUtility;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.common.ForgeDirection;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -15,233 +13,186 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ModelPipe extends ModelBase public class ModelPipe extends ModelBase
{ {
// fields // fields
ModelRenderer Mid; ModelRenderer Body;
ModelRenderer RightPipe; ModelRenderer Deco1;
ModelRenderer RightInter; ModelRenderer Deco4;
ModelRenderer RightConnect; ModelRenderer Deco2;
ModelRenderer LeftInter; ModelRenderer Deco3;
ModelRenderer LeftPipe; ModelRenderer Deco5;
ModelRenderer LeftConnect; ModelRenderer Deco6;
ModelRenderer TopInter; ModelRenderer Deco7;
ModelRenderer TopPipe; ModelRenderer Deco8;
ModelRenderer TopConnect; ModelRenderer Deco9;
ModelRenderer BottomPipe; ModelRenderer Body2;
ModelRenderer BottomInter; ModelRenderer Deco11;
ModelRenderer BottomConnect; ModelRenderer Deco12;
ModelRenderer BackPipe; ModelRenderer Deco13;
ModelRenderer BackInter; ModelRenderer Deco14;
ModelRenderer BackConnect; ModelRenderer Deco15;
ModelRenderer FrontInter; ModelRenderer Deco16;
ModelRenderer FrontPipe;
ModelRenderer FrontConnect;
public ModelPipe() public ModelPipe()
{ {
textureWidth = 128; textureWidth = 64;
textureHeight = 32; textureHeight = 32;
Mid = new ModelRenderer(this, 50, 13); Body = new ModelRenderer(this, 0, 0);
Mid.addBox(-3F, -3F, -3F, 6, 6, 6); Body.addBox(0F, 0F, 0F, 5, 5, 16);
Mid.setRotationPoint(0F, 16F, 0F); Body.setRotationPoint(-2F, 17F, -8F);
Mid.setTextureSize(128, 32); Body.setTextureSize(64, 32);
Mid.mirror = true; Body.mirror = true;
setRotation(Mid, 0F, 0F, 0F); setRotation(Body, 0F, 0F, 0F);
RightPipe = new ModelRenderer(this, 25, 0); Deco1 = new ModelRenderer(this, 42, 0);
RightPipe.addBox(0F, -3F, -3F, 4, 6, 6); Deco1.addBox(0F, 0F, 0F, 5, 1, 1);
RightPipe.setRotationPoint(3F, 16F, 0F); Deco1.setRotationPoint(-2F, 16.5F, 0F);
RightPipe.setTextureSize(128, 32); Deco1.setTextureSize(64, 32);
RightPipe.mirror = true; Deco1.mirror = true;
setRotation(RightPipe, 0F, 0F, 0F); setRotation(Deco1, 0F, 0F, 0F);
RightInter = new ModelRenderer(this, 98, 0); Deco4 = new ModelRenderer(this, 42, 0);
RightInter.addBox(0F, -4F, -4F, 1, 8, 8); Deco4.addBox(0F, 0F, 0F, 5, 1, 1);
RightInter.setRotationPoint(2F, 16F, 0F); Deco4.setRotationPoint(-2F, 21.5F, 4F);
RightInter.setTextureSize(128, 32); Deco4.setTextureSize(64, 32);
RightInter.mirror = true; Deco4.mirror = true;
setRotation(RightInter, 0F, 0F, 0F); setRotation(Deco4, 0F, 0F, 0F);
RightConnect = new ModelRenderer(this, 98, 0); Deco2 = new ModelRenderer(this, 42, 2);
RightConnect.addBox(0F, -4F, -4F, 1, 8, 8); Deco2.addBox(0F, 0F, 0F, 6, 1, 1);
RightConnect.setRotationPoint(7F, 16F, 0F); Deco2.setRotationPoint(-1.5F, 16.5F, 4F);
RightConnect.setTextureSize(128, 32); Deco2.setTextureSize(64, 32);
RightConnect.mirror = true; Deco2.mirror = true;
setRotation(RightConnect, 0F, 0F, 0F); setRotation(Deco2, 0F, 0F, 1.570796F);
LeftInter = new ModelRenderer(this, 98, 0); Deco3 = new ModelRenderer(this, 42, 2);
LeftInter.addBox(-1F, -4F, -4F, 1, 8, 8); Deco3.addBox(0F, 0F, 0F, 6, 1, 1);
LeftInter.setRotationPoint(-2F, 16F, 0F); Deco3.setRotationPoint(3.5F, 16.5F, 4F);
LeftInter.setTextureSize(128, 32); Deco3.setTextureSize(64, 32);
LeftInter.mirror = true; Deco3.mirror = true;
setRotation(LeftInter, 0F, 0F, 0F); setRotation(Deco3, 0F, 0F, 1.570796F);
LeftPipe = new ModelRenderer(this, 25, 0); Deco5 = new ModelRenderer(this, 42, 0);
LeftPipe.addBox(-4F, -3F, -3F, 4, 6, 6); Deco5.addBox(0F, 0F, 0F, 5, 1, 1);
LeftPipe.setRotationPoint(-3F, 16F, 0F); Deco5.setRotationPoint(-2F, 16.5F, 4F);
LeftPipe.setTextureSize(128, 32); Deco5.setTextureSize(64, 32);
LeftPipe.mirror = true; Deco5.mirror = true;
setRotation(LeftPipe, 0F, 0F, 0F); setRotation(Deco5, 0F, 0F, 0F);
LeftConnect = new ModelRenderer(this, 98, 0); Deco6 = new ModelRenderer(this, 42, 0);
LeftConnect.addBox(-1F, -4F, -4F, 1, 8, 8); Deco6.addBox(0F, 0F, 0F, 5, 1, 1);
LeftConnect.setRotationPoint(-7F, 16F, 0F); Deco6.setRotationPoint(-2F, 21.5F, 0F);
LeftConnect.setTextureSize(128, 32); Deco6.setTextureSize(64, 32);
LeftConnect.mirror = true; Deco6.mirror = true;
setRotation(LeftConnect, 0F, 0F, 0F); setRotation(Deco6, 0F, 0F, 0F);
TopInter = new ModelRenderer(this, 77, 17); Deco7 = new ModelRenderer(this, 42, 2);
TopInter.addBox(-4F, -1F, -4F, 8, 1, 8); Deco7.addBox(0F, 0F, -5F, 6, 1, 1);
TopInter.setRotationPoint(0F, 14F, 0F); Deco7.setRotationPoint(-1.5F, 16.5F, 5F);
TopInter.setTextureSize(128, 32); Deco7.setTextureSize(64, 32);
TopInter.mirror = true; Deco7.mirror = true;
setRotation(TopInter, 0F, 0F, 0F); setRotation(Deco7, 0F, 0F, 1.570796F);
TopPipe = new ModelRenderer(this, 50, 0); Deco8 = new ModelRenderer(this, 42, 2);
TopPipe.addBox(-3F, -4F, -3F, 6, 4, 6); Deco8.addBox(0F, 0F, 0F, 6, 1, 1);
TopPipe.setRotationPoint(0F, 13F, 0F); Deco8.setRotationPoint(3.5F, 16.5F, 0F);
TopPipe.setTextureSize(128, 32); Deco8.setTextureSize(64, 32);
TopPipe.mirror = true; Deco8.mirror = true;
setRotation(TopPipe, 0F, 0F, 0F); setRotation(Deco8, 0F, 0F, 1.570796F);
TopConnect = new ModelRenderer(this, 77, 17); Deco9 = new ModelRenderer(this, 42, 0);
TopConnect.addBox(-4F, -1F, -4F, 8, 1, 8); Deco9.addBox(0F, 0F, 0F, 5, 1, 1);
TopConnect.setRotationPoint(0F, 9F, 0F); Deco9.setRotationPoint(-2F, 16.5F, -4F);
TopConnect.setTextureSize(128, 32); Deco9.setTextureSize(64, 32);
TopConnect.mirror = true; Deco9.mirror = true;
setRotation(TopConnect, 0F, 0F, 0F); setRotation(Deco9, 0F, 0F, 0F);
BottomPipe = new ModelRenderer(this, 50, 0); Body2 = new ModelRenderer(this, 42, 0);
BottomPipe.addBox(-3F, 0F, -3F, 6, 4, 6); Body2.addBox(0F, 0F, 0F, 5, 1, 1);
BottomPipe.setRotationPoint(0F, 19F, 0F); Body2.setRotationPoint(-2F, 21.5F, -4F);
BottomPipe.setTextureSize(128, 32); Body2.setTextureSize(64, 32);
BottomPipe.mirror = true; Body2.mirror = true;
setRotation(BottomPipe, 0F, 0F, 0F); setRotation(Body2, 0F, 0F, 0F);
BottomInter = new ModelRenderer(this, 77, 17); Deco11 = new ModelRenderer(this, 42, 2);
BottomInter.addBox(-4F, 0F, -4F, 8, 1, 8); Deco11.addBox(0F, 0F, -5F, 6, 1, 1);
BottomInter.setRotationPoint(0F, 18F, 0F); Deco11.setRotationPoint(-1.5F, 16.5F, 1F);
BottomInter.setTextureSize(128, 32); Deco11.setTextureSize(64, 32);
BottomInter.mirror = true; Deco11.mirror = true;
setRotation(BottomInter, 0F, 0F, 0F); setRotation(Deco11, 0F, 0F, 1.570796F);
BottomConnect = new ModelRenderer(this, 77, 17); Deco12 = new ModelRenderer(this, 42, 2);
BottomConnect.addBox(-4F, 0F, -4F, 8, 1, 8); Deco12.addBox(0F, 0F, 0F, 6, 1, 1);
BottomConnect.setRotationPoint(0F, 23F, 0F); Deco12.setRotationPoint(3.5F, 16.5F, -4F);
BottomConnect.setTextureSize(128, 32); Deco12.setTextureSize(64, 32);
BottomConnect.mirror = true; Deco12.mirror = true;
setRotation(BottomConnect, 0F, 0F, 0F); setRotation(Deco12, 0F, 0F, 1.570796F);
BackPipe = new ModelRenderer(this, 0, 0); Deco13 = new ModelRenderer(this, 42, 0);
BackPipe.addBox(-3F, -3F, 0F, 6, 6, 4); Deco13.addBox(0F, 0F, 0F, 5, 1, 1);
BackPipe.setRotationPoint(0F, 16F, 3F); Deco13.setRotationPoint(-2F, 16.5F, -8F);
BackPipe.setTextureSize(128, 32); Deco13.setTextureSize(64, 32);
BackPipe.mirror = true; Deco13.mirror = true;
setRotation(BackPipe, 0F, 0F, 0F); setRotation(Deco13, 0F, 0F, 0F);
BackInter = new ModelRenderer(this, 0, 23); Deco14 = new ModelRenderer(this, 42, 0);
BackInter.addBox(-4F, -4F, 0F, 8, 8, 1); Deco14.addBox(0F, 0F, 0F, 5, 1, 1);
BackInter.setRotationPoint(0F, 16F, 2F); Deco14.setRotationPoint(-2F, 21.5F, -8F);
BackInter.setTextureSize(128, 32); Deco14.setTextureSize(64, 32);
BackInter.mirror = true; Deco14.mirror = true;
setRotation(BackInter, 0F, 0F, 0F); setRotation(Deco14, 0F, 0F, 0F);
BackConnect = new ModelRenderer(this, 0, 23); Deco15 = new ModelRenderer(this, 42, 2);
BackConnect.addBox(-4F, -4F, 0F, 8, 8, 1); Deco15.addBox(0F, 0F, -5F, 6, 1, 1);
BackConnect.setRotationPoint(0F, 16F, 7F); Deco15.setRotationPoint(-1.5F, 16.5F, -3F);
BackConnect.setTextureSize(128, 32); Deco15.setTextureSize(64, 32);
BackConnect.mirror = true; Deco15.mirror = true;
setRotation(BackConnect, 0F, 0F, 0F); setRotation(Deco15, 0F, 0F, 1.570796F);
FrontInter = new ModelRenderer(this, 0, 23); Deco16 = new ModelRenderer(this, 42, 2);
FrontInter.addBox(-4F, -4F, -1F, 8, 8, 1); Deco16.addBox(0F, 0F, -4F, 6, 1, 1);
FrontInter.setRotationPoint(0F, 16F, -2F); Deco16.setRotationPoint(3.5F, 16.5F, -4F);
FrontInter.setTextureSize(128, 32); Deco16.setTextureSize(64, 32);
FrontInter.mirror = true; Deco16.mirror = true;
setRotation(FrontInter, 0F, 0F, 0F); setRotation(Deco16, 0F, 0F, 1.570796F);
FrontPipe = new ModelRenderer(this, 0, 0);
FrontPipe.addBox(-3F, -3F, -4F, 6, 6, 4);
FrontPipe.setRotationPoint(0F, 16F, -3F);
FrontPipe.setTextureSize(128, 32);
FrontPipe.mirror = true;
setRotation(FrontPipe, 0F, 0F, 0F);
FrontConnect = new ModelRenderer(this, 0, 23);
FrontConnect.addBox(-4F, -4F, -1F, 8, 8, 1);
FrontConnect.setRotationPoint(0F, 16F, -7F);
FrontConnect.setTextureSize(128, 32);
FrontConnect.mirror = true;
setRotation(FrontConnect, 0F, 0F, 0F);
} }
public void render(boolean[] side) public void render(float f5)
{ {
if (side[0]) Body.render(f5);
Deco1.render(f5);
Deco4.render(f5);
Deco2.render(f5);
Deco3.render(f5);
Deco5.render(f5);
Deco6.render(f5);
Deco7.render(f5);
Deco8.render(f5);
Deco9.render(f5);
Body2.render(f5);
Deco11.render(f5);
Deco12.render(f5);
Deco13.render(f5);
Deco14.render(f5);
Deco15.render(f5);
Deco16.render(f5);
}
public void render(byte side)
{
float f5 = 0.0625f;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
{ {
renderBottom(); if (RenderUtility.canRenderSide(side, dir))
{
GL11.glPushMatrix();
RenderUtility.rotateBlockBasedOnDirection(dir);
Deco1.render(f5);
Deco4.render(f5);
Deco2.render(f5);
Deco3.render(f5);
Deco5.render(f5);
Deco6.render(f5);
Deco7.render(f5);
Deco8.render(f5);
Deco9.render(f5);
Deco11.render(f5);
Deco12.render(f5);
Deco13.render(f5);
Deco14.render(f5);
Deco15.render(f5);
Deco16.render(f5);
GL11.glPopMatrix();
}
} }
if (side[1])
{
renderTop();
}
if (side[3])
{
renderFront();
}
if (side[2])
{
renderBack();
}
if (side[5])
{
renderRight();
}
if (side[4])
{
renderLeft();
}
renderMiddle();
}
public void renderAll() Body.render(f5);
{ Body2.render(f5);
this.renderMiddle();
this.renderBottom();
this.renderTop();
this.renderLeft();
this.renderRight();
this.renderBack();
this.renderFront();
}
public void renderMiddle()
{
Mid.render(0.0625F);
}
public void renderBottom()
{
BottomPipe.render(0.0625F);
BottomConnect.render(0.0625F);
BottomInter.render(0.0625F);
}
public void renderTop()
{
TopPipe.render(0.0625F);
TopConnect.render(0.0625F);
TopInter.render(0.0625F);
}
public void renderLeft()
{
LeftPipe.render(0.0625F);
LeftConnect.render(0.0625F);
LeftInter.render(0.0625F);
}
public void renderRight()
{
RightPipe.render(0.0625F);
RightConnect.render(0.0625F);
RightInter.render(0.0625F);
}
public void renderBack()
{
BackPipe.render(0.0625F);
BackConnect.render(0.0625F);
BackInter.render(0.0625F);
}
public void renderFront()
{
FrontPipe.render(0.0625F);
FrontConnect.render(0.0625F);
FrontInter.render(0.0625F);
} }
private void setRotation(ModelRenderer model, float x, float y, float z) private void setRotation(ModelRenderer model, float x, float y, float z)

View file

@ -21,7 +21,7 @@ public class RenderPipe
public static ModelPipe MODEL_PIPE = new ModelPipe(); public static ModelPipe MODEL_PIPE = new ModelPipe();
public static ModelOpenTrough MODEL_TROUGH_PIPE = new ModelOpenTrough(); public static ModelOpenTrough MODEL_TROUGH_PIPE = new ModelOpenTrough();
private static HashMap<EnumPipeMaterial, ResourceLocation> TEXTURES = new HashMap<EnumPipeMaterial, ResourceLocation>(); private static HashMap<EnumPipeMaterial, ResourceLocation> TEXTURES = new HashMap<EnumPipeMaterial, ResourceLocation>();
public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe/iron.png"); public static ResourceLocation TEXTURE = new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe.png");
public void render(PartPipe part, double x, double y, double z, float f) public void render(PartPipe part, double x, double y, double z, float f)
{ {
@ -30,60 +30,35 @@ public class RenderPipe
GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F); GL11.glScalef(1.0F, -1F, -1F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture(getTexture(material)); FMLClientHandler.instance().getClient().renderEngine.bindTexture(getTexture(material));
render(material, part.getAllCurrentConnections()); MODEL_PIPE.render(part.getAllCurrentConnections());
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
public static ResourceLocation getTexture(EnumPipeMaterial material) public static ResourceLocation getTexture(EnumPipeMaterial material)
{ {
if (material != null) /*
{ * if (material != null)
if (!TEXTURES.containsKey(material)) * {
{ * if (!TEXTURES.containsKey(material))
TEXTURES.put(material, new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH + "pipe/" + material.matName + ".png")); * {
} * TEXTURES.put(material, new ResourceLocation(Reference.DOMAIN, Reference.MODEL_PATH +
* "pipe/" + material.matName + ".png"));
* }
* return TEXTURES.get(material);
* }
*/
return TEXTURES.get(material);
}
return TEXTURE; return TEXTURE;
} }
public static void render(EnumPipeMaterial mat, byte side)
{
if (RenderUtility.canRenderSide(side, ForgeDirection.DOWN))
{
MODEL_PIPE.renderBottom();
}
if (RenderUtility.canRenderSide(side, ForgeDirection.UP))
{
MODEL_PIPE.renderTop();
}
if (RenderUtility.canRenderSide(side, ForgeDirection.NORTH))
{
MODEL_PIPE.renderBack();
}
if (RenderUtility.canRenderSide(side, ForgeDirection.SOUTH))
{
MODEL_PIPE.renderFront();
}
if (RenderUtility.canRenderSide(side, ForgeDirection.WEST))
{
MODEL_PIPE.renderLeft();
}
if (RenderUtility.canRenderSide(side, ForgeDirection.EAST))
{
MODEL_PIPE.renderRight();
}
MODEL_PIPE.renderMiddle();
}
public static void render(int meta, byte sides) public static void render(int meta, byte sides)
{ {
if (meta < EnumPipeMaterial.values().length) if (meta < EnumPipeMaterial.values().length)
{ {
RenderUtility.enableBlending();
FMLClientHandler.instance().getClient().renderEngine.bindTexture(getTexture(EnumPipeMaterial.values()[meta])); FMLClientHandler.instance().getClient().renderEngine.bindTexture(getTexture(EnumPipeMaterial.values()[meta]));
render(EnumPipeMaterial.values()[meta], sides); MODEL_PIPE.render(sides);
RenderUtility.disableBlending();
} }
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 828 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2 KiB