Merge pull request #182 from unpairedbracket/transmitter-render

Transmitter rendering improvements
This commit is contained in:
Aidan 2013-07-08 09:04:02 -07:00
commit 6fc93bb0fd
9 changed files with 171 additions and 120 deletions

View file

@ -10,61 +10,96 @@ import net.minecraftforge.common.ForgeDirection;
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public class ModelTransmitter extends ModelBase public class ModelTransmitter extends ModelBase
{ {
ModelRenderer Center; ModelRenderer UpOn;
ModelRenderer Up; ModelRenderer DownOn;
ModelRenderer Down; ModelRenderer FrontOn;
ModelRenderer Front; ModelRenderer BackOn;
ModelRenderer Back; ModelRenderer LeftOn;
ModelRenderer Left; ModelRenderer RightOn;
ModelRenderer Right; ModelRenderer UpOff;
ModelRenderer DownOff;
ModelRenderer FrontOff;
ModelRenderer BackOff;
ModelRenderer LeftOff;
ModelRenderer RightOff;
public ModelTransmitter() public ModelTransmitter()
{ {
textureWidth = 64; textureWidth = 64;
textureHeight = 64; textureHeight = 64;
Center = new ModelRenderer(this, 0, 0); UpOn = new ModelRenderer(this, 0, 13);
Center.addBox(0F, 0F, 0F, 6, 6, 6); UpOn.addBox(0F, 0F, 0F, 6, 5, 6);
Center.setRotationPoint(-3F, 13F, -3F); UpOn.setRotationPoint(-3F, 8F, -3F);
Center.setTextureSize(64, 64); UpOn.setTextureSize(64, 64);
Center.mirror = true; UpOn.mirror = true;
setRotation(Center, 0F, 0F, 0F); setRotation(UpOn, 0F, 0F, 0F);
Up = new ModelRenderer(this, 0, 13); DownOn = new ModelRenderer(this, 26, 13);
Up.addBox(0F, 0F, 0F, 6, 5, 6); DownOn.addBox(0F, 0F, 0F, 6, 5, 6);
Up.setRotationPoint(-3F, 8F, -3F); DownOn.setRotationPoint(-3F, 19F, -3F);
Up.setTextureSize(64, 64); DownOn.setTextureSize(64, 64);
Up.mirror = true; DownOn.mirror = true;
setRotation(Up, 0F, 0F, 0F); setRotation(DownOn, 0F, 0F, 0F);
Down = new ModelRenderer(this, 26, 13); FrontOn = new ModelRenderer(this, 0, 26);
Down.addBox(0F, 0F, 0F, 6, 5, 6); FrontOn.addBox(0F, 0F, 0F, 5, 6, 6);
Down.setRotationPoint(-3F, 19F, -3F); FrontOn.setRotationPoint(-3F, 13F, -3F);
Down.setTextureSize(64, 64); FrontOn.setTextureSize(64, 64);
Down.mirror = true; FrontOn.mirror = true;
setRotation(Down, 0F, 0F, 0F); setRotation(FrontOn, 0F, 1.570796F, 0F);
Front = new ModelRenderer(this, 0, 26); BackOn = new ModelRenderer(this, 0, 41);
Front.addBox(0F, 0F, 0F, 5, 6, 6); BackOn.addBox(0F, 0F, 0F, 5, 6, 6);
Front.setRotationPoint(-3F, 13F, -3F); BackOn.setRotationPoint(-3F, 13F, 8F);
Front.setTextureSize(64, 64); BackOn.setTextureSize(64, 64);
Front.mirror = true; BackOn.mirror = true;
setRotation(Front, 0F, 1.570796F, 0F); setRotation(BackOn, 0F, 1.570796F, 0F);
Back = new ModelRenderer(this, 0, 41); LeftOn = new ModelRenderer(this, 26, 0);
Back.addBox(0F, 0F, 0F, 5, 6, 6); LeftOn.addBox(0F, 0F, 0F, 6, 5, 6);
Back.setRotationPoint(-3F, 13F, 8F); LeftOn.setRotationPoint(3F, 19F, 3F);
Back.setTextureSize(64, 64); LeftOn.setTextureSize(64, 64);
Back.mirror = true; LeftOn.mirror = true;
setRotation(Back, 0F, 1.570796F, 0F); setRotation(LeftOn, 1.570796F, 1.570796F, 0F);
Left = new ModelRenderer(this, 26, 0); RightOn = new ModelRenderer(this, 26, 26);
Left.addBox(0F, 0F, 0F, 6, 5, 6); RightOn.addBox(0F, 0F, 0F, 6, 5, 6);
Left.setRotationPoint(3F, 19F, 3F); RightOn.setRotationPoint(-8F, 19F, 3F);
Left.setTextureSize(64, 64); RightOn.setTextureSize(64, 64);
Left.mirror = true; RightOn.mirror = true;
setRotation(Left, 1.570796F, 1.570796F, 0F); setRotation(RightOn, 1.570796F, 1.570796F, 0F);
Right = new ModelRenderer(this, 26, 26); UpOff = new ModelRenderer(this, 0, 0);
Right.addBox(0F, 0F, 0F, 6, 5, 6); UpOff.addBox(0F, 0F, 0F, 6, 0, 6);
Right.setRotationPoint(-8F, 19F, 3F); UpOff.setRotationPoint(-3F, 13F, -3F);
Right.setTextureSize(64, 64); UpOff.setTextureSize(64, 64);
Right.mirror = true; UpOff.mirror = true;
setRotation(Right, 1.570796F, 1.570796F, 0F); setRotation(UpOff, 0F, 0F, 0F);
DownOff = new ModelRenderer(this, 0, 0);
DownOff.addBox(0F, 0F, 0F, 6, 0, 6);
DownOff.setRotationPoint(-3F, 19F, -3F);
DownOff.setTextureSize(64, 64);
DownOff.mirror = true;
setRotation(DownOff, 0F, 0F, 0F);
FrontOff = new ModelRenderer(this, 0, 0);
FrontOff.addBox(0F, 0F, 0F, 0, 6, 6);
FrontOff.setRotationPoint(-3F, 13F, -3F);
FrontOff.setTextureSize(64, 64);
FrontOff.mirror = true;
setRotation(FrontOff, 0F, 1.570796F, 0F);
BackOff = new ModelRenderer(this, 0, 0);
BackOff.addBox(0F, 0F, 0F, 0, 6, 6);
BackOff.setRotationPoint(-3F, 13F, 3F);
BackOff.setTextureSize(64, 64);
BackOff.mirror = true;
setRotation(BackOff, 0F, 1.570796F, 0F);
LeftOff = new ModelRenderer(this, 0, 0);
LeftOff.addBox(0F, 0F, 0F, 6, 0, 6);
LeftOff.setRotationPoint(3F, 19F, 3F);
LeftOff.setTextureSize(64, 64);
LeftOff.mirror = true;
setRotation(LeftOff, 1.570796F, 1.570796F, 0F);
RightOff = new ModelRenderer(this, 0, 0);
RightOff.addBox(0F, 0F, 0F, 6, 0, 6);
RightOff.setRotationPoint(-3F, 19F, 3F);
RightOff.setTextureSize(64, 64);
RightOff.mirror = true;
setRotation(RightOff, 1.570796F, 1.570796F, 0F);
} }
@Override @Override
@ -73,39 +108,65 @@ public class ModelTransmitter extends ModelBase
super.render(entity, f, f1, f2, f3, f4, f5); super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity); setRotationAngles(f, f1, f2, f3, f4, f5, entity);
Center.render(0.0625F);
for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS) for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
{ {
renderSide(orientation); renderSide(orientation, true);
} }
} }
public void renderSide(ForgeDirection orientation) public void renderSide(ForgeDirection orientation, boolean on)
{
if(on)
{ {
switch (orientation) switch (orientation)
{ {
case DOWN: case DOWN:
Down.render(0.0625F); DownOn.render(0.0625F);
break; break;
case UP: case UP:
Up.render(0.0625F); UpOn.render(0.0625F);
break; break;
case NORTH: case NORTH:
Back.render(0.0625F); BackOn.render(0.0625F);
break; break;
case SOUTH: case SOUTH:
Front.render(0.0625F); FrontOn.render(0.0625F);
break; break;
case WEST: case WEST:
Right.render(0.0625F); RightOn.render(0.0625F);
break; break;
case EAST: case EAST:
Left.render(0.0625F); LeftOn.render(0.0625F);
break; break;
default: default:
return; return;
} }
} else
{
switch (orientation)
{
case DOWN:
DownOff.render(0.0625F);
break;
case UP:
UpOff.render(0.0625F);
break;
case NORTH:
BackOff.render(0.0625F);
break;
case SOUTH:
FrontOff.render(0.0625F);
break;
case WEST:
RightOff.render(0.0625F);
break;
case EAST:
LeftOff.render(0.0625F);
break;
default:
return;
}
}
} }
private void setRotation(ModelRenderer model, float x, float y, float z) private void setRotation(ModelRenderer model, float x, float y, float z)

