Jump to content

[1.12.2] Item textures not loading for items that change texture with nbt data.


Recommended Posts

Posted

So, I'm working on implementing trading cards into the game, but I cant get my textures to load properly. I know it's an issue with trying to get multiple textures and models for one "item" as everything else works. In fact, the model that does get loaded at least half works as the back of the card render fine, see here.

I'm really lost here. Minecraft doesn't throw any errors. Can anyone help me out?

 

The relevant section of my main class:

	@EventHandler
	public static void preInit(FMLPreInitializationEvent event)
	{
		//CONFIG_DIRECTORY = Minecraft.g
		config = new Configuration(event.getSuggestedConfigurationFile());
		config_dir = event.getModConfigurationDirectory().getAbsolutePath();
		
		CardLoadingHandler.loadCardInfo();
		
		CardImages.init();
	}

 

My Item:

https://pastebin.com/bKePKbQr

 

My Custom Item Mesh:

https://pastebin.com/FwhjMjww

 

My Card ModelResourceLocation holding class

https://pastebin.com/Ck9ZYSxt

 

And my card collection class:

https://pastebin.com/vQASnk7k

Posted

And how do you register those models?

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.

Posted

So, Turns out I misspelled one of my interface methods. registerModel() when it should have been registerModels(). So, All the models loaded (i think) when I added this bit to the corrected method

public void registerModels()
	{
		//System.out.println("wdjlmnojvn");
		
	
			
			ModelBakery.registerItemVariants(this, 
					CardImages.CARD_MODELS.values().toArray(new ModelResourceLocation[CardImages.CARD_MODELS.size()]));
			
			ModelLoader.setCustomMeshDefinition(this, new CardItemMesh());
		
	}

However, Now the models are just... not the models they're supposed to be. They're now the default broken cube model. So not the "cube_all" model but this.

 

@Draco18s

Posted
23 hours ago, Mekelaina said:

interface

Is that IHasModel? Stop using it. It does nothing except make you retype the same lines over and over. All items need models, yes, ALL ITEMS which means that the interface is not special. Now if the interface is because the item has a custom mesh definition, that's fine (that's special).

 

23 hours ago, Mekelaina said:

not the models they're supposed to be

This means that the model you want isn't being registered and baked. This is common for custom mesh definition models.

 

This is the chunk I use:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/client/ClientEasyRegistry.java#L184-L195

(and a mesh definition: https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/industry/item/ItemCastingMold.java#L89 )

It looks like the code you posted should perform similar operations on the right data.

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.

Posted

@Draco18s THANK YOU SO MUCH! I got it to work thanks to your code. And yes, I agree IHasModel is a terrible way of doing this, but what it does is every block and item is added to an ArrayList upon initialization and then in my registry handler class ( I realize now I didn't link to this originally and I apologize) loops through each item, block, etc. and runs its corresponding initialization method. This is what registers my models as of rn:

 

	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event)
	{
		for(Item item : ModItems.ITEMS)
		{
			if(item instanceof IHasModel)
			{
				((IHasModel)item).registerModels();
			}
			
			
		}
		
		for(Block block : ModBlocks.BLOCKS)
		{
			if(block instanceof IHasModel)
			{
				((IHasModel)block).registerModels();
			}
		}
		
		
		
	//	ModItems.initSpecialModels();
	}

 

I set it up this way because that's how the tutorial I followed at the time did it. I realize this is a dumb setup and I'll go back and change it at some point, but this works for now. This mod project of mine is actually my first attempt at it and I'm trying to self-teach myself the more complex stuff of modding. I actually really like your registry class setup and will definitely take inspiration from it for the future! Again, TYSVM!

 

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.