More work on upgrade GUI, also made SimpleGui packets send new window ID to client

This commit is contained in:
Aidan C. Brady committed 2014-07-21 19:15:27 -04:00
1 parent e778449045
commit 0b8ec37164
6 files changed
+97 -18

No files matched your search

@@ -40,6 +40,7 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
}
else {
FMLCommonHandler.instance().showGuiScreen(SimpleGuiMessage.getGui(message.guiId, player, player.worldObj, message.coord4D));
player.openContainer.windowId = message.windowId;
}
return null;
@@ -51,6 +52,8 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
public int guiId;
public int windowId;
public SimpleGuiMessage() {}
public SimpleGuiMessage(Coord4D coord, int gui)
@@ -58,6 +61,12 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
coord4D = coord;
guiId = gui;
}
public SimpleGuiMessage(Coord4D coord, int gui, int id)
{
this(coord, gui);
windowId = id;
}
public static void openServerGui(int id, EntityPlayerMP playerMP, World world, Coord4D obj)
{
@@ -66,7 +75,7 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
int window = playerMP.currentWindowId;
Mekanism.packetHandler.sendTo(new SimpleGuiMessage(obj, id), playerMP);
Mekanism.packetHandler.sendTo(new SimpleGuiMessage(obj, id, window), playerMP);
playerMP.openContainer = Mekanism.proxy.getServerGui(id, playerMP, world, obj.xCoord, obj.yCoord, obj.zCoord);
playerMP.openContainer.windowId = window;
@@ -89,6 +98,7 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
dataStream.writeInt(coord4D.dimensionId);
dataStream.writeInt(guiId);
dataStream.writeInt(windowId);
}
@Override
@@ -97,6 +107,7 @@ public class PacketSimpleGui implements IMessageHandler<SimpleGuiMessage, IMessa
coord4D = new Coord4D(dataStream.readInt(), dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
guiId = dataStream.readInt();
windowId = dataStream.readInt();
}
}
}