New Electric Pump model!

This commit is contained in:
Aidan Brady 2013-11-03 12:07:23 -05:00
parent 2ecc48021d
commit c3fa020561
10 changed files with 129 additions and 155 deletions

View file

@ -1,160 +1,109 @@
package mekanism.client.model; package mekanism.client.model;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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.minecraft.entity.Entity; import net.minecraft.entity.Entity;
@SideOnly(Side.CLIENT)
public class ModelElectricPump extends ModelBase public class ModelElectricPump extends ModelBase
{ {
ModelRenderer COREBOX; ModelRenderer PumpHead;
ModelRenderer INPUTSLOT2; ModelRenderer Connector;
ModelRenderer INPUTSLOT3; ModelRenderer Panel1;
ModelRenderer INPUTSLOT4; ModelRenderer Panel2;
ModelRenderer INPUTSLOT5; ModelRenderer Panel3;
ModelRenderer INPUTSLOT1; ModelRenderer Body;
ModelRenderer PIPE3; ModelRenderer Axil;
ModelRenderer PIPE2; ModelRenderer Axil2;
ModelRenderer TOPPIPE3; ModelRenderer Ring1;
ModelRenderer PIPE1; ModelRenderer Ring2;
ModelRenderer CORESLOT; ModelRenderer Plug;
ModelRenderer PIPE4;
ModelRenderer TOPPIPE2;
ModelRenderer DISPLAY2;
ModelRenderer TOPPIPE1;
ModelRenderer TOPPIPE4;
ModelRenderer DISPLAY1;
public ModelElectricPump() public ModelElectricPump()
{ {
textureWidth = 128; textureWidth = 64;
textureHeight = 128; textureHeight = 64;
COREBOX = new ModelRenderer(this, 0, 0); PumpHead = new ModelRenderer(this, 33, 0);
COREBOX.addBox(0F, 0F, 0F, 12, 12, 12); PumpHead.addBox(0F, 0F, 0F, 6, 3, 6);
COREBOX.setRotationPoint(-6F, 10F, -6F); PumpHead.setRotationPoint(-3F, 19F, -3F);
COREBOX.setTextureSize(128, 128); PumpHead.setTextureSize(64, 64);
COREBOX.mirror = true; PumpHead.mirror = true;
setRotation(COREBOX, 0F, 0F, 0F); setRotation(PumpHead, 0F, 0F, 0F);
INPUTSLOT2 = new ModelRenderer(this, 0, 24); Connector = new ModelRenderer(this, 33, 10);
INPUTSLOT2.addBox(0F, 0F, 0F, 2, 6, 6); Connector.addBox(0F, 0F, 0F, 4, 1, 5);
INPUTSLOT2.setRotationPoint(6F, 13F, -3F); Connector.setRotationPoint(-2F, 14F, 2.5F);
INPUTSLOT2.setTextureSize(128, 128); Connector.setTextureSize(64, 64);
INPUTSLOT2.mirror = true; Connector.mirror = true;
setRotation(INPUTSLOT2, 0F, 0F, 0F); setRotation(Connector, 0F, 0F, 0F);
INPUTSLOT3 = new ModelRenderer(this, 16, 24); Panel1 = new ModelRenderer(this, 0, 15);
INPUTSLOT3.addBox(0F, 0F, 0F, 6, 6, 2); Panel1.addBox(-3F, -6F, 0F, 6, 6, 1);
INPUTSLOT3.setRotationPoint(-3F, 13F, 6F); Panel1.setRotationPoint(0F, 21F, -3F);
INPUTSLOT3.setTextureSize(128, 128); Panel1.setTextureSize(64, 64);
INPUTSLOT3.mirror = true; Panel1.mirror = true;
setRotation(INPUTSLOT3, 0F, 0F, 0F); setRotation(Panel1, 0.5585054F, 0F, 0F);
INPUTSLOT4 = new ModelRenderer(this, 16, 24); Panel2 = new ModelRenderer(this, 15, 15);
INPUTSLOT4.addBox(0F, 0F, 0F, 6, 6, 2); Panel2.addBox(0F, -6F, -3F, 1, 6, 6);
INPUTSLOT4.setRotationPoint(-3F, 13F, -8F); Panel2.setRotationPoint(-3F, 21F, 0F);
INPUTSLOT4.setTextureSize(128, 128); Panel2.setTextureSize(64, 64);
INPUTSLOT4.mirror = true; Panel2.mirror = true;
setRotation(INPUTSLOT4, 0F, 0F, 0F); setRotation(Panel2, 0F, 0F, -0.5585054F);
INPUTSLOT5 = new ModelRenderer(this, 0, 44); Panel3 = new ModelRenderer(this, 15, 15);
INPUTSLOT5.addBox(0F, 0F, 0F, 6, 2, 6); Panel3.addBox(-1F, -6F, -3F, 1, 6, 6);
INPUTSLOT5.setRotationPoint(-3F, 22F, -3F); Panel3.setRotationPoint(3F, 21F, 0F);
INPUTSLOT5.setTextureSize(128, 128); Panel3.setTextureSize(64, 64);
INPUTSLOT5.mirror = true; Panel3.mirror = true;
setRotation(INPUTSLOT5, 0F, 0F, 0F); setRotation(Panel3, 0F, 0F, 0.5585054F);
INPUTSLOT1 = new ModelRenderer(this, 0, 24); Body = new ModelRenderer(this, 30, 17);
INPUTSLOT1.addBox(0F, 0F, 0F, 2, 6, 6); Body.addBox(0F, 0F, 0F, 6, 11, 6);
INPUTSLOT1.setRotationPoint(-8F, 13F, -3F); Body.setRotationPoint(-3F, 8F, -3F);
INPUTSLOT1.setTextureSize(128, 128); Body.setTextureSize(64, 64);
INPUTSLOT1.mirror = true; Body.mirror = true;
setRotation(INPUTSLOT1, 0F, 0F, 0F); setRotation(Body, 0F, 0F, 0F);
PIPE3 = new ModelRenderer(this, 48, 0); Axil = new ModelRenderer(this, 0, 28);
PIPE3.addBox(0F, 0F, 0F, 2, 4, 1); Axil.addBox(0F, 0F, 0F, 9, 2, 4);
PIPE3.setRotationPoint(-1F, 9F, 6F); Axil.setRotationPoint(-4.5F, 17F, -2F);
PIPE3.setTextureSize(128, 128); Axil.setTextureSize(64, 64);
PIPE3.mirror = true; Axil.mirror = true;
setRotation(PIPE3, 0F, 0F, 0F); setRotation(Axil, 0F, 0F, 0F);
PIPE2 = new ModelRenderer(this, 54, 0); Axil2 = new ModelRenderer(this, 0, 0);
PIPE2.addBox(0F, 0F, 0F, 1, 4, 2); Axil2.addBox(0F, 0F, 0F, 4, 2, 12);
PIPE2.setRotationPoint(6F, 9F, -1F); Axil2.setRotationPoint(-2F, 17F, -4.5F);
PIPE2.setTextureSize(128, 128); Axil2.setTextureSize(64, 64);
PIPE2.mirror = true; Axil2.mirror = true;
setRotation(PIPE2, 0F, 0F, 0F); setRotation(Axil2, 0F, 0F, 0F);
TOPPIPE3 = new ModelRenderer(this, 60, 6); Ring1 = new ModelRenderer(this, 0, 35);
TOPPIPE3.addBox(0F, 0F, 0F, 2, 1, 3); Ring1.addBox(0F, 0F, 0F, 8, 1, 8);
TOPPIPE3.setRotationPoint(-1F, 9F, 3F); Ring1.setRotationPoint(-4F, 12F, -4F);
TOPPIPE3.setTextureSize(128, 128); Ring1.setTextureSize(64, 64);
TOPPIPE3.mirror = true; Ring1.mirror = true;
setRotation(TOPPIPE3, 0F, 0F, 0F); setRotation(Ring1, 0F, 0F, 0F);
PIPE1 = new ModelRenderer(this, 54, 0); Ring2 = new ModelRenderer(this, 0, 35);
PIPE1.addBox(0F, 0F, 0F, 1, 4, 2); Ring2.addBox(0F, 0F, 0F, 8, 1, 8);
PIPE1.setRotationPoint(-7F, 9F, -1F); Ring2.setRotationPoint(-4F, 10F, -4F);
PIPE1.setTextureSize(128, 128); Ring2.setTextureSize(64, 64);
PIPE1.mirror = true; Ring2.mirror = true;
setRotation(PIPE1, 0F, 0F, 0F); setRotation(Ring2, 0F, 0F, 0F);
CORESLOT = new ModelRenderer(this, 0, 52); Plug = new ModelRenderer(this, 0, 45);
CORESLOT.addBox(0F, 0F, 0F, 6, 2, 6); Plug.addBox(0F, 0F, 0F, 6, 6, 1);
CORESLOT.setRotationPoint(-3F, 8F, -3F); Plug.setRotationPoint(-3F, 13F, 7F);
CORESLOT.setTextureSize(128, 128); Plug.setTextureSize(64, 64);
CORESLOT.mirror = true; Plug.mirror = true;
setRotation(CORESLOT, 0F, 0F, 0F); setRotation(Plug, 0F, 0F, 0F);
PIPE4 = new ModelRenderer(this, 48, 0);
PIPE4.addBox(0F, 0F, 0F, 2, 4, 1);
PIPE4.setRotationPoint(-1F, 9F, -7F);
PIPE4.setTextureSize(128, 128);
PIPE4.mirror = true;
setRotation(PIPE4, 0F, 0F, 0F);
TOPPIPE2 = new ModelRenderer(this, 60, 0);
TOPPIPE2.addBox(0F, 0F, 0F, 3, 1, 2);
TOPPIPE2.setRotationPoint(3F, 9F, -1F);
TOPPIPE2.setTextureSize(128, 128);
TOPPIPE2.mirror = true;
setRotation(TOPPIPE2, 0F, 0F, 0F);
DISPLAY2 = new ModelRenderer(this, 70, 0);
DISPLAY2.addBox(-4F, 0F, 0F, 3, 1, 10);
DISPLAY2.setRotationPoint(6F, 9F, -5F);
DISPLAY2.setTextureSize(128, 128);
DISPLAY2.mirror = true;
setRotation(DISPLAY2, 0F, 0F, 0F);
TOPPIPE1 = new ModelRenderer(this, 60, 0);
TOPPIPE1.addBox(0F, 0F, 0F, 3, 1, 2);
TOPPIPE1.setRotationPoint(-6F, 9F, -1F);
TOPPIPE1.setTextureSize(128, 128);
TOPPIPE1.mirror = true;
setRotation(TOPPIPE1, 0F, 0F, 0F);
TOPPIPE4 = new ModelRenderer(this, 60, 6);
TOPPIPE4.addBox(0F, 0F, 0F, 2, 1, 3);
TOPPIPE4.setRotationPoint(-1F, 9F, -6F);
TOPPIPE4.setTextureSize(128, 128);
TOPPIPE4.mirror = true;
setRotation(TOPPIPE4, 0F, 0F, 0F);
DISPLAY1 = new ModelRenderer(this, 70, 0);
DISPLAY1.addBox(-4F, 0F, 0F, 3, 1, 10);
DISPLAY1.setRotationPoint(-1F, 9F, -5F);
DISPLAY1.setTextureSize(128, 128);
DISPLAY1.mirror = true;
setRotation(DISPLAY1, 0F, 0F, 0F);
} }
public void render(float size) public void render(float size)
{ {
COREBOX.render(size); PumpHead.render(size);
INPUTSLOT2.render(size); Connector.render(size);
INPUTSLOT3.render(size); Panel1.render(size);
INPUTSLOT4.render(size); Panel2.render(size);
INPUTSLOT5.render(size); Panel3.render(size);
INPUTSLOT1.render(size); Body.render(size);
PIPE3.render(size); Axil.render(size);
PIPE2.render(size); Axil2.render(size);
TOPPIPE3.render(size); Ring1.render(size);
PIPE1.render(size); Ring2.render(size);
CORESLOT.render(size); Plug.render(size);
PIPE4.render(size);
TOPPIPE2.render(size);
DISPLAY2.render(size);
TOPPIPE1.render(size);
TOPPIPE4.render(size);
DISPLAY1.render(size);
} }
private void setRotation(ModelRenderer model, float x, float y, float z) private void setRotation(ModelRenderer model, float x, float y, float z)

View file

@ -34,7 +34,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
@Override @Override
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
{ {
if(block == null || renderer == null) if(block == null || renderer == null || MachineType.getFromMetadata(metadata) == null)
{ {
return; return;
} }
@ -98,7 +98,7 @@ public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
{ {
int metadata = world.getBlockMetadata(x, y, z); int metadata = world.getBlockMetadata(x, y, z);
if(!MachineType.getFromMetadata(metadata).hasModel) if(MachineType.getFromMetadata(metadata) != null && !MachineType.getFromMetadata(metadata).hasModel)
{ {
renderer.renderStandardBlock(block, x, y, z); renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBoundsFromBlock(block); renderer.setRenderBoundsFromBlock(block);

View file

@ -29,6 +29,14 @@ public class RenderElectricPump extends TileEntitySpecialRenderer
bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png")); bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.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;
}
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
model.render(0.0625F); model.render(0.0625F);
GL11.glPopMatrix(); GL11.glPopMatrix();

View file

@ -5,6 +5,7 @@ import ic2.api.energy.tile.IEnergySink;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -419,6 +420,12 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
return false; return false;
} }
@Override
protected EnumSet<ForgeDirection> getConsumingSides()
{
return EnumSet.of(ForgeDirection.getOrientation(facing).getOpposite());
}
@Override @Override
public double transferEnergyToAcceptor(double amount) public double transferEnergyToAcceptor(double amount)
{ {
@ -440,7 +447,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
@Override @Override
public boolean canReceiveEnergy(ForgeDirection side) public boolean canReceiveEnergy(ForgeDirection side)
{ {
return true; return getConsumingSides().contains(side);
} }
@Override @Override
@ -478,7 +485,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
@Override @Override
public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction) public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
{ {
return direction != ForgeDirection.getOrientation(facing); return getConsumingSides().contains(direction);
} }
@Override @Override
@ -499,10 +506,15 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
@Override @Override
public FluidTankInfo[] getTankInfo(ForgeDirection direction) public FluidTankInfo[] getTankInfo(ForgeDirection direction)
{
if(direction == ForgeDirection.getOrientation(1))
{ {
return new FluidTankInfo[] {fluidTank.getInfo()}; return new FluidTankInfo[] {fluidTank.getInfo()};
} }
return null;
}
@Override @Override
public void setFluidStack(FluidStack fluidStack, Object... data) public void setFluidStack(FluidStack fluidStack, Object... data)
{ {
@ -524,7 +536,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
@Override @Override
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
{ {
if(fluidTank.getFluid() != null && fluidTank.getFluid().getFluid() != resource.getFluid()) if(fluidTank.getFluid() != null && fluidTank.getFluid().getFluid() != resource.getFluid() && from == ForgeDirection.getOrientation(1))
{ {
return drain(from, resource.amount, doDrain); return drain(from, resource.amount, doDrain);
} }
@ -540,10 +552,15 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
@Override @Override
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
{
if(from == ForgeDirection.getOrientation(1))
{ {
return fluidTank.drain(maxDrain, doDrain); return fluidTank.drain(maxDrain, doDrain);
} }
return null;
}
@Override @Override
public boolean canFill(ForgeDirection from, Fluid fluid) public boolean canFill(ForgeDirection from, Fluid fluid)
{ {

View file

@ -23,7 +23,7 @@ item.PortableTeleporter.name=Tragbarer Teleporter
item.TeleportationCore.name=Teleportationskern item.TeleportationCore.name=Teleportationskern
item.Configurator.name=Konfigurator item.Configurator.name=Konfigurator
item.NetworkReader.name=Netzwerklesegerät item.NetworkReader.name=Netzwerklesegerät
item.MaganeseAlloy.name=Manganlegierung item.ManganeseAlloy.name=Manganlegierung
item.WalkieTalkie.name=Walkie-Talkie item.WalkieTalkie.name=Walkie-Talkie
//Basic Block //Basic Block

View file

@ -23,7 +23,7 @@ item.PortableTeleporter.name=Portable Teleporter
item.TeleportationCore.name=Teleportation Core item.TeleportationCore.name=Teleportation Core
item.Configurator.name=Configurator item.Configurator.name=Configurator
item.NetworkReader.name=Network Reader item.NetworkReader.name=Network Reader
item.MaganeseAlloy.name=Manganese Alloy item.ManganeseAlloy.name=Manganese Alloy
item.WalkieTalkie.name=Walkie-Talkie item.WalkieTalkie.name=Walkie-Talkie
//Basic Block //Basic Block

View file

@ -23,7 +23,7 @@ item.PortableTeleporter.name=Przenośny Teleporter
item.TeleportationCore.name=Jądro Teleportacji item.TeleportationCore.name=Jądro Teleportacji
item.Configurator.name=Konfigurator item.Configurator.name=Konfigurator
item.NetworkReader.name=Czytnik Sieci item.NetworkReader.name=Czytnik Sieci
item.MaganeseAlloy.name=Stop Manganu item.ManganeseAlloy.name=Stop Manganu
item.WalkieTalkie.name=Walkie-Talkie item.WalkieTalkie.name=Walkie-Talkie
//Basic Block //Basic Block

View file

@ -23,7 +23,7 @@ item.PortableTeleporter.name=便携传送器
item.TeleportationCore.name=传送核心 item.TeleportationCore.name=传送核心
item.Configurator.name=调整器 item.Configurator.name=调整器
item.NetworkReader.name=网络读取器 item.NetworkReader.name=网络读取器
item.MaganeseAlloy.name=锰合金 item.ManganeseAlloy.name=锰合金
item.WalkieTalkie.name=步话机 item.WalkieTalkie.name=步话机
//Basic Block //Basic Block

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB