gpt4 book ai didi

java - Forge retrofit - 错误 : Unable to load definition cc:range_block#normal

转载 作者:行者123 更新时间:2023-11-30 08:56:38 28 4
gpt4 key购买 nike

我目前正在学习 Crayfish 先生关于如何使用 Forge 为 Minecraft 1.8 制作 Minecraft 模组的教程。我一直在关注他在做什么,但 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.registerBlock(Block, String) 将 block 添加到 GameRegistry,并使用此注册 block 渲染器代码:

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


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 ]
}
}
}

我已经让它工作到足以看到应用到库存中 block 的纹理,但是当我放置它时,我看到缺少纹理的 block 的青黑色纹理。

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

最佳答案

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

"parent": "block/orientable"

到:

"parent": "minecraft:block/orientable"

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

关于java - Forge retrofit - 错误 : Unable to load definition cc:range_block#normal,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28520957/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com