伪造修改 - 错误:无法加载定义cc:range_block#normal

时间:2015-02-14 22:21:43

标签: java minecraft minecraft-forge

我目前正在关注如何使用Forge为Minecraft 1.8制作Minecraft mod的Crayfish先生的教程。我跟着他在做什么,但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$25.read(TypeAdapters.java:666) ~[TypeAdapters$25.class:?]
    at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:667) ~[TypeAdapters$25.class:?]
    at com.google.gson.internal.bind.TypeAdapters$25.read(TypeAdapters.java:642) ~[TypeAdapters$25.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将该块添加到GameRegistry.registerBlock(Block, String) ,并使用以下代码注册了块渲染器:

// 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"


项目结构如下所示:

enter image description here


模型 blockstate 文件包含以下代码:

blockstates / range_block.json

{
    "variants": {
        "normal": { "model": "cc:range_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"
    }
}

模型/项目/ 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)来说相对较新,所以我还没有真正理解所有的东西,但我正在路上!

1 个答案:

答案 0 :(得分:2)

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

"parent": "block/orientable"

为:

"parent": "minecraft:block/orientable"

换句话说,告诉Forge block/orientable文件位于minecraft目录中。