Guest User

GuiHandler

a guest
Feb 1st, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. package net.scratchforfun.mod.gui;
  2.  
  3. import net.minecraft.entity.player.EntityPlayer;
  4. import net.minecraft.tileentity.TileEntity;
  5. import net.minecraft.world.World;
  6. import net.scratchforfun.mod.ScratchForFun;
  7. import net.scratchforfun.mod.tileentity.TileEntityQuartzFurnace;
  8. import cpw.mods.fml.common.network.IGuiHandler;
  9. import cpw.mods.fml.common.network.NetworkRegistry;
  10.  
  11. public class GuiHandler implements IGuiHandler{
  12.  
  13. public GuiHandler(){
  14. NetworkRegistry.instance().registerGuiHandler(ScratchForFun.instance, this);
  15. }
  16.  
  17. public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  18. TileEntity entity = world.getBlockTileEntity(x, y, z);
  19.  
  20.  
  21. if(entity != null){
  22. switch(ID){
  23. case ScratchForFun.guiIdQuartzFurnace:
  24. if(entity instanceof TileEntityQuartzFurnace){
  25. return new ContainerQuartzFurnace(player.inventory, (TileEntityQuartzFurnace) entity);
  26. }
  27. }
  28. }
  29. return null;
  30. }
  31.  
  32.  
  33. public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  34. TileEntity entity = world.getBlockTileEntity(x, y, z);
  35.  
  36.  
  37. if(entity != null){
  38. switch(ID){
  39. case ScratchForFun.guiIdQuartzFurnace:
  40. if(entity instanceof TileEntityQuartzFurnace){
  41. return new GuiQuartzFurnace(player.inventory, (TileEntityQuartzFurnace) entity);
  42. }
  43. }
  44. }
  45. return null;
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment