Advertisement
Atijaf

CommonProxy

Feb 1st, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.85 KB | None | 0 0
  1. public class CommonProxy implements IGuiHandler{
  2.    
  3.     public static final int GUI_TUNNELER = 1;
  4.     public static final int GUI_KINETIC_RELOCATOR = 2;
  5.     public static final int GUI_TELEPORTER = 3;
  6.    
  7.     public void registerRenders(){}
  8.    
  9.     public EntityPlayer getPlayerEntity(MessageContext ctx){
  10.         return ctx.getServerHandler().playerEntity;
  11.     }
  12.        
  13.     public IThreadListener getThreadFromContext(MessageContext ctx){
  14.         return ctx.getServerHandler().playerEntity.getServerForPlayer();
  15.     }
  16.    
  17.    
  18.     public void initial(){
  19.         NetworkRegistry.INSTANCE.registerGuiHandler(EnergyTools.EnergyTools.instance, new CommonProxy());
  20.     }
  21.  
  22.  
  23.     @Override
  24.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  25.         switch(ID){
  26.             case(GUI_TUNNELER):{
  27.                 return new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItem()));
  28.             }
  29.            
  30.             case(GUI_KINETIC_RELOCATOR):{
  31.                 return new ContainerKineticRelocator(player.inventory, (KineticRelocatorTileEntity) world.getTileEntity(new BlockPos(x,y,z)));
  32.             }
  33.            
  34.             case(GUI_TELEPORTER):{
  35.                 return new ContainerTeleporterBlock(player.inventory, (TeleporterTE) world.getTileEntity(new BlockPos(x,y,z)));
  36.             }
  37.         }
  38.         return null;
  39.     }
  40.  
  41.  
  42.  
  43.     @Override
  44.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  45.         switch(ID){
  46.             case(GUI_TUNNELER):{
  47.                 return new GuiItemInventory((ContainerItem) new ContainerItem(player, player.inventory, new InventoryItem(player.getHeldItem())));
  48.             }
  49.            
  50.             case(GUI_KINETIC_RELOCATOR):{
  51.                 return new GuiKineticRelocator(player.inventory, (KineticRelocatorTileEntity) world.getTileEntity(new BlockPos(x,y,z)));
  52.             }
  53.            
  54.             case(GUI_TELEPORTER):{
  55.                 return new GuiTeleporterBlock(player.inventory, (TeleporterTE) world.getTileEntity(new BlockPos(x,y,z)));
  56.             }
  57.            
  58.         }
  59.         return null;
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement