Guest User

GuiHandler

a guest
Oct 22nd, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. package com.arucraft.handler;
  2.  
  3. import net.minecraft.entity.player.EntityPlayer;
  4. import net.minecraft.tileentity.TileEntity;
  5. import net.minecraft.world.World;
  6.  
  7. import com.arucraft.ArucraftMain;
  8. import com.arucraft.container.ContainerAlloyOven;
  9. import com.arucraft.gui.GuiAlloyOven;
  10. import com.arucraft.tileentity.TileEntityAlloyOven;
  11.  
  12. import cpw.mods.fml.common.network.IGuiHandler;
  13.  
  14. public class GuiHandler implements IGuiHandler{
  15.  
  16.     @Override
  17.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  18.         TileEntity entity = world.getTileEntity(x, y, z);
  19.  
  20.         if(entity != null) {
  21.             switch(ID) {
  22.             case ArucraftMain.guiIDAlloyOven:
  23.                 if (entity instanceof TileEntityAlloyOven) {
  24.                     return new ContainerAlloyOven(player.inventory, (TileEntityAlloyOven) entity);
  25.                 }
  26.  
  27.                 return null;
  28.  
  29.             }
  30.         }
  31.         return null;
  32.     }
  33.  
  34.     @Override
  35.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  36.         TileEntity entity = world.getTileEntity(x, y, z);
  37.  
  38.         if(entity != null) {
  39.             switch(ID) {
  40.             case ArucraftMain.guiIDAlloyOven:
  41.                 if (entity instanceof TileEntityAlloyOven) {
  42.                     return new GuiAlloyOven(player.inventory, (TileEntityAlloyOven) entity);
  43.                 }
  44.  
  45.                 return null;
  46.  
  47.             }
  48.         }
  49.         return null;
  50.     }
  51.  
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment