Seismic Vibrator model

This commit is contained in:
Aidan C. Brady 2014-06-16 01:50:40 +02:00
parent 2663be0f5a
commit 75f09adba2
10 changed files with 231 additions and 6 deletions

View file

@ -73,6 +73,7 @@ import mekanism.client.render.tileentity.RenderMetallurgicInfuser;
import mekanism.client.render.tileentity.RenderObsidianTNT;
import mekanism.client.render.tileentity.RenderRotaryCondensentrator;
import mekanism.client.render.tileentity.RenderSalinationController;
import mekanism.client.render.tileentity.RenderSeismicVibrator;
import mekanism.client.render.tileentity.RenderTeleporter;
import mekanism.client.sound.Sound;
import mekanism.client.sound.SoundHandler;
@ -314,6 +315,7 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerTileEntity(TileEntityChemicalDissolutionChamber.class, "ChemicalDissolutionChamber", new RenderChemicalDissolutionChamber());
ClientRegistry.registerTileEntity(TileEntityChemicalWasher.class, "ChemicalWasher", new RenderChemicalWasher());
ClientRegistry.registerTileEntity(TileEntityChemicalCrystallizer.class, "ChemicalCrystallizer", new RenderChemicalCrystallizer());
ClientRegistry.registerTileEntity(TileEntitySeismicVibrator.class, "SeismicVibrator", new RenderSeismicVibrator());
ClientRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber", new RenderConfigurableMachine());
}

View file

