Jump to content

[1.12.2] Missing Texture or didn't display


XpresS

Recommended Posts

Hi community, I am there a new member. I wants start something new about java and get the news experiences.
But I came across the "error". I spent my 3 hours to get the solutions but I couldnt find it.

I had this problem
https://imgur.com/a/8GdLRQO

Log of starting Minecraft:
https://pastebin.com/W49B6Y6e/?e=1

I did it by this tutorial: https://www.youtube.com/watch?v=rQLhheYcnrY&t=1485s
This thins him work.

I try it 2 times created 2 projects and I had the same problem.

Thanks for help and get solution for this :)

Link to comment
Share on other sites

9 minutes ago, XpresS said:

Ugh, another crappy youtube tutorial. I've watched a total of 10 seconds of it and I immediately saw the CommonProxy, IHasModel, static initializers and ItemBase. No, thanks. In general youtube tutorials are pretty bad, don't rely on them. I have yet to see at least an okay modding tutorial on youtube. They teach you all the things not to do so I am not surprized you are encountering issues.

 

 As for your issue - I see no errors in the log which likely means that you've not registered a model for your items in the first place but I can't tell for sure since you've shown zero code. So could you please provide some of your code so we can inspect it for issues?

Link to comment
Share on other sites

Quote

CommonProxy

A concept of a common proxy makes no sense. Proxies exist to separate sided only code. If your code is "common" then it goes into your mod class, not into your proxy.

 

serverSide = Reference.COMMON_PROXY_CLASS

This makes even less sense. Server proxy either hosts noop methods that are only applicable for the client or server-side only methods. Your common proxy can't be your server proxy.

 

ItemBase is an antipattern. You do not need it.

 

public static final Item RUBY = new ItemBase("ruby", CreativeTabs.MATERIALS);

Don't ever use static initializers. Instantinate your stuff in the appropriate registry event.

 

Quote

implements IHasModel

IHasModel is stupid. All items need models, no exception and there is nothing about an item model that requires access to private/protected things. Register your models directly in the ModelRegistryEvent, not in your item classes.

 

What is up with your ruby.json model? Why are there so many transforms specified? Why is it's parent a item/handheld? 

 

Main.proxy.registerItemRenderer(this, 0, "invetory");

invetory != inventory. Actually also related and the cause of your issue:

 

public class CommonProxy{

	public void registerItemRenderer(Item item, int meta, String id) {}
}
public class ClientProxy extends CommonProxy{

	public void regsterItemRenderer(Item item, int meta, String id) {
		ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id));
	}
}

regsterItemRenderer != registerItemRenderer. This is why you

a) Never use a CommonProxy but instead an interface.

b) Never manually override methods and use the override feature of your IDE

c) Always annotate methods that are intended to be overridden with @Override

 

As an unrelated sidenote:

21 minutes ago, XpresS said:

Any particular reason you've hosted your code on mediafire of all places? You can just create a free github repository, you know?

 

21 minutes ago, XpresS said:

Are there some function tutorial, where I can learn more about Forge ?

 

  • Like 1
Link to comment
Share on other sites

26 minutes ago, V0idWa1k3r said:

What is up with your ruby.json model? Why are there so many transforms specified? Why is it's parent a item/handheld? 

I thinked ruby.json has been wrong. I tried more format of these thing.

 

26 minutes ago, V0idWa1k3r said:

invetory != inventory. Actually also related and the cause of your issue:

Yeah its my wrong. :/:) 
 

 

26 minutes ago, V0idWa1k3r said:

Never use a CommonProxy but instead an interface.

I agree with you, when you know this tutorial is totaly bullshit I will find another.

 

26 minutes ago, V0idWa1k3r said:

Never manually override methods and use the override feature of your IDE

I didnt override methors manually its do eclipse. 

 

26 minutes ago, V0idWa1k3r said:

Any particular reason you've hosted your code on mediafire of all places? You can just create a free github repository, you know?

I tried it but, I didnt learn more about it, but I had github :D

Thanks for get solutions and oriantate on good way. I will find another tutorials.

I am looking on this but i didnt understands of these tutorials how on to.
https://mcforge.readthedocs.io/en/latest/concepts/registries/#registering-things

I must have how to on and get instructions step by step. 

Edited by XpresS
EDITED//
Link to comment
Share on other sites

I got some bad code I didnt know why Its working can you explain me or repair ?

public class ItemBase extends Item{

	public ItemBase(String name) {
		this.setUnlocalizedName(name);
		this.setRegistryName(name);
		
		ModItems.ITEMS.add(this);
	}
	
	public ItemBase creativeTab(CreativeTabs tab) {
		this.creativeTab(tab);
		return this;		
	}
}


 

public final class ModItems {

	public static List<Item> ITEMS = new ArrayList<Item>();
	
	public static final Item RED_COAL = new ItemBase("redCoal").creativeTab(CreativeTabs.MATERIALS);
	
	@EventBusSubscriber
	public static class RegistrationHandler {
		@SubscribeEvent
		public static void registerItems(RegistryEvent.Register<Item> e) {
			e.getRegistry().registerAll(ITEMS.toArray(new Item[0]));
			IForgeRegistry<Item> registry = e.getRegistry();
			for(Item item : ITEMS) {
				registry.register(item);
				ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName()));
				System.out.println("Done registering: " + item.getUnlocalizedName() +"...");
			}
		}
	}
}


Error Log: https://pastebin.com/Uv30at7M

I searched on google as  Can not register to a locked registry. Modder should use Forge Register methods.
but I couldnt find solution.

I inspirated by https://github.com/Choonster-Minecraft-Mods/TestMod3/blob/2cb7b67adf7ab41e066c3308ac898224b2891752/src/main/java/choonster/testmod3/init/ModItems.java
Somebody on this forum post this link. 

Link to comment
Share on other sites

Why are you registering models in the Register<Items> event?

There's a ModelRegistryEvent for a reason

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

12 minutes ago, XpresS said:

public static final Item RED_COAL = new ItemBase("redCoal").creativeTab(CreativeTabs.MATERIALS);

2 hours ago, V0idWa1k3r said:

Don't ever use static initializers. Instantinate your stuff in the appropriate registry event.

 

13 minutes ago, XpresS said:

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName()));

This is client-side only and thus can't be used in common code otherwise you will crash the server. In any case this needs to happen in the ModelRegistryEvent, not anywhere else.

 

13 minutes ago, XpresS said:

e.getRegistry().registerAll(ITEMS.toArray(new Item[0]));

13 minutes ago, XpresS said:

for(Item item : ITEMS) { registry.register(item);

You are registering your items twice.

 

As for the error:

Quote

at sk.xpress.prisonthings.Main.PreInit(Main.java:20)

Whatever you are doing in your PreInit method in your main class crashes the game. I can't tell you what you are doing because you've not provided the code needed. But from the stacktrace it looks like you are calling the Item.registerItems method for god knows what reason.

  • Thanks 1
Link to comment
Share on other sites

Okay I forgot for something in PreInit, my wrong.
 

23 minutes ago, V0idWa1k3r said:

Don't ever use static initializers. Instantinate your stuff in the appropriate registry event.


 

public final class ModItems {

    public static List<Item> ITEMS = new ArrayList<Item>();
    
    @EventBusSubscriber
    public static class RegistrationHandler {
        @SubscribeEvent
        public static void registerItems(RegistryEvent.Register<Item> e) {

        Item RED_COAL = new ItemBase("redCoal");
       Item ...
            e.getRegistry().registerAll(ITEMS.toArray(new Item[0]));
            for(Item item : ITEMS) {
                ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), null));
                System.out.println("Done registering: " + item.getUnlocalizedName() +"...");
            }
        }
    }
}

You think these item initializers or what ?

 

23 minutes ago, V0idWa1k3r said:

This is client-side only and thus can't be used in common code otherwise you will crash the server. In any case this needs to happen in the ModelRegistryEvent, not anywhere else.

And how can I register the item for server-side ?

Thanks to much for helping :)

Edited by XpresS
Link to comment
Share on other sites

4 minutes ago, XpresS said:

And how can I register the item for server-side ?

Did you see what I've quoted? I didn't quote the item registration, I quoted this line

4 minutes ago, XpresS said:

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), null));

This is client side only and must happen in the ModelRegistryEvent. This line has nothing to do with item registration, it registeres a model for the item.

 

Item RED_COAL = new ItemBase("redCoal");
Item ...
e.getRegistry().registerAll(ITEMS.toArray(new Item[0]));

The issue with this approach is that the registry can't be dynamically reloaded now since you never clear the list. It is not a problem *now* but it is nonetheless an issue. As an example here is me registering items in one of my mods. As you can clearly see I do not use any kind of a list or anything to hold my items in. In fact I don't and just use ObjectHolders to get the reference to my items when I need it.

Link to comment
Share on other sites

5 minutes ago, XpresS said:

You think these item initializers or what ?

No, a static initializer is when you call new in a place that is static.

 

Like this:

public static final Item RED_COAL = new ItemBase("redCoal").creativeTab(CreativeTabs.MATERIALS);

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

9 minutes ago, Draco18s said:

No, a static initializer is when you call new in a place that is static.

Hmm... Thanks

Now, I writed something 
 

	@EventBusSubscriber
	public static class RegistrationHandler {
		@SubscribeEvent
		public static void registerItems(RegistryEvent.Register<Item> e) {
			
			e.getRegistry().register(new ItemBase("redCoal"));
			e.getRegistry().register(new ItemBase("ruby"));
		
		//--->	ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
			
		}
	}

But now How will I load texture for items ? ( ModelLoader
 

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.