Guest User

PEGuiHandler.class

a guest
Oct 18th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.40 KB | None | 0 0
  1. package net.rexozz.pixelengine;
  2.  
  3. import net.minecraft.entity.player.EntityPlayer;
  4. import net.minecraft.inventory.InventoryBasic;
  5. import net.minecraft.world.World;
  6. import net.minecraftforge.fml.common.network.IGuiHandler;
  7. import net.rexozz.pixelengine.client.gui.GuiCopy;
  8. import net.rexozz.pixelengine.client.gui.GuiNPC;
  9. import net.rexozz.pixelengine.client.gui.GuiSelectorRename;
  10. import net.rexozz.pixelengine.entity.EntityNPC;
  11. import net.rexozz.pixelengine.server.container.ContainerNPC;
  12.  
  13. public class PEGuiHandler implements IGuiHandler{
  14.    
  15.     public static final int SELGUI=0,
  16.             COPGUI=1,
  17.             NPCGUI=2;
  18.    
  19.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  20.         switch(ID){
  21.             case SELGUI:
  22.                 return null;
  23.             case COPGUI:
  24.                 return null;
  25.             case NPCGUI:
  26.                 EntityNPC npc=(EntityNPC)world.getEntityByID(x);
  27.                 return new ContainerNPC(player.inventory, npc.inventory, npc, player);
  28.         }
  29.         return null;
  30.     }
  31.    
  32.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  33.         switch(ID){
  34.             case SELGUI:
  35.                 return new GuiSelectorRename();
  36.             case COPGUI:
  37.                 return new GuiCopy(x);
  38.             case NPCGUI:
  39.                 EntityNPC npc=(EntityNPC)world.getEntityByID(x);
  40.                 return new GuiNPC(player.inventory, new InventoryBasic(npc.inventory.getDisplayName(), npc.inventory.getSizeInventory()), npc);
  41.         }
  42.         return null;
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment