Не создаются суб-предметы

jopi

Попрошайка
1,421
30
260
Java:
public class ItemMulti extends Item {
    public int count;
    public ItemMulti(int id, int count, String unlocalizedName) {
        super(id);
        this.count = count;
        this.setHasSubtypes(true);
        this.setUnlocalizedName(unlocalizedName);
        this.setCreativeTab(ItemHandler.tabItems);
        this.setMaxStackSize(99);
        this.setMaxDamage(0);
        this.setTextureName("cubeground:" + unlocalizedName);
    }

    public void getSubItems(Item par1, CreativeTabs par2, List par3) {
        for (int x = 0; x < this.count; ++x) par3.add(new ItemStack(this, 1, x));
    }
    
    public String getUnlocalizedName(ItemStack is) {
        return super.getUnlocalizedName(is) + "_" + is.getItemDamage();
    }
}

В креатив вкладке 1 предмет, регистрирую 9
 
Решение
Смотрим в код:
Java:
    @SideOnly(Side.CLIENT)

    /**
     * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
     */
    public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
    {
        par3List.add(new ItemStack(par1, 1, 0));
    }
Не Item, а int.

timaxa007

Модератор
5,831
409
672
Смотрим в код:
Java:
    @SideOnly(Side.CLIENT)

    /**
     * returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
     */
    public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
    {
        par3List.add(new ItemStack(par1, 1, 0));
    }
Не Item, а int.
 
Сверху