@ -0,0 +1,151 @@
package mekanism.client.model;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ModelSeismicVibrator extends ModelBase
{
ModelRenderer Base;
ModelRenderer Tower;
ModelRenderer TowerTop;
ModelRenderer TopPanel;
ModelRenderer Vibrator;
ModelRenderer PoleBR;
ModelRenderer PoleLB;
ModelRenderer PoleFL;
ModelRenderer PoleRF;
ModelRenderer PoleL;
ModelRenderer PoleR;
ModelRenderer Cable;
ModelRenderer ScreenFront;
ModelRenderer Keyboard;
public ModelSeismicVibrator()
{
textureWidth = 128;
textureHeight = 128;
Base = new ModelRenderer(this, 0, 0);
Base.addBox(0F, 0F, 0F, 16, 1, 16);
Base.setRotationPoint(-8F, 23F, -8F);
Base.setTextureSize(128, 128);
Base.mirror = true;
setRotation(Base, 0F, 0F, 0F);
Tower = new ModelRenderer(this, 64, 0);
Tower.addBox(0F, 0F, 0F, 4, 11, 4);
Tower.setRotationPoint(-2F, 12F, -2F);
Tower.setTextureSize(128, 128);
Tower.mirror = true;
setRotation(Tower, 0F, 0F, 0F);
TowerTop = new ModelRenderer(this, 80, 0);
TowerTop.addBox(0F, 0F, 0F, 2, 1, 2);
TowerTop.setRotationPoint(-1F, 10F, -1F);
TowerTop.setTextureSize(128, 128);
TowerTop.mirror = true;
setRotation(TowerTop, 0F, 0F, 0F);
TopPanel = new ModelRenderer(this, 0, 17);
TopPanel.addBox(0F, 0F, 0F, 8, 1, 8);
TopPanel.setRotationPoint(-4F, 11F, -4F);
TopPanel.setTextureSize(128, 128);
TopPanel.mirror = true;
setRotation(TopPanel, 0F, 0F, 0F);
Vibrator = new ModelRenderer(this, 32, 17);
Vibrator.addBox(0F, 0F, 0F, 8, 4, 8);
Vibrator.setRotationPoint(-4F, 19F, -4F);
Vibrator.setTextureSize(128, 128);
Vibrator.mirror = true;
setRotation(Vibrator, 0F, 0F, 0F);
PoleBR = new ModelRenderer(this, 0, 26);
PoleBR.addBox(0F, 0F, 0F, 1, 13, 1);
PoleBR.setRotationPoint(-5F, 10F, 4F);
PoleBR.setTextureSize(128, 128);
PoleBR.mirror = true;
setRotation(PoleBR, 0F, 0F, 0F);
PoleLB = new ModelRenderer(this, 0, 26);
PoleLB.addBox(0F, 0F, 0F, 1, 13, 1);
PoleLB.setRotationPoint(4F, 10F, 4F);
PoleLB.setTextureSize(128, 128);
PoleLB.mirror = true;
setRotation(PoleLB, 0F, 0F, 0F);
PoleFL = new ModelRenderer(this, 0, 26);
PoleFL.addBox(0F, 0F, 0F, 1, 13, 1);
PoleFL.setRotationPoint(4F, 10F, -5F);
PoleFL.setTextureSize(128, 128);
PoleFL.mirror = true;
setRotation(PoleFL, 0F, 0F, 0F);
PoleRF = new ModelRenderer(this, 0, 26);
PoleRF.addBox(0F, 0F, 0F, 1, 13, 1);
PoleRF.setRotationPoint(-5F, 10F, -5F);
PoleRF.setTextureSize(128, 128);
PoleRF.mirror = true;
setRotation(PoleRF, 0F, 0F, 0F);
PoleL = new ModelRenderer(this, 4, 26);
PoleL.addBox(0F, 0F, 0F, 1, 1, 8);
PoleL.setRotationPoint(4F, 10F, -4F);
PoleL.setTextureSize(128, 128);
PoleL.mirror = true;
setRotation(PoleL, 0F, 0F, 0F);
PoleR = new ModelRenderer(this, 4, 26);
PoleR.addBox(0F, 0F, 0F, 1, 1, 8);
PoleR.setRotationPoint(-5F, 10F, -4F);
PoleR.setTextureSize(128, 128);
PoleR.mirror = true;
setRotation(PoleR, 0F, 0F, 0F);
Cable = new ModelRenderer(this, 64, 15);
Cable.addBox(0F, 0F, 0F, 6, 2, 6);
Cable.setRotationPoint(-3F, 8F, -3F);
Cable.setTextureSize(128, 128);
Cable.mirror = true;
setRotation(Cable, 0F, 0F, 0F);
ScreenFront = new ModelRenderer(this, 0, 40);
ScreenFront.addBox(0F, 0F, 0F, 8, 6, 1);
ScreenFront.setRotationPoint(-4F, 11F, -6F);
ScreenFront.setTextureSize(128, 128);
ScreenFront.mirror = true;
setRotation(ScreenFront, 0F, 0F, 0F);
Keyboard = new ModelRenderer(this, 0, 47);
Keyboard.addBox(0F, 0F, 0F, 8, 1, 3);
Keyboard.setRotationPoint(-4F, 18F, -8F);
Keyboard.setTextureSize(128, 128);
Keyboard.mirror = true;
setRotation(Keyboard, 0.4363323F, 0F, 0F);
}
public void render(float size)
{
Base.render(size);
Tower.render(size);
TowerTop.render(size);
TopPanel.render(size);
Vibrator.render(size);
PoleBR.render(size);
PoleLB.render(size);
PoleFL.render(size);
PoleRF.render(size);
PoleL.render(size);
PoleR.render(size);
Cable.render(size);
ScreenFront.render(size);
GL11.glScalef(1.01F, 1.01F, 1.01F);
Keyboard.render(size);
}
public void renderWithPiston(float piston, float size)
{
Vibrator.rotationPointY = 19 - (piston*7);
render(size);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
}

View file

@ -15,8 +15,6 @@ public class ElementBoundHandler extends INEIGuiAdapter
{
GuiMekanism guiMek = (GuiMekanism)gui;
System.out.println(x + " " + y + " " + width + " " + height + " " + guiMek.getXPos() + " " + guiMek.getYPos());
Rectangle4i rect = new Rectangle4i(x, y, width, height);
for(GuiElement element : guiMek.guiElements)

View file

@ -13,6 +13,7 @@ import mekanism.client.model.ModelElectrolyticSeparator;
import mekanism.client.model.ModelLogisticalSorter;
import mekanism.client.model.ModelMetallurgicInfuser;
import mekanism.client.model.ModelRotaryCondensentrator;
import mekanism.client.model.ModelSeismicVibrator;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.util.MekanismUtils;
@ -43,6 +44,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
public ModelChemicalDissolutionChamber chemicalDissolutionChamber = new ModelChemicalDissolutionChamber();
public ModelChemicalWasher chemicalWasher = new ModelChemicalWasher();
public ModelChemicalCrystallizer chemicalCrystallizer = new ModelChemicalCrystallizer();
public ModelSeismicVibrator seismicVibrator = new ModelSeismicVibrator();
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
@ -153,6 +155,14 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ChemicalCrystallizer.png"));
chemicalCrystallizer.render(0.0625F);
}
else if(type == MachineType.SEISMIC_VIBRATOR)
{
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
GL11.glTranslatef(0.0F, -1.06F, 0.05F);
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "SeismicVibrator.png"));
seismicVibrator.render(0.0625F);
}
else {
MekanismRenderer.renderItem(renderer, metadata, block);
}

View file

