Jump to content

Recommended Posts

Posted

Hi. In my mod i have a recipe for a basic rod and a lapis lazuli ingot:

GameRegistry.addSmelting(Item.dyePowder.itemID, new ItemStack(LapisIngot), 1.0F);
GameRegistry.addShapelessRecipe(new ItemStack(BasicRod, 4), new ItemStack(Block.wood), new ItemStack(Block.wood));

But in game you can only craft a basic rod with oak wood and you can craft a lapis lazuli ingot with any dye. How can i fix this?

Posted

add recipe for any/every type of wood you want

 

aka

new ItemStack(wood.blockID)

and

new ItemStack(wood.blockID, 0)

new ItemStack(wood.blockID, 1)

new ItemStack(wood.blockID, 2)

new ItemStack(wood.blockID, 3)

are tottally different, one of those reference specificly jungle wood, another might refer birch wood etc

 

note this is not actually what you want to write because i dont know exactly what the constructors of ItemStack look like

but i think its

new ItemStack(int id)

new ItemStack(int id, int quantity)

new ItemStack(int id, int quantity, int meta)

 

and not necesserelly in that order

look at net.minecraft.item.ItemStack for more info

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted
FurnaceRecipes.smelting().addSmelting(Item.dyePowder.itemID, 4, new ItemStack(LapisIngot), 100.0F);
CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Item.blazeRod), new ItemStack(Block.wood, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Block.wood, 1, OreDictionary.WILDCARD_VALUE));

Posted

CraftingManager.getInstance().addShapelessRecipe(new ItemStack(Item.blazeRod), new ItemStack(Block.wood, 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Block.wood, 1,OreDictionary.WILDCARD_VALUE));

 

we have wildcards ?!?!?!? that is sweet!!!

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

add recipe for any/every type of wood you want

 

aka

new ItemStack(wood.blockID)

and

new ItemStack(wood.blockID, 0)

new ItemStack(wood.blockID, 1)

new ItemStack(wood.blockID, 2)

new ItemStack(wood.blockID, 3)

are tottally different, one of those reference specificly jungle wood, another might refer birch wood etc

 

note this is not actually what you want to write because i dont know exactly what the constructors of ItemStack look like

but i think its

new ItemStack(int id)

new ItemStack(int id, int quantity)

new ItemStack(int id, int quantity, int meta)

 

and not necesserelly in that order

look at net.minecraft.item.ItemStack for more info

Ok how do I add a different wood though that doesnt make much sense because I can't specify in ItemStack

Posted

well you might want to try Guff code first. i dont actually have any item in my mod so i dont know for sure
but 
ItemStack(Item.itemID)
woudl call:
[code]public ItemStack(Item par1Item)
    {
        this(par1Item.itemID, 1, 0);
    }

which would in his turn call:

public ItemStack(int par1, int par2, int par3)

    {

        this.itemID = par1;

        this.stackSize = par2;

        this.itemDamage = par3;

 

        if (this.itemDamage < 0)

        {

            this.itemDamage = 0;

        }

    }[/code]

meaning second int is the quantity, third is the meta

 

so to get

 

 

and considering this:

//in class BlockWood

public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"};

public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
    {
        par3List.add(new ItemStack(par1, 1, 0));
        par3List.add(new ItemStack(par1, 1, 1));
        par3List.add(new ItemStack(par1, 1, 2));
        par3List.add(new ItemStack(par1, 1, 3));
    }

my bet is meta 0 = oak, 1 = spruce, birch = 2, jungle = 3;

 

but try guff first cuz thatll make less code and cleaner code

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Posted

well you might want to try Guff code first. i dont actually have any item in my mod so i dont know for sure
but 
ItemStack(Item.itemID)
woudl call:
[code]public ItemStack(Item par1Item)
    {
        this(par1Item.itemID, 1, 0);
    }

which would in his turn call:

public ItemStack(int par1, int par2, int par3)

    {

        this.itemID = par1;

        this.stackSize = par2;

        this.itemDamage = par3;

 

        if (this.itemDamage < 0)

        {

            this.itemDamage = 0;

        }

    }[/code]

meaning second int is the quantity, third is the meta

 

so to get

 

 

and considering this:

//in class BlockWood

public static final String[] woodType = new String[] {"oak", "spruce", "birch", "jungle"};

public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
    {
        par3List.add(new ItemStack(par1, 1, 0));
        par3List.add(new ItemStack(par1, 1, 1));
        par3List.add(new ItemStack(par1, 1, 2));
        par3List.add(new ItemStack(par1, 1, 3));
    }

my bet is meta 0 = oak, 1 = spruce, birch = 2, jungle = 3;

 

but try guff first cuz thatll make less code and cleaner code

Ok thanks

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.