Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement