A few fixes

This commit is contained in:
Aidan C. Brady 2013-12-03 16:50:00 -05:00
parent a45a6e43f3
commit 54fa437cb1
4 changed files with 12 additions and 64 deletions

View file

@ -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)
{

View file

@ -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.");
}

View file

@ -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);
}
}

View file

@ -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);