Hey, modders! Here's my problem:
// Shall we play a game?
Time: 23.09.17 15:50
Description: Initializing game
java.lang.StringIndexOutOfBoundsException: String index out of range: 7
at java.lang.String.charAt(Unknown Source)
at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:232)
at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
at org.flakerZ.LotsOfThings.LotsOfThings.init(LotsOfThings.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:311)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)
at net.minecraft.client.Minecraft.run(Minecraft.java:942)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------
-- Head --
Stacktrace:
at java.lang.String.charAt(Unknown Source)
at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:232)
at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:250)
at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:245)
at org.flakerZ.LotsOfThings.LotsOfThings.init(LotsOfThings.java:84)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
at com.google.common.eventbus.EventBus.post(EventBus.java:275)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:737)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:311)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:597)
-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.Minecraft.run(Minecraft.java:942)
at net.minecraft.client.main.Main.main(Main.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
at GradleStart.main(Unknown Source)
I think that the problem is with crafts, so I post my code:
package org.flakerZ.LotsOfThings;
import org.flakerZ.LotsOfThings.item.ItemCheeseAxe;
import org.flakerZ.LotsOfThings.item.ItemCheeseHoe;
import org.flakerZ.LotsOfThings.item.ItemCheesePickaxe;
import org.flakerZ.LotsOfThings.item.ItemCheeseShovel;
import org.flakerZ.LotsOfThings.item.ItemCheeseSword;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
@Mod (modid = "lot", name="Lots of Things", version = "1.0")
public class LotsOfThings {
// Food
public static Item itemCheese;
public static Item itemMeltedCheese;
public static Item itemPerfectCheese;
// Items and Blocks
public static Item itemReinforcedCheese;
// Weapons
public static Item itemCheeseSword;
// Tools
public static Item itemCheesePickaxe;
public static Item itemCheeseAxe;
public static Item itemCheeseShovel;
public static Item itemCheeseHoe;
// Materials
public static final Item.ToolMaterial cheeseToolMaterial = EnumHelper.addToolMaterial("cheeseToolMaterial", 2, 300, 9, 3, 25);
public static final Item.ToolMaterial cheeseSwordMaterial = EnumHelper.addToolMaterial("cheeseSwordMaterial", 2, 250, 9, 4, 25);
@EventHandler
public void preInit(FMLPreInitializationEvent event) {
// Items and Blocks
itemCheese = new ItemFood(4, 1.0F, false).setUnlocalizedName("itemCheese").setTextureName("lot:itemcheese").setCreativeTab(tabLOT);
itemMeltedCheese = new ItemFood(8, 1.0F, false).setUnlocalizedName("itemMeltedCheese").setTextureName("lot:itemmeltedcheese").setCreativeTab(tabLOT);
itemPerfectCheese = new ItemFood(12, 1.0F, false).setUnlocalizedName("itemPerfectCheese").setTextureName("lot:itemperfectcheese").setCreativeTab(tabLOT);
itemReinforcedCheese = new Item().setUnlocalizedName("itemReinforcedCheese").setTextureName("lot:itemreinforcedcheese").setCreativeTab(tabLOT);
GameRegistry.registerItem(itemCheese, itemCheese.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemMeltedCheese, itemMeltedCheese.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemPerfectCheese, itemPerfectCheese.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemReinforcedCheese, itemReinforcedCheese.getUnlocalizedName().substring(5));
itemCheesePickaxe = new ItemCheesePickaxe(cheeseToolMaterial).setUnlocalizedName("itemCheesePickaxe").setTextureName("tmt:itemcheesepickaxe").setCreativeTab(tabLOT);
itemCheeseAxe = new ItemCheeseAxe(cheeseToolMaterial).setUnlocalizedName("itemCheeseAxe").setTextureName("tmt:itemcheeseaxe").setCreativeTab(tabLOT);
itemCheeseShovel = new ItemCheeseShovel(cheeseToolMaterial).setUnlocalizedName("itemCheeseShovel").setTextureName("tmt:itemcheeseshovel").setCreativeTab(tabLOT);
itemCheeseHoe = new ItemCheeseHoe(cheeseToolMaterial).setUnlocalizedName("itemCheeseHoe").setTextureName("tmt:itemcheesehoe").setCreativeTab(tabLOT);
itemCheeseSword = new ItemCheeseSword(cheeseSwordMaterial).setUnlocalizedName("itemCheeseSword").setTextureName("tmt:itemcheesesword").setCreativeTab(tabLOT);
GameRegistry.registerItem(itemCheesePickaxe, itemCheesePickaxe.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemCheeseAxe, itemCheeseAxe.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemCheeseShovel, itemCheeseShovel.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemCheeseHoe, itemCheeseHoe.getUnlocalizedName().substring(5));
GameRegistry.registerItem(itemCheeseSword, itemCheeseSword.getUnlocalizedName().substring(5));
}
@EventHandler
public void init(FMLInitializationEvent event) {
GameRegistry.addRecipe(new ItemStack(itemPerfectCheese, 1), new Object[]{ "MM", "CC", "BB",('M'), itemMeltedCheese, ('B'), Items.bowl, ('C'), itemCheese});
GameRegistry.addShapelessRecipe(new ItemStack(itemReinforcedCheese, 1), new Object[] {itemCheese, itemMeltedCheese, itemPerfectCheese});
GameRegistry.addSmelting(Items.milk_bucket, new ItemStack(itemCheese,1), 5.0F);
GameRegistry.addSmelting(itemCheese, new ItemStack(itemMeltedCheese, 1), 10.0F);
GameRegistry.addRecipe(new ItemStack(itemCheesePickaxe, 1), new Object[]{ "CCC", " S ", " S ",('C'), itemReinforcedCheese, ('S'), Items.stick});
GameRegistry.addRecipe(new ItemStack(itemCheeseAxe, 1), new Object[]{ "CC", "CS", " S ",('C'), itemReinforcedCheese, ('S'), Items.stick});
GameRegistry.addRecipe(new ItemStack(itemCheeseShovel, 1), new Object[]{ "C", "S", "S",('C'), itemReinforcedCheese, ('S'), Items.stick});
GameRegistry.addRecipe(new ItemStack(itemCheeseHoe, 1), new Object[]{ "CC", " S", " S",('C'), itemReinforcedCheese, ('S'), Items.stick});
GameRegistry.addRecipe(new ItemStack(itemCheeseSword, 1), new Object[]{ "C", "C", "S",('C'), itemReinforcedCheese, ('S'), Items.stick});
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
}
public static CreativeTabs tabLOT = new CreativeTabs("tabLOT") {
@Override
public Item getTabIconItem() {
return new ItemStack(itemCheese).getItem();
}
};
}
Minecraft version: 1.7.10, Forge version: 10.13.4.1558