Guest User

Gui Handler 1

a guest
Nov 17th, 2014
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. package com.Looke81.BioWarfare.handler;
  2.  
  3. import com.Looke81.BioWarfare.BioWarfare;
  4. import com.Looke81.BioWarfare.container.ContainerMicrobeExtractor;
  5. import com.Looke81.BioWarfare.gui.GuiMicrobeExtractor;
  6. import com.Looke81.BioWarfare.tileentity.TileEntityMicrobeExtractor;
  7.  
  8. import net.minecraft.entity.player.EntityPlayer;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.tileentity.TileEntity;
  11. import net.minecraft.world.World;
  12. import cpw.mods.fml.common.network.IGuiHandler;
  13.  
  14. public class GuiHandler1 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 BioWarfare.guiIDMicrobeExtractor:
  23. if (entity instanceof TileEntityMicrobeExtractor) {
  24. return new ContainerMicrobeExtractor(player.inventory, (TileEntityMicrobeExtractor) entity);
  25. }
  26.  
  27. return null;
  28. }
  29. }
  30.  
  31.  
  32. return null;
  33. }
  34.  
  35.  
  36. @Override
  37. public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
  38. TileEntity entity = world.getTileEntity(x, y, z);
  39.  
  40. if(entity != null) {
  41. switch(ID) {
  42. case BioWarfare.guiIDMicrobeExtractor:
  43. if (entity instanceof TileEntityMicrobeExtractor) {
  44. return new GuiMicrobeExtractor(player.inventory, (TileEntityMicrobeExtractor) entity);
  45. }
  46. return null;
  47. }
  48. }
  49.  
  50.  
  51. return null;
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment