2013-02-22 04:03:54 +01:00
|
|
|
package mekanism.client;
|
|
|
|
|
|
|
|
import net.minecraft.client.model.ModelBase;
|
|
|
|
import net.minecraft.client.model.ModelRenderer;
|
|
|
|
import net.minecraft.entity.Entity;
|
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
2013-07-08 18:41:31 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2013-02-22 04:03:54 +01:00
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2013-04-13 02:25:21 +02:00
|
|
|
public class ModelTransmitter extends ModelBase
|
|
|
|
{
|
2013-08-01 00:22:48 +02:00
|
|
|
public boolean[][] disabledFaces = {
|
|
|
|
{true, true, false, false, false, false},
|
|
|
|
{true, true, false, false, false, false},
|
|
|
|
{false, false, false, false, true, true},
|
|
|
|
{false, false, false, false, true, true},
|
|
|
|
{true, true, false, false, false, false},
|
|
|
|
{true, true, false, false, false, false},
|
|
|
|
};
|
2013-08-01 05:54:08 +02:00
|
|
|
|
2013-08-01 00:22:48 +02:00
|
|
|
ModelRendererSelectiveFace Center;
|
|
|
|
ModelRendererSelectiveFace Up;
|
|
|
|
ModelRendererSelectiveFace Down;
|
|
|
|
ModelRendererSelectiveFace Front;
|
|
|
|
ModelRendererSelectiveFace Back;
|
|
|
|
ModelRendererSelectiveFace Left;
|
|
|
|
ModelRendererSelectiveFace Right;
|
2013-02-22 04:03:54 +01:00
|
|
|
|
2013-03-25 17:00:45 +01:00
|
|
|
public ModelTransmitter()
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
|
|
|
textureWidth = 64;
|
|
|
|
textureHeight = 64;
|
2013-08-01 00:22:48 +02:00
|
|
|
|
|
|
|
Center = new ModelRendererSelectiveFace(this, 0, 0);
|
|
|
|
Center.addBox(0F, 0F, 0F, 6, 6, 6);
|
|
|
|
Center.setRotationPoint(-3F, 13F, -3F);
|
|
|
|
Center.setTextureSize(64, 64);
|
|
|
|
Center.mirror = true;
|
|
|
|
setRotation(Center, 0F, 0F, 0F);
|
|
|
|
Up = new ModelRendererSelectiveFace(this, 0, 13);
|
|
|
|
Up.addBox(0F, 0F, 0F, 6, 5, 6);
|
|
|
|
Up.setRotationPoint(-3F, 8F, -3F);
|
|
|
|
Up.setTextureSize(64, 64);
|
|
|
|
Up.mirror = true;
|
|
|
|
setRotation(Up, 0F, 0F, 0F);
|
|
|
|
Down = new ModelRendererSelectiveFace(this, 26, 13);
|
|
|
|
Down.addBox(0F, 0F, 0F, 6, 5, 6);
|
|
|
|
Down.setRotationPoint(-3F, 19F, -3F);
|
|
|
|
Down.setTextureSize(64, 64);
|
|
|
|
Down.mirror = true;
|
|
|
|
setRotation(Down, 0F, 0F, 0F);
|
|
|
|
Front = new ModelRendererSelectiveFace(this, 0, 26);
|
|
|
|
Front.addBox(0F, 0F, 0F, 5, 6, 6);
|
|
|
|
Front.setRotationPoint(-3F, 13F, -3F);
|
|
|
|
Front.setTextureSize(64, 64);
|
|
|
|
Front.mirror = true;
|
|
|
|
setRotation(Front, 0F, 1.570796F, 0F);
|
|
|
|
Back = new ModelRendererSelectiveFace(this, 0, 41);
|
|
|
|
Back.addBox(0F, 0F, 0F, 5, 6, 6);
|
|
|
|
Back.setRotationPoint(-3F, 13F, 8F);
|
|
|
|
Back.setTextureSize(64, 64);
|
|
|
|
Back.mirror = true;
|
|
|
|
setRotation(Back, 0F, 1.570796F, 0F);
|
|
|
|
Left = new ModelRendererSelectiveFace(this, 26, 0);
|
|
|
|
Left.addBox(0F, 0F, 0F, 6, 5, 6);
|
|
|
|
Left.setRotationPoint(3F, 19F, 3F);
|
|
|
|
Left.setTextureSize(64, 64);
|
|
|
|
Left.mirror = true;
|
|
|
|
setRotation(Left, 1.570796F, 1.570796F, 0F);
|
|
|
|
Right = new ModelRendererSelectiveFace(this, 26, 26);
|
|
|
|
Right.addBox(0F, 0F, 0F, 6, 5, 6);
|
|
|
|
Right.setRotationPoint(-8F, 19F, 3F);
|
|
|
|
Right.setTextureSize(64, 64);
|
|
|
|
Right.mirror = true;
|
|
|
|
setRotation(Right, 1.570796F, 1.570796F, 0F);
|
2013-02-22 04:03:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
|
|
|
{
|
|
|
|
super.render(entity, f, f1, f2, f3, f4, f5);
|
|
|
|
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
|
|
|
|
2013-06-27 17:03:50 +02:00
|
|
|
for(ForgeDirection orientation : ForgeDirection.VALID_DIRECTIONS)
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
2013-07-08 18:41:31 +02:00
|
|
|
renderSide(orientation, true);
|
2013-02-22 04:03:54 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-08 18:41:31 +02:00
|
|
|
public void renderSide(ForgeDirection orientation, boolean on)
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
2013-07-08 18:41:31 +02:00
|
|
|
if(on)
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
2013-07-08 18:41:31 +02:00
|
|
|
switch(orientation)
|
|
|
|
{
|
|
|
|
case DOWN:
|
2013-08-01 00:22:48 +02:00
|
|
|
Down.render(disabledFaces[orientation.ordinal()], 0.0625F);
|
2013-07-08 18:41:31 +02:00
|
|
|
break;
|
|
|
|
case UP:
|
2013-08-01 00:22:48 +02:00
|
|
|
Up.render(disabledFaces[orientation.ordinal()], 0.0625F);
|
2013-07-08 18:41:31 +02:00
|
|
|
break;
|
|
|
|
case NORTH:
|
2013-08-01 00:22:48 +02:00
|
|
|
Back.render(disabledFaces[orientation.ordinal()], 0.0625F);
|
2013-07-08 18:41:31 +02:00
|
|
|
break;
|
|
|
|
case SOUTH:
|
2013-08-01 00:22:48 +02:00
|
|
|
Front.render(disabledFaces[orientation.ordinal()], 0.0625F);
|
2013-07-08 18:41:31 +02:00
|
|
|
break;
|
|
|
|
case WEST:
|
2013-08-01 00:22:48 +02:00
|
|
|
Right.render(disabledFaces[orientation.ordinal()], 0.0625F);
|
2013-07-08 18:41:31 +02:00
|
|
|
break;
|
|
|
|
case EAST:
|
2013-08-01 00:22:48 +02:00
|
|
|
Left.render(disabledFaces[orientation.ordinal()], 0.0625F);
|
2013-07-08 18:41:31 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2013-08-01 00:22:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public void renderCenter(boolean[] connectable)
|
|
|
|
{
|
|
|
|
Center.render(connectable, 0.0625F);
|
2013-02-22 04:03:54 +01:00
|
|
|
}
|
|
|
|
|
2013-08-01 00:22:48 +02:00
|
|
|
private void setRotation(ModelRendererSelectiveFace model, float x, float y, float z)
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
|
|
|
model.rotateAngleX = x;
|
|
|
|
model.rotateAngleY = y;
|
|
|
|
model.rotateAngleZ = z;
|
|
|
|
}
|
2013-07-08 18:41:31 +02:00
|
|
|
}
|