Bomb787 0 Report post Posted December 5, 2018 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: Share this post Link to post Share on other sites
V0idWa1k3r 308 Report post Posted December 5, 2018 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 Share this post Link to post Share on other sites
Bomb787 0 Report post Posted December 5, 2018 What would be a good tutorial for me to follow? 1.7.10 is the only version I've made a mod for. Share this post Link to post Share on other sites
Cadiboo 148 Report post Posted December 8, 2018 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 Share this post Link to post Share on other sites