Don't like ads? PRO users don't see any ads ;-)
Guest

Blocks In Creative Inventory

By: TheInstitutions on Jul 11th, 2012  |  syntax: None  |  size: 0.96 KB  |  hits: 178  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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;