Guest User

GuiHandler

a guest
Apr 5th, 2016
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package dmz.icefeeling.ivi.tests;
  2.  
  3. import dmz.icefeeling.ivi.blocks.IFBlocks;
  4. import net.minecraft.client.resources.I18n;
  5. import net.minecraft.entity.Entity;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.entity.player.InventoryPlayer;
  8. import net.minecraft.tileentity.TileEntity;
  9. import net.minecraft.util.BlockPos;
  10. import net.minecraft.world.World;
  11. import net.minecraftforge.fml.common.network.IGuiHandler;
  12.    
  13. public class GuiHandler implements IGuiHandler  {
  14.  
  15.     public static final int OBANVIL = 1;
  16.    
  17.     @Override
  18.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  19.         TileEntity entity = world.getTileEntity(new BlockPos(x, y, z));
  20.  
  21.         if (entity instanceof TileEntityObsidianAnvil) {
  22.             return new ContainerObsidianAnvil(player.inventory, (TileEntityObsidianAnvil) entity);
  23.         }
  24.         return null;
  25.     }
  26.  
  27.     @Override
  28.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  29.         TileEntity entity = world.getTileEntity(new BlockPos(x, y, z));
  30.  
  31.         if (entity instanceof TileEntityObsidianAnvil) {
  32.             return new GuiObsidianAnvil(player.inventory, (TileEntityObsidianAnvil) entity);
  33.         }
  34.         return null;
  35.     }
  36.  
  37. }
RAW Paste Data