Posted December 5, 20186 yr I'm making a mod that adds decorations and I can't seem to get the textures working. When I hold the item I in my hand it shows up as a black and purple square in the middle of my screen with "vmm:LH_new#inventory" in front. Here is my code: Common Proxy: Spoiler package bomb787.vmm.proxy; import net.minecraft.item.Item; public class CommonProxy { public void registerItemRenderer(Item item, int meta, String id) { } } Client Proxy: Spoiler package bomb787.vmm.proxy; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy extends CommonProxy { public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id)); } } RegistryHandler: Spoiler package bomb787.vmm.util.handlers; import bomb787.vmm.init.ItemInit; import bomb787.vmm.util.IHasModel; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ItemInit.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for(Item item : ItemInit.ITEMS) { if(item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } } } IHasModel: Spoiler package bomb787.vmm.util; public interface IHasModel { public void registerModels(); } Item Base: Spoiler package bomb787.vmm.items; import bomb787.vmm.Main; import bomb787.vmm.init.ItemInit; import bomb787.vmm.proxy.ClientProxy; import bomb787.vmm.util.IHasModel; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ItemBase extends Item implements IHasModel{ public ItemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MATERIALS); ItemInit.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } } ItemInit: Spoiler package bomb787.vmm.init; import java.util.ArrayList; import java.util.List; import bomb787.vmm.items.ItemBase; import net.minecraft.item.Item; public class ItemInit { public static final List<Item> ITEMS = new ArrayList<Item>(); public static final Item NewLHLogo = new ItemBase("LH_new"); } Am I doing something wrong? I'm following this as the tutorial:
December 5, 20186 yr Well for starters I can tell you that this tutorial is total BS if only because it claims that it works for 1.13 right there in the title... Forge for 1.13 isn't out yet. How can the author be so sure that it will work for forge that isn't out yet is beyound me. Likely it is just there as clickbait. You should never follow a coding tutorial that uses clickbait. 11 minutes ago, Bomb787 said: Common Proxy: CommonProxy makes no sense. Proxies exist to separate sided-only code. If your code is common it goes anywhere but your proxy. 11 minutes ago, Bomb787 said: IHasModel IHasModel is stupid. All items need models, no exception, and nothing about model registration needs access to private/protected data. Register your models directly in the ModelRegistryEvent. 12 minutes ago, Bomb787 said: Item Base ItemBase is an antipattern. There is already ItemBase, it's called Item. 12 minutes ago, Bomb787 said: public static final Item NewLHLogo = new ItemBase("LH_new"); Don't ever use static initializers. Instantinate your stuff directly in the registry event. Do you see why this tutorial is crap? Literally everything it told you to do is wrong and now you have to redo everything. Congratulations, this tutorial just wasted a bunch of your time! As for the actual issue: Registry names must be entirely lower-case
December 5, 20186 yr Author What would be a good tutorial for me to follow? 1.7.10 is the only version I've made a mod for.
December 8, 20186 yr A bit of self-promotion, but I’ve been working on a tutorialish thing for a while now. You might want to use it. You should definitely read through the README at least as it has a bunch of useful information and links to other tutorials. https://github.com/Cadiboo/Example-Mod About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.github.io/tutorials Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support. When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible. Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)
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.