@ -0,0 +1,63 @@
package mekanism.client.render.tileentity;
import mekanism.client.model.ModelSeismicVibrator;
import mekanism.common.tile.TileEntitySeismicVibrator;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderSeismicVibrator extends TileEntitySpecialRenderer
{
private ModelSeismicVibrator model = new ModelSeismicVibrator();
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float partialTick)
{
renderAModelAt((TileEntitySeismicVibrator)tileEntity, x, y, z, partialTick);
}
private void renderAModelAt(TileEntitySeismicVibrator tileEntity, double x, double y, double z, float partialTick)
{
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "SeismicVibrator.png"));
switch(tileEntity.facing)
{
case 2: GL11.glRotatef(0, 0.0F, 1.0F, 0.0F); break;
case 3: GL11.glRotatef(180, 0.0F, 1.0F, 0.0F); break;
case 4: GL11.glRotatef(90, 0.0F, 1.0F, 0.0F); break;
case 5: GL11.glRotatef(270, 0.0F, 1.0F, 0.0F); break;
}
float rate = 0.01F;
if(!tileEntity.getActive() && tileEntity.clientPiston > 0)
{
if(tileEntity.clientPiston < 1)
{
tileEntity.clientPiston = 1 + (1-tileEntity.clientPiston);
}
tileEntity.clientPiston = Math.min(2, tileEntity.clientPiston+rate)%2;
}
else if(tileEntity.getActive())
{
tileEntity.clientPiston = Math.min(2, tileEntity.clientPiston+rate)%2;
}
float actualRate = tileEntity.clientPiston < 1 ? tileEntity.clientPiston : 2-tileEntity.clientPiston;
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.renderWithPiston(actualRate, 0.0625F);
GL11.glPopMatrix();
}
}

View file

@ -126,6 +126,7 @@ public class CommonProxy
GameRegistry.registerTileEntity(TileEntityChemicalDissolutionChamber.class, "ChemicalDissolutionChamber");
GameRegistry.registerTileEntity(TileEntityChemicalWasher.class, "ChemicalWasher");
GameRegistry.registerTileEntity(TileEntityChemicalCrystallizer.class, "ChemicalCrystallizer");
GameRegistry.registerTileEntity(TileEntitySeismicVibrator.class, "SeismicVibrator");
GameRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber");
}

View file

@ -103,7 +103,6 @@ import mekanism.common.tile.TileEntityElectricBlock;
import mekanism.common.tile.TileEntityEnergizedSmelter;
import mekanism.common.tile.TileEntitySalinationTank;
import mekanism.common.tile.TileEntitySalinationValve;
import mekanism.common.tile.TileEntitySeismicVibrator;
import mekanism.common.transporter.TransporterManager;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -1176,7 +1175,6 @@ public class Mekanism
GameRegistry.registerTileEntity(TileEntityBoundingBlock.class, "BoundingBlock");
GameRegistry.registerTileEntity(TileEntityAdvancedBoundingBlock.class, "AdvancedBoundingBlock");
GameRegistry.registerTileEntity(TileEntityCardboardBox.class, "CardboardBox");
GameRegistry.registerTileEntity(TileEntitySeismicVibrator.class, "SeismicVibrator");
GameRegistry.registerTileEntity(TileEntitySalinationValve.class, "SalinationValve");
GameRegistry.registerTileEntity(TileEntitySalinationTank.class, "SalinationTank");

View file

@ -1152,7 +1152,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds, IPer
CHEMICAL_DISSOLUTION_CHAMBER(Mekanism.MachineBlock2, 6, "ChemicalDissolutionChamber", 35, 20000, TileEntityChemicalDissolutionChamber.class, true, false),
CHEMICAL_WASHER(Mekanism.MachineBlock2, 7, "ChemicalWasher", 36, 20000, TileEntityChemicalWasher.class, true, false),
CHEMICAL_CRYSTALLIZER(Mekanism.MachineBlock2, 8, "ChemicalCrystallizer", 37, 20000, TileEntityChemicalCrystallizer.class, true, false),
SEISMIC_VIBRATOR(Mekanism.MachineBlock2, 9, "SeismicVibrator", 39, 20000, TileEntitySeismicVibrator.class, false, false),
SEISMIC_VIBRATOR(Mekanism.MachineBlock2, 9, "SeismicVibrator", 39, 20000, TileEntitySeismicVibrator.class, true, false),
PRESSURIZED_REACTION_CHAMBER(Mekanism.MachineBlock2, 10, "PressurizedReactionChamber", 40, 20000, TileEntityPRC.class, false, false);
public Block typeBlock;

View file

@ -23,6 +23,8 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement
public int updateDelay;
public float clientPiston;
public RedstoneControl controlType = RedstoneControl.DISABLED;
public TileEntitySeismicVibrator()
@ -63,7 +65,7 @@ public class TileEntitySeismicVibrator extends TileEntityElectricBlock implement
ChargeUtils.discharge(0, this);
if(MekanismUtils.canFunction(this) && getEnergy() > Mekanism.seismicVibratorUsage)
if(MekanismUtils.canFunction(this) && getEnergy() >= Mekanism.seismicVibratorUsage)
{
setActive(true);
setEnergy(getEnergy()-Mekanism.seismicVibratorUsage);

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB