Jump to content

problem with creative menu tabs


Dus998

Recommended Posts

I figured this was a problem with forge due to the crash log not saying anything about my mod

 

i have tested this with both 497 and 499 forge builds

 

the eclipse output code

 

 

2013-01-19 19:33:54 [iNFO] [sTDERR] net.minecraft.util.ReportedException: Rendering screen

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1013)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:882)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:771)

2013-01-19 19:33:54 [iNFO] [sTDERR] at java.lang.Thread.run(Thread.java:722)

2013-01-19 19:33:54 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.item.ItemStack.<init>(ItemStack.java:64)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.creativetab.CreativeTabs.getIconItemStack(CreativeTabs.java:209)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.gui.inventory.GuiContainerCreative.renderCreativeTab(GuiContainerCreative.java:833)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.gui.inventory.GuiContainerCreative.drawGuiContainerBackgroundLayer(GuiContainerCreative.java:660)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:88)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.renderer.InventoryEffectRenderer.drawScreen(InventoryEffectRenderer.java:43)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.gui.inventory.GuiContainerCreative.drawScreen(GuiContainerCreative.java:591)

2013-01-19 19:33:54 [iNFO] [sTDERR] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1004)

2013-01-19 19:33:54 [iNFO] [sTDERR] ... 3 more

 

 

 

here's my code for my creative tabs

part in core file

 

 

  public static CreativeTabs McExtTabBlock = new mcextcorecreativetabs.McExtCoreBlockTab(CreativeTabs.getNextID(), "MC EXT Blocks");

   

    public static CreativeTabs McExtTabArmour = new mcextcorecreativetabs.McExtCoreArmourTab(CreativeTabs.getNextID(),"MC EXT Armour");

 

    public static CreativeTabs McExtTabItem = new mcextcorecreativetabs.McExtCoreItemTab(CreativeTabs.getNextID(),"MC EXT Items");

 

 

 

individual files

 

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.creativetab.CreativeTabs;

import mcextcoreitems.ItemChestPlate;

 

public class McExtCoreArmourTab extends CreativeTabs {

    public McExtCoreArmourTab(int par1, String par2Str)

    {

        super(par1, par2Str);

    }

    @SideOnly(Side.CLIENT)

    public int getTabIconItemIndex()

    {

    return mcextcore.Core.ItemChestPlateID;

    }

   

    public String getTranslatedTabLabel()

    {

    return "MC Extended Armour";

    }

}

 

 

 

 

 

package mcextcorecreativetabs;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.creativetab.CreativeTabs;

 

public final class McExtCoreBlockTab extends CreativeTabs 

{

    public McExtCoreBlockTab(int par1, String par2Str)

    {

        super(par1, par2Str);

    }

    @SideOnly(Side.CLIENT)

    public int getTabIconItemIndex()

    {

    return mcextcore.Core.OresID;

    }

   

    public String getTranslatedTabLabel()

    {

    return "MC Extended Blocks";

    }

 

 

}

 

 

 

 

 

package mcextcorecreativetabs;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.creativetab.CreativeTabs;

 

public final class McExtCoreItemTab extends CreativeTabs 

{

    public McExtCoreItemTab(int par1, String par2Str)

    {

        super(par1, par2Str);

    }

    @SideOnly(Side.CLIENT)

    public int getTabIconItemIndex()

    {

    return mcextcore.Core.HotCoalID;

    }

   

    public String getTranslatedTabLabel()

    {

    return "MC Extended Items";

    }

 

 

}

 

 

 

note: eclipse is not detecting errors and the game doesnt crash until i attempt to go to tab 2 of the creative inventory

Link to comment
Share on other sites

First,you don't need to do the nextID() thing because the CreativeTabs do it automatically.

Just construct it with only the label parameter.

 

 

 

Secondly,the erros is can be because the item isn't exists,that's why it says null at CreativeTabs.java:209,

getIconItemStack() creates an itemstack from your item.

 

What does this mean?

Within your getTabIconItemIndex you are using an variable that stores the id of the things.

Because they are items you need to make it shifted.

 

So

@SideOnly(Side.CLIENT)
    public int getTabIconItemIndex()
    {
       return mcextcore.Core.ItemChestPlateID + 256; 
    }

 

I hope i helped you.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.