Jump to content

Recommended Posts

Posted

Well this is my ModBlocks.java

 

 

  Reveal hidden contents

 

 

This is my BlockIredantBlock.java

 

 

  Reveal hidden contents

 

 

And this is my BlockFusionOre.java

 

 

  Reveal hidden contents

 

 

And when i try to run minecraft with how ever i try to fix it, this comes up :o

 

 

  Reveal hidden contents

 

Posted

I'm not sure why you are trying to pass in an object array thing when you make your recipe. The recipe format will probably be more like:

GameRegistry.addRecipe(new ItemStack(iredantblock), "aaa", "aaa", "aaa", 'a', new ItemStack(YourModItemsClass.iredantcrystal));

Assuming irredant crystal is a variable that has been made somewhere else that you can access.

Read my thoughts on my summer mod work and tell me what you think!

http://www.minecraftforge.net/forum/index.php/topic,8396.0.html

 

I absolutely love her when she smiles

Posted
  On 6/18/2013 at 5:35 PM, redria7 said:

I'm not sure why you are trying to pass in an object array thing when you make your recipe. The recipe format will probably be more like:

GameRegistry.addRecipe(new ItemStack(iredantblock), "aaa", "aaa", "aaa", 'a', new ItemStack(YourModItemsClass.iredantcrystal));

Assuming irredant crystal is a variable that has been made somewhere else that you can access.

 

Changed it to that fix and this comes up

 

 

  Reveal hidden contents

 

Posted
  On 6/18/2013 at 5:35 PM, redria7 said:

I'm not sure why you are trying to pass in an object array thing when you make your recipe.

 

It doesn't matter. Java's infinite parameter feature is implemented to be backwards-compatible. In fact, when you have

 

GameRegistry.addRecipe(ItemStack, Object...)

You have nothing but

GameRegistry.addRecipe(ItemStack, Object[])

 

Java simply does the conversion for you behind the scenes. This actually is quite a neat feature since it allows you to programmatically assemble your recipes and still turn them in to that method. Example:

 

List<Object> myRecipe = new ArrayList<Object>();
myRecipe.add(new ItemStack(4, 1, 1));
myRecipe.addAll(new String[] { "aaa", "aaa", "aaa" });
myRecipe.add("a");
myRecipe.add(Block.blocksList[4]);
GameRegistry.addRecipe(myRecipe.toArray(new Object[0]));

 

Back to topic. Without further information I can only guess.

 

The erroring line in the CraftingManager is:

aitemstack[i1] = ((ItemStack)hashmap.get(Character.valueOf(c0))).copy();

 

The reason why this code fails is simple:

 

if (par2ArrayOfObj[i + 1] instanceof Item)
            {
                itemstack1 = new ItemStack((Item)par2ArrayOfObj[i + 1]);
            }
            else if (par2ArrayOfObj[i + 1] instanceof Block)
            {
                itemstack1 = new ItemStack((Block)par2ArrayOfObj[i + 1], 1, 32767);
            }
            else if (par2ArrayOfObj[i + 1] instanceof ItemStack)
            {
                itemstack1 = (ItemStack)par2ArrayOfObj[i + 1];
            }

(lines 189-200 of the CraftingManager).

This explicitly shows that you MUST pass in either an ItemStack, a Block, or an Item, but you are passing in an Integer.

 

Change

GameRegistry.addRecipe(new ItemStack(iredantblock), new Object[] { "aaa", "aaa", "aaa", Character.valueOf('a'), ItemIds.ITEMIREDANTCRYSTAL });

 

to

 

GameRegistry.addRecipe(new ItemStack(iredantblock), new Object[] { "aaa", "aaa", "aaa", Character.valueOf('a'), Item.itemsList[itemIds.ITEMIREDENTCRYSTAL + 256] });

 

where 256 represents the shifted index which still hasn't been fixed to be 4096. This is also the reason why you still can't go above 256 blocks...

 

  Quote
Changed it to that fix and this comes up

 

You hit copy&paste, didn't you? Change

new ItemStack(YourModItemsClass.iredantcrystal)

to

new ItemStack(ItemIds.IREDANTCRYSTAL)

and you should be fine.

Posted

You hit copy&paste, didn't you? Change

new ItemStack(YourModItemsClass.iredantcrystal)

to

new ItemStack(ItemIds.IREDANTCRYSTAL)

and you should be fine.

 

Im not sure were to put this change of code, im blind or it just isnt there

Posted
  On 6/18/2013 at 6:21 PM, FlameAtronach93 said:

You hit copy&paste, didn't you? Change

new ItemStack(YourModItemsClass.iredantcrystal)

to

new ItemStack(ItemIds.IREDANTCRYSTAL)

and you should be fine.

 

Taking a stab in the dark, I'm going to say that this might not work, Also

new ItemStack(YourModItemsClass.iredantcrystal)

is valid and is probably better to use. Also it is likely that ItemIds.IREDANTCRYSTAL will be itemID - 256 (because of shifted index and stuff), so lookup will fail, can't say for certain as this code isn't given

 

Again i'm going to re-state my thought that it is the item not being initialized at this point, i.e. if you haven't called ModItems.init() or whatever you called it the variables will be null, hence the null pointer, Also this is thrown using the Id as this is used to look up the item from an array of all the items, where it will be unable to find an item with your itemID. Try calling this method later than you already are (so like this):

 

@Init
public static void init(FMLInitializationEvent evt)
{
ModBlocks.init();
ModItems.init();
ModBlocks.initBlockRecipies();
}

Posted
  On 6/18/2013 at 7:14 PM, Yagoki said:

  Quote

You hit copy&paste, didn't you? Change

new ItemStack(YourModItemsClass.iredantcrystal)

to

new ItemStack(ItemIds.IREDANTCRYSTAL)

and you should be fine.

 

Taking a stab in the dark, I'm going to say that this might not work, Also

new ItemStack(YourModItemsClass.iredantcrystal)

is valid and is probably better to use. Also it is likely that ItemIds.IREDANTCRYSTAL will be itemID - 256 (because of shifted index and stuff), so lookup will fail, can't say for certain as this code isn't given

 

Again i'm going to re-state my thought that it is the item not being initialized at this point, i.e. if you haven't called ModItems.init() or whatever you called it the variables will be null, hence the null pointer, Also this is thrown using the Id as this is used to look up the item from an array of all the items, where it will be unable to find an item with your itemID. Try calling this method later than you already are (so like this):

 

@Init
public static void init(FMLInitializationEvent evt)
{
ModBlocks.init();
ModItems.init();
ModBlocks.initBlockRecipies();
}

 

its still doing the same crash!

Posted

Try to solve it yourself logically then. Split the line which is causing the error across several lines, this being java you can just hit enter between the parameters and it should work. This will tell you what is causing the error more precisely as each part will have a different line number and then you can track it down better.

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.