mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 12:19:55 +00:00
Fixed performance of Vat, SAG Mill and AlloySmelter
This commit is contained in:
1 parent
7abf8d26f0
commit
be5a1fb371
9 files changed
+140
-14
No files matched your search
@@ -0,0 +1,50 @@
|
||||
package crazypants.enderio.machine;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import crazypants.enderio.machine.tank.TileTank;
|
||||
import crazypants.enderio.network.AbstractPacketTileEntity;
|
||||
import crazypants.enderio.network.NetworkUtil;
|
||||
|
||||
public class PacketCurrentTask extends AbstractPacketTileEntity<AbstractPoweredTaskEntity> {
|
||||
|
||||
private NBTTagCompound nbtRoot;
|
||||
|
||||
public PacketCurrentTask() {
|
||||
}
|
||||
|
||||
public PacketCurrentTask(AbstractPoweredTaskEntity tile) {
|
||||
super(tile);
|
||||
nbtRoot = new NBTTagCompound();
|
||||
if(tile.currentTask != null) {
|
||||
NBTTagCompound tankRoot = new NBTTagCompound();
|
||||
tile.currentTask.writeToNBT(tankRoot);
|
||||
nbtRoot.setTag("currentTask", tankRoot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ChannelHandlerContext ctx, ByteBuf buf) {
|
||||
super.encode(ctx, buf);
|
||||
NetworkUtil.writeNBTTagCompound(nbtRoot, buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ChannelHandlerContext ctx, ByteBuf buf) {
|
||||
super.decode(ctx, buf);
|
||||
nbtRoot = NetworkUtil.readNBTTagCompound(buf);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleClientSide(EntityPlayer player, World worldObj, AbstractPoweredTaskEntity tile) {
|
||||
if(nbtRoot.hasKey("currentTask")) {
|
||||
NBTTagCompound tankRoot = nbtRoot.getCompoundTag("currentTask");
|
||||
tile.currentTask = PoweredTask.readFromNBT(nbtRoot.getCompoundTag("currentTask"));
|
||||
} else {
|
||||
tile.currentTask = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user