Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to course page

Forging a Minecraft mod

Basic Minecraft modding with Minecraft Forge

Relation between getSubItems and setHasSubtypes

  • 2013-07-17 02:07:12
    Is there any relation between these two methods?

    e.g. To simplyfy the testing of the red spaceship I added this to ItemWand.java:

    [code]
    @Override
        @SideOnly(Side.CLIENT)
        public void getSubItems(int id, CreativeTabs tab, List list) {
            ItemStack stack = new ItemStack(id, 1, 0);
            list.add(stack);
            
            stack = new ItemStack(id, 1, 10);
            list.add(stack);
        }
    [/code]

    but I did not setHasSubtypes to true.
    It worked (a charged wand appears in the creative tab) but what is the propper way of doing it?

    Strictly speaking it is not a subtype, just the same wand with another damage value.
    As far as i can see hasSubtypes only affects the result of isDamageable() but the Wand is just a regular Item (no Tool like a Sword) and we manage the "damage" ourselves so does it even matter?

    Thanks for all the work with these courses, this is really unique!
    (Pahimar is too busy and the forge wiki is quite outdated and lacks too much information)
  • 2013-07-17 09:25:11
    did you setHasSubtypes(true); in the constructor?
  • 2013-07-18 18:34:58
    As I said no I haven't, but should I do it?
  • 2013-07-19 06:15:32
    yes.
  • Log in or sign up to reply to this thread