From eb8e02a39a49c130c36d135794774a2fccbd98f1 Mon Sep 17 00:00:00 2001 From: Aidan Brady Date: Sun, 8 Dec 2013 12:39:26 -0500 Subject: [PATCH] Fix a few bugs! --- common/mekanism/common/CommonProxy.java | 2 +- common/mekanism/common/EnergyNetwork.java | 6 +-- .../common/item/ItemBlockGenerator.java | 1 - .../TileEntityElectrolyticSeparator.java | 46 +++++++++++-------- 4 files changed, 30 insertions(+), 25 deletions(-) diff --git a/common/mekanism/common/CommonProxy.java b/common/mekanism/common/CommonProxy.java index 3755adfa5..98e2ff217 100644 --- a/common/mekanism/common/CommonProxy.java +++ b/common/mekanism/common/CommonProxy.java @@ -100,7 +100,7 @@ public class CommonProxy GameRegistry.registerTileEntity(TileEntityDigitalMiner.class, "DigitalMiner"); GameRegistry.registerTileEntity(TileEntityObsidianTNT.class, "ObsidianTNT"); GameRegistry.registerTileEntity(TileEntityRotaryCondensentrator.class, "RotaryCondensentrator"); - GameRegistry.registerTileEntity(TileEntityTeleporter.class, "Teleporter"); + GameRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter"); } /** diff --git a/common/mekanism/common/EnergyNetwork.java b/common/mekanism/common/EnergyNetwork.java index dbd7534c1..114df41d6 100644 --- a/common/mekanism/common/EnergyNetwork.java +++ b/common/mekanism/common/EnergyNetwork.java @@ -269,11 +269,7 @@ public class EnergyNetwork extends DynamicNetwork if(handler.canInterface(side.getOpposite())) { - if(handler.receiveEnergy(side.getOpposite(), 1, true) > 0) - { - toReturn.add(acceptor); - } - else if(handler.getMaxEnergyStored(side.getOpposite()) - handler.getEnergyStored(side.getOpposite()) > 0) + if(handler.getMaxEnergyStored(side.getOpposite()) - handler.getEnergyStored(side.getOpposite()) > 0) { toReturn.add(acceptor); } diff --git a/common/mekanism/generators/common/item/ItemBlockGenerator.java b/common/mekanism/generators/common/item/ItemBlockGenerator.java index c08528a0e..08753d0e5 100644 --- a/common/mekanism/generators/common/item/ItemBlockGenerator.java +++ b/common/mekanism/generators/common/item/ItemBlockGenerator.java @@ -84,7 +84,6 @@ public class ItemBlockGenerator extends ItemBlock implements IEnergizedItem, IIt } else { list.add(EnumColor.BRIGHT_GREEN + "Stored Energy: " + EnumColor.GREY + MekanismUtils.getEnergyDisplay(getEnergy(itemstack))); - list.add(EnumColor.BRIGHT_GREEN + "Voltage: " + EnumColor.GREY + (getVoltage(itemstack)*Mekanism.FROM_UE) + "v"); if(hasTank(itemstack)) { diff --git a/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java b/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java index ca7d37ea8..eba94dafe 100644 --- a/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java +++ b/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java @@ -151,10 +151,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp if(worldObj.rand.nextInt(3) == 2) { - ArrayList data = new ArrayList(); - data.add(2); - - PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(this), data), Object3D.get(this), 40D); + PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(this), getParticlePacket(new ArrayList())), Object3D.get(this), 40D); } } } @@ -320,30 +317,35 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp { dumpType = GasRegistry.getGas(dataStream.readInt()); } - else if(type == 2) - { - spawnParticle(); - } return; } super.handlePacketData(dataStream); - int amount = dataStream.readInt(); + int type = dataStream.readInt(); - if(amount != 0) + if(type == 0) { - waterTank.setFluid(new FluidStack(FluidRegistry.WATER, amount)); + int amount = dataStream.readInt(); + + if(amount != 0) + { + waterTank.setFluid(new FluidStack(FluidRegistry.WATER, amount)); + } + else { + waterTank.setFluid(null); + } + + oxygenStored = dataStream.readInt(); + hydrogenStored = dataStream.readInt(); + outputType = GasRegistry.getGas(dataStream.readInt()); + dumpType = GasRegistry.getGas(dataStream.readInt()); } - else { - waterTank.setFluid(null); + else if(type == 1) + { + spawnParticle(); } - - oxygenStored = dataStream.readInt(); - hydrogenStored = dataStream.readInt(); - outputType = GasRegistry.getGas(dataStream.readInt()); - dumpType = GasRegistry.getGas(dataStream.readInt()); } @Override @@ -351,6 +353,7 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp { super.getNetworkedData(data); + data.add(0); if(waterTank.getFluid() != null) { data.add(waterTank.getFluid().amount); @@ -367,6 +370,13 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp return data; } + public ArrayList getParticlePacket(ArrayList data) + { + super.getNetworkedData(data); + data.add(1); + return data; + } + @Override public void readFromNBT(NBTTagCompound nbtTags) {