java - PreInitialisation to initialisation error in Minecraft Forge -
i making mod , tried add crafting recipies.
when tried launch it, crashed , left report. can please tell me need fix this?
---- minecraft crash report ---- // quite honestly, wouldn't worry myself that.
time: 19/04/16 20:25 description: initializing game
java.lang.stringindexoutofboundsexception: string index out of range: 5 @ java.lang.string.charat(unknown source) @ net.minecraft.item.crafting.craftingmanager.addrecipe(craftingmanager.java:232) @ cpw.mods.fml.common.registry.gameregistry.addshapedrecipe(gameregistry.java:250) at
cpw.mods.fml.common.registry.gameregistry.addshapedrecipe(gameregistry.java:250) @ cpw.mods.fml.common.registry.gameregistry.addrecipe(gameregistry.java:245) @ com.abhijith.main.craftingmanager.addcraftingrec(craftingmanager.java:18) @ com.abhijith.main.craftingmanager.mainregistry(craftingmanager.java:13) @ com.abhijith.main.mainregistry.preload(mainregistry.java:23) @ lot of unneeeded lines follow...
here crafting manager
public class craftingmanager { public static void mainregistry(){ addcraftingrec(); addsmeltingrec(); } public static void addcraftingrec(){ //shaped gameregistry.addrecipe(new itemstack(mblocks.diaslab, 3), new object[]{" "," ","xxx",'x', blocks.diamond_block}); gameregistry.addrecipe(new itemstack(mitems.ostick, 1), new object[]{" x "," x ", 'x', blocks.obsidian}); //shapeless } public static void addsmeltingrec(){ gameregistry.addsmelting(blocks.coal_block, new itemstack(blocks.obsidian, 1), 20.0f); } }
java.lang.stringindexoutofboundsexception: string index out of range: 5 @ java.lang.string.charat(unknown source) @ net.minecraft.item.crafting.craftingmanager.addrecipe(craftingmanager.java:232) @
stringindexoutofbounds
means: if have string has length of 4, , try access position 5, not exist, , problem.
"hello" > length 5 h 0 e 1 l 2 l 3 o 4
it has 5 elements. if try access @ 5, "hello".charat(5) you'll string index out of bounds, because index 5 not exist.
you probaly defined recipe wrong.
so check recipe in craftingmanager.java:232
<-- line number
and check documentation.
without code, can't you.
edit
from comments:
diaslab, 3), new object[]{" "," ","xxx" strings before xxx need >equal lenth. make them 3 spaces.
Comments
Post a Comment