Advertisement
ViiRuS

Add Blocks to the Creative Gui

Feb 23rd, 2012
425
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.util.List;
  2.  
  3. ModLoader.SetInGUIHook(this, true, false);
  4.  
  5. boolean addedToGui;
  6.  
  7. public boolean OnTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
  8.     {    
  9.         if ((guiscreen instanceof GuiContainerCreative))    
  10.         {                          
  11.             if (!addedToGui)        
  12.             {                          
  13.                 Container container = ((GuiContainer)guiscreen).inventorySlots;            
  14.                 List list = ((ContainerCreative)container).itemList;                    
  15.                 list.add(new ItemStack(guiBlock, 1));            
  16.                 addedToGui = true;        
  17.             }            
  18.         }        
  19.         else
  20.         {
  21.             addedToGui = false;    
  22.         }
  23.         return true;    
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement