Пример #1
0
 void openRemoteGui(
     ModContainer mc, EntityPlayerMP player, int modGuiId, World world, int x, int y, int z) {
   IGuiHandler handler = serverGuiHandlers.get(mc);
   NetworkModHandler nmh = FMLNetworkHandler.instance().findNetworkModHandler(mc);
   if (handler != null && nmh != null) {
     Container container =
         (Container) handler.getServerGuiElement(modGuiId, player, world, x, y, z);
     if (container != null) {
       player.incrementWindowID();
       player.closeInventory();
       int windowId = player.currentWindowId;
       Packet250CustomPayload pkt = new Packet250CustomPayload();
       pkt.channel = "FML";
       pkt.data =
           FMLPacket.makePacket(Type.GUIOPEN, windowId, nmh.getNetworkId(), modGuiId, x, y, z);
       pkt.length = pkt.data.length;
       player.serverForThisPlayer.sendPacketToPlayer(pkt);
       player.craftingInventory = container;
       player.craftingInventory.windowId = windowId;
       player.craftingInventory.addCraftingToCrafters(player);
     }
   }
 }
 public void handleCloseWindow(Packet101CloseWindow par1Packet101CloseWindow) {
   playerEntity.closeInventory();
 }