mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 14:34:28 +00:00
Fixed power monitor performance.
This commit is contained in:
1 parent
be5a1fb371
commit
641a9d440c
3 files changed
+53
-4
No files matched your search
@@ -0,0 +1,41 @@
|
||||
package crazypants.enderio.machine.monitor;
|
||||
|
||||
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 PacketPowerInfo extends AbstractPacketTileEntity<TilePowerMonitor> {
|
||||
|
||||
private NBTTagCompound nbtRoot;
|
||||
|
||||
public PacketPowerInfo() {
|
||||
}
|
||||
|
||||
public PacketPowerInfo(TilePowerMonitor tile) {
|
||||
super(tile);
|
||||
nbtRoot = new NBTTagCompound();
|
||||
tile.writePowerInfoToNBT(nbtRoot);
|
||||
}
|
||||
|
||||
@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, TilePowerMonitor tile) {
|
||||
tile.readPowerInfoFromNBT(nbtRoot);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user