Forge modding - Error: Unable to load definition cc:range_block#normal

Forge modding - Error: Unable to load definition cc:range_block#normal

我目前正在学习 Crayfish 先生关于如何使用 Forge 为 Minecraft 1.8 制作 Minecraft mod 的教程。我一直在关注他在做什么,但 Forge 是:

Unable to load definition cc:range_block#normal

整个错误消息如下所示:

[18:05:29] [Client thread/WARN]: Unable to load definition cc:range_block#normal
java.lang.RuntimeException: Encountered an exception when loading model definition of 'cc:range_block#normal' from: 'cc:blockstates/range_block.json' in resourcepack: 'FMLFileResourcePack:Cooking Craft'
    at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:167) ~[ModelBakery.class:?]
    at net.minecraft.client.resources.model.ModelBakery.loadVariants(ModelBakery.java:118) [ModelBakery.class:?]
    at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:96) [ModelLoader.class:?]
    at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:69) [ModelLoader.class:?]
    at net.minecraft.client.resources.model.ModelManager.onResourceManagerReload(ModelManager.java:29) [ModelManager.class:?]
    at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:124) [SimpleReloadableResourceManager.class:?]
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:470) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:325) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:117) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_31]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_31]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_31]
    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:?]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:78) [start/:?]
    at GradleStart.main(GradleStart.java:45) [start/:?]
Caused by: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Expected name at line 4 column 6
    at com.google.gson.internal.Streams.parse(Streams.java:56) ~[Streams.class:?]
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?]
    at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
    at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?]
    at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:35) ~[ModelBlockDefinition.class:?]
    at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:162) ~[ModelBakery.class:?]
    ... 16 more
Caused by: com.google.gson.stream.MalformedJsonException: Expected name at line 4 column 6
    at com.google.gson.stream.JsonReader.syntaxError(JsonReader.java:1505) ~[JsonReader.class:?]
    at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:494) ~[JsonReader.class:?]
    at com.google.gson.stream.JsonReader.hasNext(JsonReader.java:403) ~[JsonReader.class:?]
    at com.google.gson.internal.bind.TypeAdapters.read(TypeAdapters.java:666) ~[TypeAdapters.class:?]
    at com.google.gson.internal.bind.TypeAdapters.read(TypeAdapters.java:667) ~[TypeAdapters.class:?]
    at com.google.gson.internal.bind.TypeAdapters.read(TypeAdapters.java:642) ~[TypeAdapters.class:?]
    at com.google.gson.internal.Streams.parse(Streams.java:44) ~[Streams.class:?]
    at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:54) ~[TreeTypeAdapter.class:?]
    at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
    at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?]
    at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java:35) ~[ModelBlockDefinition.class:?]
    at net.minecraft.client.resources.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:162) ~[ModelBakery.class:?]
    ... 16 more

我已经使用 GameRegistry.registerBlock(Block, String) 将块添加到 GameRegistry,并使用以下代码注册了块渲染器:

// Get the block item
Item blockItem = Item.getItemFromBlock(block);
// Register the block
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(blockItem, 0, new ModelResourceLocation(ModData.MOD_ID + ":" + blockItem.getUnlocalizedName().substring(5), "inventory"));

ModData.MOD_ID变量是一个String,其值等于"cc"


项目结构如下所示:


modelitemblockstate 文件包含此代码:

blockstates/range_block.json:

{
    "variants": {
        "normal": { "model": "cc:range_block" },
    }
}

models/block/range_block.json:

{
    "parent": "block/orientable",
    "textures": {
        "top": "cc:blocks/range_block_top",
        "front": "cc:blocks/range_block_front_off",
        "side": "cc:blocks/range_block_side"
    }
}

models/item/range_block.json:

{
    "parent": "cc:block/range_block",
    "display": {
        "thirdperson": {
            "rotation": [ 10, -45, 170 ],
            "translation": [ 0, 1.5, -2.75 ],
            "scale": [ 0.375, 0.375, 0.375 ]
        }
    }
}

我已经让它工作到足以看到应用到物品栏中方块的纹理,但是当我放置它时,我看到方块的青黑色纹理缺少纹理。

我是 Forge (1.8) 的新手,所以我还没有真正理解所有内容,但我正在路上!

嗯...这个问题的解决方案很简单,但很难找到。我不得不更改 models/block/range_block.json 文件中的第一行:

"parent": "block/orientable"

至:

"parent": "minecraft:block/orientable"

也就是说,告诉Forgeblock/orientable文件在minecraft目录下