use of ivorius.reccomplex.network.PacketOpenGui in project RecurrentComplex by Ivorforce.
the class IvGuiRegistry method openGui.
// From FMLNetworkHandler.openGui
public void openGui(EntityPlayer entityPlayer, String modid, int modGuiId, ByteBuf data) {
IvGuiHandler handler = handlers.get(modid);
if (handler == null)
return;
if (entityPlayer instanceof EntityPlayerMP && !(entityPlayer instanceof FakePlayer)) {
EntityPlayerMP entityPlayerMP = (EntityPlayerMP) entityPlayer;
ByteBuf dataCopy = data.copy();
Container remoteGuiContainer = handler.getServerGuiElement(modGuiId, entityPlayerMP, data);
entityPlayerMP.getNextWindowId();
entityPlayerMP.closeContainer();
int windowId = entityPlayerMP.currentWindowId;
RecurrentComplex.network.sendTo(new PacketOpenGui(windowId, modid, modGuiId, dataCopy), entityPlayerMP);
if (// If null, it's client only
remoteGuiContainer != null) {
entityPlayerMP.openContainer = remoteGuiContainer;
entityPlayerMP.openContainer.windowId = windowId;
entityPlayerMP.openContainer.addListener(entityPlayerMP);
}
} else if (entityPlayer instanceof FakePlayer) {
// NO OP - I won't even log a message!
} else if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT)) {
RecurrentComplex.network.sendToServer(new PacketOpenGui(0, modid, modGuiId, data));
} else {
FMLLog.fine("Invalid attempt to open a local GUI on a dedicated server. This is likely a bug. GUI ID: %s,%d", modid, modGuiId);
}
}
Aggregations