From 54fa437cb17848433c417a3346ed4d9638156812 Mon Sep 17 00:00:00 2001 From: "Aidan C. Brady" Date: Tue, 3 Dec 2013 16:50:00 -0500 Subject: [PATCH] A few fixes --- .../tileentity/TileEntityElectricPump.java | 3 +- .../generators/common/MekanismGenerators.java | 6 --- .../PacketElectrolyticSeparatorParticle.java | 52 ------------------- .../TileEntityElectrolyticSeparator.java | 15 ++++-- 4 files changed, 12 insertions(+), 64 deletions(-) delete mode 100644 common/mekanism/generators/common/network/PacketElectrolyticSeparatorParticle.java diff --git a/common/mekanism/common/tileentity/TileEntityElectricPump.java b/common/mekanism/common/tileentity/TileEntityElectricPump.java index 4ed8e4dc6..20d01e535 100644 --- a/common/mekanism/common/tileentity/TileEntityElectricPump.java +++ b/common/mekanism/common/tileentity/TileEntityElectricPump.java @@ -118,7 +118,8 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I if(tileEntity instanceof IFluidHandler) { - fluidTank.drain(((IFluidHandler)tileEntity).fill(orientation.getOpposite(), fluidTank.getFluid(), true), true); + FluidStack toDrain = new FluidStack(fluidTank.getFluid(), Math.min(100, fluidTank.getFluidAmount())); + fluidTank.drain(((IFluidHandler)tileEntity).fill(orientation.getOpposite(), toDrain, true), true); if(fluidTank.getFluid() == null || fluidTank.getFluid().amount <= 0) { diff --git a/common/mekanism/generators/common/MekanismGenerators.java b/common/mekanism/generators/common/MekanismGenerators.java index 00272e219..70437103e 100644 --- a/common/mekanism/generators/common/MekanismGenerators.java +++ b/common/mekanism/generators/common/MekanismGenerators.java @@ -6,7 +6,6 @@ import mekanism.api.infuse.InfuseType; import mekanism.common.IModule; import mekanism.common.Mekanism; import mekanism.common.MekanismRecipe; -import mekanism.common.PacketHandler; import mekanism.common.RecipeHandler; import mekanism.common.Version; import mekanism.common.item.ItemMekanism; @@ -14,9 +13,7 @@ import mekanism.common.util.MekanismUtils; import mekanism.common.util.MekanismUtils.ResourceType; import mekanism.generators.common.block.BlockGenerator; import mekanism.generators.common.item.ItemBlockGenerator; -import mekanism.generators.common.network.PacketElectrolyticSeparatorParticle; import net.minecraft.block.Block; -import net.minecraft.block.BlockLeaves; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; @@ -93,9 +90,6 @@ public class MekanismGenerators implements IModule addItems(); addRecipes(); - //Packet registrations - PacketHandler.registerPacket(PacketElectrolyticSeparatorParticle.class); - //Finalization Mekanism.logger.info("[MekanismGenerators] Loaded module."); } diff --git a/common/mekanism/generators/common/network/PacketElectrolyticSeparatorParticle.java b/common/mekanism/generators/common/network/PacketElectrolyticSeparatorParticle.java deleted file mode 100644 index 8ca99db2e..000000000 --- a/common/mekanism/generators/common/network/PacketElectrolyticSeparatorParticle.java +++ /dev/null @@ -1,52 +0,0 @@ -package mekanism.generators.common.network; - -import java.io.DataOutputStream; - -import mekanism.common.network.IMekanismPacket; -import mekanism.generators.common.tileentity.TileEntityElectrolyticSeparator; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -import com.google.common.io.ByteArrayDataInput; - -public class PacketElectrolyticSeparatorParticle implements IMekanismPacket -{ - public TileEntityElectrolyticSeparator tileEntity; - - @Override - public IMekanismPacket setParams(Object... data) - { - tileEntity = (TileEntityElectrolyticSeparator)data[0]; - - return this; - } - - @Override - public String getName() - { - return "ElectrolyticSeparatorParticle"; - } - - @Override - public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world) throws Exception - { - int x = dataStream.readInt(); - int y = dataStream.readInt(); - int z = dataStream.readInt(); - - TileEntityElectrolyticSeparator tileEntity = (TileEntityElectrolyticSeparator)world.getBlockTileEntity(x, y, z); - - if(tileEntity != null) - { - tileEntity.spawnParticle(); - } - } - - @Override - public void write(DataOutputStream dataStream) throws Exception - { - dataStream.writeInt(tileEntity.xCoord); - dataStream.writeInt(tileEntity.yCoord); - dataStream.writeInt(tileEntity.zCoord); - } -} diff --git a/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java b/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java index 70945bfda..f89894dc1 100644 --- a/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java +++ b/common/mekanism/generators/common/tileentity/TileEntityElectrolyticSeparator.java @@ -12,16 +12,14 @@ import mekanism.api.gas.IGasAcceptor; import mekanism.api.gas.IGasItem; import mekanism.api.gas.ITubeConnection; import mekanism.common.ISustainedTank; -import mekanism.common.Mekanism; import mekanism.common.PacketHandler; import mekanism.common.PacketHandler.Transmission; +import mekanism.common.network.PacketTileEntity; import mekanism.common.tileentity.TileEntityElectricBlock; -import mekanism.common.tileentity.TileEntityUniversalCable; import mekanism.common.util.ChargeUtils; import mekanism.common.util.MekanismUtils; import mekanism.generators.common.MekanismGenerators; import mekanism.generators.common.block.BlockGenerator.GeneratorType; -import mekanism.generators.common.network.PacketElectrolyticSeparatorParticle; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -151,9 +149,12 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp { setStored(dumpType, (getStored(dumpType) - 8)); - if(new Random().nextInt(3) == 2) + if(worldObj.rand.nextInt(3) == 2) { - PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketElectrolyticSeparatorParticle().setParams(this), Object3D.get(this), 40D); + ArrayList data = new ArrayList(); + data.add(2); + + PacketHandler.sendPacket(Transmission.CLIENTS_RANGE, new PacketTileEntity().setParams(Object3D.get(this), data), Object3D.get(this), 40D); } } } @@ -321,6 +322,10 @@ public class TileEntityElectrolyticSeparator extends TileEntityElectricBlock imp dumpType = GasRegistry.getGas(dataStream.readInt()); return; } + else if(type == 2) + { + spawnParticle(); + } } super.handlePacketData(dataStream);