Fixed the crash bug when attempting to swap fluids

This commit is contained in:
Arthur Uzulin committed 2014-03-15 17:19:42 +11:00
1 parent ca4dfc60e2
commit 854f92b92a
3 files changed
+79 -11

No files matched your search

@@ -1,13 +1,16 @@
package tconstruct.util.network.packet;
import cpw.mods.fml.common.FMLCommonHandler;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import tconstruct.TConstruct;
import tconstruct.blocks.logic.SmelteryLogic;
import cpw.mods.fml.common.FMLCommonHandler;
public class PacketSmeltery extends AbstractPacket
{
@@ -65,16 +68,12 @@ public class PacketSmeltery extends AbstractPacket
World world = player.worldObj;
TileEntity te = world.getTileEntity(x, y, z);
if (te instanceof SmelteryLogic)
{
FluidStack temp = null;
for (FluidStack liquid : ((SmelteryLogic) te).moltenMetal)
{// TODO
// update
// fluid
// stuffs
{
if (liquid.fluidID == fluidID)
{
temp = liquid;
@@ -89,11 +88,10 @@ public class PacketSmeltery extends AbstractPacket
else
((SmelteryLogic) te).moltenMetal.add(0, temp);
}
// TODO check if this works like it should
// Old code:
// PacketDispatcher.sendPacketToAllInDimension(te.getDescriptionPacket(),
// dimension);
FMLCommonHandler.instance().getClientToServerNetworkManager().scheduleOutboundPacket(te.getDescriptionPacket());
NBTTagCompound data = new NBTTagCompound();
te.writeToNBT(data);
TConstruct.packetPipeline.sendToDimension(new PacketUpdateTE(x, y, z, data), dimension);
}
}