
Blocks In Creative Inventory
By:
TheInstitutions on
Jul 11th, 2012 | syntax:
None | size: 0.96 KB | hits: 178 | expires: Never
Blocks In Creative Inventory
Step 1:
Import these 2 things:
import java.util.List;
import net.minecraft.client.Minecraft;
Step 2:
And these methods into your mod_file
public void load()
{
ModLoader.setInGameHook(this, true, false);
ModLoader.setInGUIHook(this, true, false);
}
public boolean onTickInGame(float f, Minecraft minecraft)
{
if(minecraft.currentScreen == null)
{
creativeInventory = null;
}
return true;
}
public boolean onTickInGUI(float f, Minecraft minecraft, GuiScreen guiscreen)
{
if((guiscreen instanceof GuiContainerCreative) && !(creativeInventory instanceof GuiContainerCreative) && !minecraft.theWorld.isRemote)
{
Container container = ((GuiContainer)guiscreen).inventorySlots;
List list = ((ContainerCreative)container).itemList;
int i = 0;
list.add(new ItemStack(YOURBLOCK, 1, i));
creativeInventory = guiscreen;
return true;
}
private static GuiScreen creativeInventory;