2014-12-29 91 views
-5

這是我試圖加載我的mod我的mcmod.info文件在minecraft中recive。你認爲它可能是什麼?java.lang.IllegalStateException:期望的STRING,但是BEGIN_ARRAY在我的mcmod.info JSON文件中?

The mcmod.info file in naters305_Test_82635018.zip cannot be parsed as valid JSON. It will be ignored 
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY 
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:176) ~[ReflectiveTypeAdapterFactory$Adapter.class:?] 
    at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?] 
    at com.google.gson.Gson.fromJson(Gson.java:868) ~[Gson.class:?] 
    at com.google.gson.Gson.fromJson(Gson.java:841) ~[Gson.class:?] 
    at cpw.mods.fml.common.MetadataCollection.from(MetadataCollection.java:64) [MetadataCollection.class:?] 
    at cpw.mods.fml.common.discovery.JarDiscoverer.discover(JarDiscoverer.java:53) [JarDiscoverer.class:?] 
    at cpw.mods.fml.common.discovery.ContainerType.findMods(ContainerType.java:42) [ContainerType.class:?] 
    at cpw.mods.fml.common.discovery.ModCandidate.explore(ModCandidate.java:71) [ModCandidate.class:?] 
    at cpw.mods.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:127) [ModDiscoverer.class:?] 
    at cpw.mods.fml.common.Loader.identifyMods(Loader.java:347) [Loader.class:?] 
    at cpw.mods.fml.common.Loader.loadMods(Loader.java:468) [Loader.class:?] 
    at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:204) [FMLClientHandler.class:?] 
    at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480) [bao.class:?] 
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:867) [bao.class:?] 
    at net.minecraft.client.main.Main.main(SourceFile:148) [Main.class:?] 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_25] 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_25] 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_25] 
    at java.lang.reflect.Method.invoke(Method.java:483) ~[?:1.8.0_25] 
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.11.jar:?] 
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] 
Caused by: java.lang.IllegalStateException: Expected STRING but was BEGIN_ARRAY 
    at com.google.gson.internal.bind.JsonTreeReader.nextString(JsonTreeReader.java:154) ~[JsonTreeReader.class:?] 
    at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:358) ~[TypeAdapters$13.class:?] 
    at com.google.gson.internal.bind.TypeAdapters$13.read(TypeAdapters.java:346) ~[TypeAdapters$13.class:?] 
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:93) ~[ReflectiveTypeAdapterFactory$1.class:?] 
    at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:172) ~[ReflectiveTypeAdapterFactory$Adapter.class:?] 
    ... 20 more 

JSON:

[ 
    { 
     "modid": "naters305", 
     "name": "Test", 
     "description": "Test of a few items blocks tools and armor.", 
     "version": "0.0.1", 
     "mcversion": "1.7.10", 
     "url": "", 
     "updateUrl": "", 
     "authors": [ 
      "Naters305" 
     ], 
     "credits": [], 
     "logoFile": "", 
     "screenshots": [], 
     "parent": "", 
     "dependencies": [] 
    } 
] 
+3

它在開頭說的是「naters305_Test_82635018.zip中的mcmod.info文件不能被解析爲有效的JSON」。下一行增加了更多的細節:「預期的STRING,但是BEGIN_ARRAY」 – forgivenson

+0

根據JSONLint,它是有效的json – naters302

+1

我做了一個快速的谷歌搜索,我發現的例子有「信用」值是一個字符串,而不是一個數組。我認爲這是你的問題。 – forgivenson

回答

3

mcmod.info文件時,"credits"節應該是一個字符串,而不是一個數組,你就會明白:

"credits": [], 

這裏是一個mcmod.info for Buildcraft的條目作爲有效條目的示例:

{ 
    "modid": "BuildCraft|Core", 
    "name": "BuildCraft", 
    "version": "4.2.2", 
    "mcversion": "1.6.4", 
    "description": "Extending Minecraft with pipes, auto-crafting, quarries, engines and much more!", 
    "credits": "Created by SpaceToad", 
    "logoFile": "/assets/buildcraft/logo.png", 
    "url": "http://www.mod-buildcraft.com/", 
    "updateUrl": "", 
    "authors": [ "SpaceToad", "BuildCraft Team" ], 
    "parent":"", 
    "screenshots": [], 
    "dependencies": [ 
    "mod_MinecraftForge" 
    ] 
} 
+1

我犯了一個錯誤,然後因爲它現在起作用了。謝謝 – naters302

相關問題