mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 13:10:13 +00:00
#1213 NPE on inserting ingredients into a Vat
This commit is contained in:
1 parent
e7a26793c2
commit
92a0ce8f1c
10 files changed
+157
-61
No files matched your search
@@ -0,0 +1,49 @@
|
||||
package crazypants.enderio.machine;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.network.MessageTileEntity;
|
||||
|
||||
public class PacketCurrentTaskProgress extends MessageTileEntity<AbstractPoweredTaskEntity> implements IMessageHandler<PacketCurrentTaskProgress, IMessage> {
|
||||
|
||||
private float progress;
|
||||
|
||||
public PacketCurrentTaskProgress() {
|
||||
}
|
||||
|
||||
public PacketCurrentTaskProgress(AbstractPoweredTaskEntity tile) {
|
||||
super(tile);
|
||||
progress = -1;
|
||||
if(tile.getCurrentTask() != null) {
|
||||
progress = tile.getCurrentTask().getProgress();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeFloat(progress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
progress = buf.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketCurrentTaskProgress message, MessageContext ctx) {
|
||||
AbstractPoweredTaskEntity tile = message.getTileEntity(EnderIO.proxy.getClientWorld());
|
||||
if(tile != null) {
|
||||
if(message.progress < 0) {
|
||||
tile.currentTask = null;
|
||||
} else {
|
||||
tile.currentTask = new PoweredTaskProgress(message.progress);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user