View file

@ -45,13 +45,9 @@ public class RenderMechanicalPipe extends TileEntitySpecialRenderer
for(int i = 0; i < 6; i++) for(int i = 0; i < 6; i++)
{ {
if(connectable[i]) model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
{
model.renderSide(ForgeDirection.getOrientation(i));
}
} }
model.Center.render(0.0625F);
GL11.glPopMatrix(); GL11.glPopMatrix();
if(tileEntity.liquidScale > 0 && tileEntity.refLiquid != null) if(tileEntity.liquidScale > 0 && tileEntity.refLiquid != null)

View file

@ -65,8 +65,6 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
if(tileEntity.canTransferGas()) if(tileEntity.canTransferGas())
{ {
for(int i = 0; i < 6; i++) for(int i = 0; i < 6; i++)
{
if(connectable[i])
{ {
TileEntity sideTile = Object3D.get(tileEntity).getFromSide(ForgeDirection.getOrientation(i)).getTileEntity(tileEntity.worldObj); TileEntity sideTile = Object3D.get(tileEntity).getFromSide(ForgeDirection.getOrientation(i)).getTileEntity(tileEntity.worldObj);
@ -94,18 +92,16 @@ public class RenderPressurizedTube extends TileEntitySpecialRenderer
break; break;
} }
model.renderSide(ForgeDirection.getOrientation(i)); model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }
else { else {
model.renderSide(ForgeDirection.getOrientation(i)); model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
}
} }
} }
} }
model.Center.render(0.0625F);
GL11.glPopMatrix(); GL11.glPopMatrix();
if(tileEntity.gasScale > 0 && tileEntity.refGas != null && tileEntity.refGas.hasTexture()) if(tileEntity.gasScale > 0 && tileEntity.refGas != null && tileEntity.refGas.hasTexture())

View file

@ -42,13 +42,8 @@ public class RenderUniversalCable extends TileEntitySpecialRenderer
for(int i = 0; i < 6; i++) for(int i = 0; i < 6; i++)
{ {
if(connectable[i]) model.renderSide(ForgeDirection.getOrientation(i), connectable[i]);
{
model.renderSide(ForgeDirection.getOrientation(i));
} }
}
model.Center.render(0.0625F);
GL11.glPopMatrix(); GL11.glPopMatrix();

View file

@ -36,9 +36,12 @@ public class TransmitterRenderer implements ISimpleBlockRenderingHandler
break; break;
} }
transmitter.Center.render(0.0625F); transmitter.UpOn.render(0.0625F);
transmitter.Up.render(0.0625F); transmitter.DownOn.render(0.0625F);
transmitter.Down.render(0.0625F); transmitter.BackOff.render(0.0625F);
transmitter.FrontOff.render(0.0625F);
transmitter.LeftOff.render(0.0625F);
transmitter.RightOff.render(0.0625F);
} }
@Override @Override

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 11 KiB