palmerjj01

GuiHandler

Oct 11th, 2014
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. package palmerjj01.YoshiCraft.Gui;
  2.  
  3. import net.minecraft.entity.player.EntityPlayer;
  4. import net.minecraft.tileentity.TileEntity;
  5. import net.minecraft.world.World;
  6. import palmerjj01.YoshiCraft.YoshiCraft;
  7. import palmerjj01.YoshiCraft.Container.ContainerYoshiOven;
  8. import palmerjj01.YoshiCraft.TileEntity.TileEntityYoshiOven;
  9. import cpw.mods.fml.common.network.IGuiHandler;
  10.  
  11. public class GuiHandler implements IGuiHandler{
  12.  
  13. private Object entity;
  14.  
  15. @Override
  16. public Object getServerGuiElement(int ID, EntityPlayer player, World world,
  17. int x, int y, int z) {
  18.  
  19. if(entity != null) {
  20. switch(ID) {
  21. case YoshiCraft.guiIDYoshiOven:
  22. if(entity instanceof TileEntityYoshiOven) {
  23. return new ContainerYoshiOven(player.inventory, (TileEntityYoshiOven) entity);
  24. }
  25. }
  26. }
  27. return null;
  28. }
  29.  
  30. @Override
  31. public Object getClientGuiElement(int ID, EntityPlayer player, World world,
  32. int x, int y, int z) {
  33. TileEntity entity = world.getTileEntity(x, y, z);
  34.  
  35. if(entity != null) {
  36. switch(ID) {
  37. case YoshiCraft.guiIDYoshiOven:
  38. if(entity instanceof TileEntityYoshiOven) {
  39. return new GuiYoshiOven(player.inventory, (TileEntityYoshiOven) entity);
  40. }
  41. }
  42. }
  43. return null;
  44. }
  45.  
  46. }
Advertisement
Add Comment
Please, Sign In to add comment