Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java CraftingManager错误_Java_Minecraft_Minecraft Forge - Fatal编程技术网

Java CraftingManager错误

Java CraftingManager错误,java,minecraft,minecraft-forge,Java,Minecraft,Minecraft Forge,我是Minecraft的新手,需要帮助。有什么问题吗?我认为这与CraftingManager有关。当我开始游戏时,加载到初始化和minecraft崩溃。请帮忙! Minecraft版本:1.7.10,Forge版本:10.13.4.1558,Eclipse版本:Oxygen 崩溃: at java.lang.String.charAt(Unknown Source) at net.minecraft.item.crafting.CraftingManager.addRecipe(Craftin

我是Minecraft的新手,需要帮助。有什么问题吗?我认为这与CraftingManager有关。当我开始游戏时,加载到初始化和minecraft崩溃。请帮忙! Minecraft版本:1.7.10,Forge版本:10.13.4.1558,Eclipse版本:Oxygen

崩溃:

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)
代码(主类,初始化):

撞车


您没有正确添加项目!使用本文。这应该行得通

就你而言:

 GameRegistry.addRecipe(new ItemStack(itemPerfectCheese, 1),  "MM", "CC", "BB","M", itemMeltedCheese, "B", Items.bowl, "C", itemCheese});

(遵循上面提到的网站)

其他一些东西,不一定会导致您当前的问题,但它们是不必要的,会导致另一个问题,或者可能更干净或更灵活

  • 您不需要
    新对象[]{}
    ,这很简单。普通代码拥有
    newobject[]{}
    的原因是编译器将
    varargs…
    编译成一个装箱对象数组,而反编译过程无法区分它们。它叫
  • 这个食谱会失败的

    GameRegistry.addRecipe(new ItemStack(itemCheeseAxe, 1), new Object[]{ "CC", "CS", " S ",('C'), itemReinforcedCheese, ('S'), Items.stick});
    
    为什么??因为
    “CC”、“CS”、“S”不都是相同的长度:2、2和3。配方不是正方形的,在游戏运行时会导致错误

  • ('C')
    ('S')
    等。多余的参数,您不需要它们。但他们没有伤害任何东西

  • 您可能需要使用
    ShapedOreRecipes
    并替换
    项目。使用
    “stickWood”
    粘贴
    ,以便添加mod的棍棒可以用于您的食谱


  • 你能发布完整的stacktrace吗?只是想知道,哪一个是你的mod
    examplemod
    ,或者
    lotsofthings
    ?@Edric很多东西,examplemod只是一个例子,我没有编辑它,它已经是了。是的,我更改了我的代码,甚至其他Minecraft版本上的mod也伪造了。你更改了什么?它对其他MF版本起作用了吗?已经不能对其他Forge版本起作用了。让我们解决这个问题吧?拆下这架飞机?你什么意思?如果你想为CraftingManager创建一个单独的类,那么就不要了。我在init中编写了所有的crafts(你可以看到在哪里)编辑了我的问题;希望能有帮助!;)如果解决了,则标记为已解决。
     GameRegistry.addRecipe(new ItemStack(itemPerfectCheese, 1),  "MM", "CC", "BB","M", itemMeltedCheese, "B", Items.bowl, "C", itemCheese});
    
    GameRegistry.addRecipe(new ItemStack(itemCheeseAxe, 1), new Object[]{ "CC", "CS", " S ",('C'), itemReinforcedCheese, ('S'), Items.stick});