mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-28 23:59:11 +00:00
return area can be toggled into storage area - should solve client/server desync issues
This commit is contained in:
1 parent
971cd290c8
commit
8f9cca470b
7 files changed
+164
-4
No files matched your search
@@ -0,0 +1,46 @@
|
||||
package crazypants.enderio.machine.invpanel;
|
||||
|
||||
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.network.MessageTileEntity;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class PacketSetExtractionDisabled extends MessageTileEntity<TileInventoryPanel> implements IMessageHandler<PacketSetExtractionDisabled, IMessage> {
|
||||
|
||||
private boolean extractionDisabled;
|
||||
|
||||
public PacketSetExtractionDisabled() {
|
||||
}
|
||||
|
||||
public PacketSetExtractionDisabled(TileInventoryPanel tile, boolean extractionDisabled) {
|
||||
super(tile);
|
||||
this.extractionDisabled = extractionDisabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
super.fromBytes(buf);
|
||||
extractionDisabled = buf.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
super.toBytes(buf);
|
||||
buf.writeBoolean(extractionDisabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMessage onMessage(PacketSetExtractionDisabled message, MessageContext ctx) {
|
||||
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
|
||||
TileEntity te = player.worldObj.getTileEntity(message.x, message.y, message.z);
|
||||
if(te instanceof TileInventoryPanel) {
|
||||
TileInventoryPanel teInvPanel = (TileInventoryPanel) te;
|
||||
teInvPanel.setExtractionDisabled(message.extractionDisabled);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user