Posted May 24, 20169 yr I am trying to load an item's model and .png using a .json file, but the item just loads as a pink and black block. here is my .json code: { "parent": "builtin/generated", "textures": { "layer0": "firstmod:items/cheese" }, "display": { "thirdperson": { "rotation": [-90, 0, 0], "translation": [0, 1, -3], "scale": [0.55, 0.55, 0.55] }, "firstperson": { "rotation": [0, -135, 25], "translation": [0, 4, 2], "scale": [1.7, 1.7, 1.7] } } } I have also pinned some errors in the debug console that I think may help with this situation. Also, I have a picture of my package viewer if that is useful: Debug Errors: http://pastebin.com/UuPFLeiU Package View: http://img.prntscr.com/img?url=http://i.imgur.com/ccmLcY5.png[/img] So, how would I be able to render the object as the .png without it looking like a massive pink and blue block? If you need more information on the project (more code, images, etc.), I will be more than happy to provide it. Thank you! "I'm not afraid of computers taking over the world. They're just sitting there. I can hit them with a two by four." - Thom Yorke
May 24, 20169 yr Author I am trying to load an item's model and .png using a .json file, but the item just loads as a pink and black block. here is my .json code: { "parent": "builtin/generated", "textures": { "layer0": "firstmod:items/cheese" }, "display": { "thirdperson": { "rotation": [-90, 0, 0], "translation": [0, 1, -3], "scale": [0.55, 0.55, 0.55] }, "firstperson": { "rotation": [0, -135, 25], "translation": [0, 4, 2], "scale": [1.7, 1.7, 1.7] } } } I have also pinned some errors in the debug console that I think may help with this situation. Also, I have a picture of my package viewer if that is useful: Debug Errors: http://pastebin.com/UuPFLeiU Package View: http://img.prntscr.com/img?url=http://i.imgur.com/ccmLcY5.png[/img] So, how would I be able to render the object as the .png without it looking like a massive pink and blue block? If you need more information on the project (more code, images, etc.), I will be more than happy to provide it. Thank you! "I'm not afraid of computers taking over the world. They're just sitting there. I can hit them with a two by four." - Thom Yorke
May 24, 20169 yr Author Show where you register your item and the model. gladly! Here is the code for the class MyItems.java (which is where the registering takes place): package wes.firstmod.init; import wes.firstmod.FirstMod; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; public class MyItems { public static Item cheese; /*public static void preInit() { }*/ public static void register() { Item cheeseName = cheese.setRegistryName("cheese"); GameRegistry.register(cheeseName); } public static void init() { cheese = new Item().setUnlocalizedName("cheese"); } public static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(FirstMod.MODID + ":" + item.getRegistryName(), "inventory")); } public static void registerRenders() { registerRender(cheese); } } Also, in the class FirstMod.java, the registries are called (forgot to add this previously, my apologies): package wes.firstmod; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import wes.firstmod.init.MyItems; @Mod(modid = FirstMod.MODID, version = FirstMod.VERSION) public class FirstMod { public static final String MODID = "firstmod"; public static final String VERSION = "1.0"; @EventHandler public void preInit(FMLPreInitializationEvent event) { MyRecipes.addRecipes(); MyItems.init(); MyItems.register(); } @EventHandler public void init(FMLInitializationEvent event) { MyRecipes.addRecipes(); MyItems.registerRenders(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Items are registered in preInit() "I'm not afraid of computers taking over the world. They're just sitting there. I can hit them with a two by four." - Thom Yorke
May 24, 20169 yr Author Show where you register your item and the model. gladly! Here is the code for the class MyItems.java (which is where the registering takes place): package wes.firstmod.init; import wes.firstmod.FirstMod; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; public class MyItems { public static Item cheese; /*public static void preInit() { }*/ public static void register() { Item cheeseName = cheese.setRegistryName("cheese"); GameRegistry.register(cheeseName); } public static void init() { cheese = new Item().setUnlocalizedName("cheese"); } public static void registerRender(Item item) { ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(FirstMod.MODID + ":" + item.getRegistryName(), "inventory")); } public static void registerRenders() { registerRender(cheese); } } Also, in the class FirstMod.java, the registries are called (forgot to add this previously, my apologies): package wes.firstmod; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import wes.firstmod.init.MyItems; @Mod(modid = FirstMod.MODID, version = FirstMod.VERSION) public class FirstMod { public static final String MODID = "firstmod"; public static final String VERSION = "1.0"; @EventHandler public void preInit(FMLPreInitializationEvent event) { MyRecipes.addRecipes(); MyItems.init(); MyItems.register(); } @EventHandler public void init(FMLInitializationEvent event) { MyRecipes.addRecipes(); MyItems.registerRenders(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { } } Items are registered in preInit() "I'm not afraid of computers taking over the world. They're just sitting there. I can hit them with a two by four." - Thom Yorke
May 25, 20169 yr Author This worked, thank you! "I'm not afraid of computers taking over the world. They're just sitting there. I can hit them with a two by four." - Thom Yorke
May 25, 20169 yr Author This worked, thank you! "I'm not afraid of computers taking over the world. They're just sitting there. I can hit them with a two by four." - Thom Yorke
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.