Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.12.2] Item texture is black and purple cube
The update for 1.13 is being worked on - please be patient. (Updated 02/19/19)
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 2
Bomb787

[1.12.2] Item texture is black and purple cube

Started by Bomb787, December 5, 2018

4 posts in this topic

Bomb787    0

Bomb787

Bomb787    0

  • Tree Puncher
  • Bomb787
  • Members
  • 0
  • 6 posts
  • 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

V0idWa1k3r

V0idWa1k3r    308

  • World Shaper
  • V0idWa1k3r
  • Members
  • 308
  • 1443 posts
  • 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

Bomb787

Bomb787    0

  • Tree Puncher
  • Bomb787
  • Members
  • 0
  • 6 posts
  • 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

Cadiboo

Cadiboo    148

  • World Shaper
  • Cadiboo
  • Members
  • 148
  • 2141 posts
  • 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 2
Go To Topic Listing Modder Support

  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Laike_Endaril
      Unresolved reference: minecraftforge

      By Laike_Endaril · Posted 25 minutes ago

      Are you on 1.12 or 1.13?

      On 1.12 the first task to run is setupDecompWorkspace (after importing the build.gradle). On 1.13 I think the standard setup is just importing the build.gradle?  Correct me if I'm wrong; still working 1.12 myself.   I have 0 exp. with Forgelin / Kotlin so I can't directly help with any java/kotlin differences.
    • Laike_Endaril
      Error compiling

      By Laike_Endaril · Posted 38 minutes ago

      Can you post the contents of your build.gradle file?
    • Laike_Endaril
      [1.12.2] Block Item Missing from Custom Creative Tab

      By Laike_Endaril · Posted 41 minutes ago

      I'm just now finally getting around to adding blocks/items for the first time, and for some reason I cannot get the item for my block into my creative tab. The creative tab exists with the correct icon, and the item itself can be obtained with /give (and has no issues)   Main suspects in my eyes are the registry handler class...     ...and the item class...     ...and here's a link to the repo:
      https://github.com/Laike-Endaril/Wardstones/tree/1.12.2/src/main/java/com/fantasticsource/wardstones
    • Laike_Endaril
      Adding texture for Barrier Blocks?

      By Laike_Endaril · Posted 1 hour ago

      Usually you can completely replace a block by registering a new block over it.  It could be worth trying to extend the original BlockBarrier class and register your new class with the same registry name as the old one.   This is basically how I made a fire customization mod; by extending and replacing the vanilla fire block.
    • Cadiboo
      Server Crashing on Startup; Missing mod 1.6.0

      By Cadiboo · Posted 1 hour ago

      247 mb hasn’t been enough ram for minecraft since about 1.2 Vanilla. I recommend 3gb
  • Topics

    • fieldbox
      1
      Unresolved reference: minecraftforge

      By fieldbox
      Started 9 hours ago

    • Osito13
      1
      Error compiling

      By Osito13
      Started 5 hours ago

    • Laike_Endaril
      0
      [1.12.2] Block Item Missing from Custom Creative Tab

      By Laike_Endaril
      Started 42 minutes ago

    • Ankh
      1
      Adding texture for Barrier Blocks?

      By Ankh
      Started Yesterday at 04:06 AM

    • Rjh1998
      8
      Server Crashing on Startup; Missing mod 1.6.0

      By Rjh1998
      Started 8 hours ago

  • Who's Online (See full list)

    • TheRPGAdventurer
    • V0idWa1k3r
    • ItHurtsLikeHell
    • izako
    • Flemmli97
    • desht
    • PigeonDamigion
    • Melonslise
    • ButterAleks
    • Cornspies
    • Laike_Endaril
    • LiteralyPotato
    • hiotewdew
    • DinoPawz
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.12.2] Item texture is black and purple cube
  • Theme
  • Contact Us

Copyright © 2017 ForgeDevelopment LLC Powered by Invision Community