伪造纹理不渲染

时间:2017-02-25 21:27:53

标签: java json minecraft minecraft-forge

我修改伪造模式,我的项目不会渲染。这是错误:

  

[16:14:07] [客户线程/错误] [FML]:变种skycastle的异常加载模型:itemskygem#inventory for item" skycastle:itemskygem&#34 ;, normal location exception:   net.minecraftforge.client.model.ModelLoaderRegistry $ LoaderException:异常加载模型skycastle:item / itemskygem with loader VanillaLoader.INSTANCE,跳过       at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153)〜[ModelLoaderRegistry.class:?]       at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:336)〜[ModelLoader.class:?]       在net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175)〜[ModelBakery.class:?]       在net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:156)〜[ModelLoader.class:?]       at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28)[ModelManager.class:?]       at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122)[SimpleReloadableResourceManager.class:?]       在net.minecraft.client.Minecraft.init(Minecraft.java:541)[Minecraft.class:?]       在net.minecraft.client.Minecraft.run(Minecraft.java:387)[Minecraft.class:?]       在net.minecraft.client.main.Main.main(Main.java:118)[Main.class:?]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[?:1.8.0_121]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_121]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_121]       在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_121]       在net.minecraft.launchwrapper.Launch.launch(Launch.java:135)[launchwrapper-1.12.jar:?]       在net.minecraft.launchwrapper.Launch.main(Launch.java:28)[launchwrapper-1.12.jar:?]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[?:1.8.0_121]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_121]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_121]       在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_121]       在net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)[start /:?]       在GradleStart.main(GradleStart.java:26)[start /:?]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[?:1.8.0_121]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_121]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_121]       在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_121]       在com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)[idea_rt.jar:?]   引起:java.io.FileNotFoundException:skycastle:models / item / itemskygem.json       在net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69)〜[FallbackResourceManager.class:?]       at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65)〜[SimpleReloadableResourceManager.class:?]       在net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334)〜[ModelBakery.class:?]       at net.minecraftforge.client.model.ModelLoader.access $ 1600(ModelLoader.java:126)~ [ModelLoader.class:?]       在net.minecraftforge.client.model.ModelLoader $ VanillaLoader.loadModel(ModelLoader.java:937)〜[ModelLoader $ VanillaLoader.class:?]       在net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149)〜[ModelLoaderRegistry.class:?]       ......还有25个   [16:14:07] [客户线程/错误] [FML]:变种skycastle的异常加载模型:itemskygem#inventory for item" skycastle:itemskygem&#34 ;, blockstate location exception:   net.minecraftforge.client.model.ModelLoaderRegistry $ LoaderException:异常加载模型skycastle:itemskygem#inventory with loader VariantLoader.INSTANCE,跳过       at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153)〜[ModelLoaderRegistry.class:?]       在net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:344)〜[ModelLoader.class:?]       在net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175)〜[ModelBakery.class:?]       在net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:156)〜[ModelLoader.class:?]       at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28)[ModelManager.class:?]       at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122)[SimpleReloadableResourceManager.class:?]       在net.minecraft.client.Minecraft.init(Minecraft.java:541)[Minecraft.class:?]       在net.minecraft.client.Minecraft.run(Minecraft.java:387)[Minecraft.class:?]       在net.minecraft.client.main.Main.main(Main.java:118)[Main.class:?]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[?:1.8.0_121]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_121]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_121]       在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_121]       在net.minecraft.launchwrapper.Launch.launch(Launch.java:135)[launchwrapper-1.12.jar:?]       在net.minecraft.launchwrapper.Launch.main(Launch.java:28)[launchwrapper-1.12.jar:?]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[?:1.8.0_121]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_121]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_121]       在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_121]       在net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)[start /:?]       在GradleStart.main(GradleStart.java:26)[start /:?]       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)〜[?:1.8.0_121]       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)〜[?:1.8.0_121]       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)〜[?:1.8.0_121]       在java.lang.reflect.Method.invoke(Method.java:498)〜[?:1.8.0_121]       在com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)[idea_rt.jar:?]   引起:net.minecraft.client.renderer.block.model.ModelBlockDefinition $ MissingVariantException       at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78)〜[ModelBlockDefinition.class:?]       at net.minecraftforge.client.model.ModelLoader $ VariantLoader.loadModel(ModelLoader.java:1253)~ [ModelLoader $ VariantLoader.class:?]       在net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149)〜[ModelLoaderRegistry.class:?]       ......还有25个

这是有用的文件...... ItemSkygem.json

{
  "parent": "item/generated",
  "textures": {
    "layer0": "skycastle:items/skygem"
  }
}

ModItems.java

package rektek249.skycastle.init;


import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraftforge.fml.common.registry.GameRegistry;
import rektek249.skycastle.items.ItemSkygem;

public class ModItems {

public static Item skygem;



public static void init(){
    skygem = new ItemSkygem().setCreativeTab(CreativeTabs.MATERIALS);
}
public static void register(){
    GameRegistry.register(skygem);
}
public static void registerRenders(){
    registerRender(skygem);
}
private static void registerRender(Item item){
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}

}

很抱歉格式化它在intellij中正确格式化但是这里出错了.... 谢谢大家

1 个答案:

答案 0 :(得分:1)

根据错误日志,我认为它尝试加载的ResourceLocation

  

skycastle:itemskygem

,您的文件名为

  

ItemSkygem.json

,但该文件需要命名为itemskygem.json,因为它区分大小写,据我所知,右侧文件夹中的文件也应该是 resource_root /assets/skycastle/models/item

也许Forge Documentation也会有所帮助。

附加说明:

  • 您可能希望使用ModelLoader.setCustomModelResourceLocation(...)注册ModelResourceLocation。

此类代理的示例可以在我正在处理的Mod中找到:
  - 代理人Declaration   - Common实施
  - Client实施