Advertisement
TheInstitutions

Blocks In Creative Inventory

Jul 11th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1.  
  2. Blocks In Creative Inventory
  3.  
  4. Step 1:
  5.  
  6. Import these 2 things:
  7.  
  8.  
  9. import java.util.List;
  10. import net.minecraft.client.Minecraft;
  11.  
  12.  
  13.  
  14. Step 2:
  15.  
  16. And these methods into your mod_file
  17.  
  18.  
  19.  
  20.  
  21.  
  22. public void load()
  23. {
  24.  
  25. ModLoader.setInGameHook(this, true, false);
  26.  
  27. ModLoader.setInGUIHook(this, true, false);
  28.  
  29. }
  30.  
  31.  
  32.  
  33.  
  34.  
  35. public boolean onTickInGame(float f, Minecraft minecraft)
  36. {
  37. if(minecraft.currentScreen == null)
  38. {
  39. creativeInventory = null;
  40. }
  41. return true;
  42. }
  43. public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
  44. {
  45. if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote)
  46. {
  47. Container container = ((GuiContainer)guiscreen).inventorySlots;
  48. List list = ((ContainerCreative)container).itemList;
  49. int i = 0;
  50. list.add(new ItemStack(YOURBLOCK, 1, i));
  51.  
  52. creativeInventory = guiscreen;
  53. return true;
  54. }
  55.  
  56.  
  57.  
  58.  
  59.  
  60. private static GuiScreen creativeInventory;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement