Advertisement
HalestormXV

Untitled

Mar 20th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.82 KB | None | 0 0
  1. package com.halestormxv.guihandler;
  2.  
  3. import com.halestormxv.blocks.CelestialCraft_blocks;
  4. import com.halestormxv.gui.GuiCelestialForge;
  5. import com.halestormxv.gui.GuiCelestialFurnace;
  6. import com.halestormxv.gui.GuiCelestialKeyPouch;
  7. import com.halestormxv.inventory.ContainerCelestialForge;
  8. import com.halestormxv.inventory.ContainerCelestialFurnace;
  9. import com.halestormxv.inventory.ContainerCelestialKeypouch;
  10. import com.halestormxv.inventory.InventoryKeyPouch;
  11. import com.halestormxv.item.CelestialCraft_items;
  12. import com.halestormxv.item.keyPouch;
  13. import com.halestormxv.tile_entity.TileEntityCelestialFurnace;
  14.  
  15. import cpw.mods.fml.common.network.IGuiHandler;
  16. import net.minecraft.entity.player.EntityPlayer;
  17. import net.minecraft.item.ItemStack;
  18. import net.minecraft.tileentity.TileEntity;
  19. import net.minecraft.world.World;
  20.  
  21. public class CCGuiHandler implements IGuiHandler {
  22.  
  23.     @Override
  24.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  25.         TileEntity entity = world.getTileEntity(x, y, z);
  26.  
  27.         if(entity != null){
  28.             switch(ID){
  29.             case CelestialCraft_blocks.guiIDCelestialFurnace:
  30.                 if (entity instanceof TileEntityCelestialFurnace){
  31.                     return new ContainerCelestialFurnace(player.inventory, (TileEntityCelestialFurnace) entity);
  32.                 }
  33.                 return null;       
  34.             }
  35.         }
  36.  
  37.         if(ID == CelestialCraft_blocks.guiIDCelestialForge)
  38.         {
  39.             return ID == CelestialCraft_blocks.guiIDCelestialForge && world.getBlock(x, y, z) == CelestialCraft_blocks.blockCelestialForge ? new ContainerCelestialForge(player.inventory, world, x, y, z) : null;
  40.         }
  41.        
  42.         if(ID == CelestialCraft_items.guiIDKeyPouch)
  43.         {
  44.             ItemStack stack = player.inventory.getStackInSlot(x);
  45.             return new ContainerCelestialKeypouch(player, player.inventory, new InventoryKeyPouch(stack));
  46.         }
  47.  
  48.         return null;
  49.     }  
  50.  
  51.     @Override
  52.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  53.         TileEntity entity = world.getTileEntity(x, y, z);
  54.  
  55.         if(entity != null){
  56.             switch(ID){
  57.             case CelestialCraft_blocks.guiIDCelestialFurnace:
  58.                 if (entity instanceof TileEntityCelestialFurnace){
  59.                     return new GuiCelestialFurnace(player.inventory, (TileEntityCelestialFurnace) entity);
  60.                 }
  61.                 return null;       
  62.             }
  63.         }
  64.  
  65.         if(ID == CelestialCraft_blocks.guiIDCelestialForge)
  66.         {
  67.             return ID == CelestialCraft_blocks.guiIDCelestialForge && world.getBlock(x, y, z) == CelestialCraft_blocks.blockCelestialForge ? new GuiCelestialForge(player.inventory, world, x, y, z) : null;
  68.         }
  69.        
  70.         if(ID == CelestialCraft_items.guiIDKeyPouch)
  71.         {
  72.             ItemStack stack = player.inventory.getStackInSlot(x);
  73.             return new GuiCelestialKeyPouch((ContainerCelestialKeypouch) new ContainerCelestialKeypouch(player, player.inventory, new InventoryKeyPouch(stack)));
  74.         }
  75.  
  76.         return null;
  77.     }
  78.  
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement