Guest User

guiHandler

a guest
Apr 23rd, 2014
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. package net.codecraft.mod.handler;
  2.  
  3. import net.codecraft.mod.Codecraft;
  4. import net.codecraft.mod.container.ContainerCodeOven;
  5. import net.codecraft.mod.gui.GuiCodeOven;
  6. import net.codecraft.mod.tileentity.TileEntityCodeOven;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. import net.minecraft.tileentity.TileEntity;
  9. import net.minecraft.world.World;
  10. import cpw.mods.fml.common.network.IGuiHandler;
  11.  
  12. public class GuiHandler implements IGuiHandler {
  13.  
  14.     public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  15.         TileEntity entity = world.getTileEntity(x, y, z);
  16.        
  17.         if(entity != null){
  18.             switch(ID){
  19.             case Codecraft.guiIDCodeOven:
  20.                 if(entity instanceof TileEntityCodeOven){
  21.                     return new ContainerCodeOven(player.inventory, (TileEntityCodeOven) entity);
  22.                 }
  23.                 return null;
  24.             }
  25.         }
  26.         return null;
  27.     }
  28.  
  29.     public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  30.         TileEntity entity = world.getTileEntity(x, y, z);
  31.        
  32.         if(entity != null){
  33.             switch(ID){
  34.             case Codecraft.guiIDCodeOven:
  35.                 if(entity instanceof TileEntityCodeOven){
  36.                     return new GuiCodeOven(player.inventory, (TileEntityCodeOven) entity);
  37.                 }
  38.                 return null;
  39.             }
  40.         }
  41.         return null;
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment