Jump to content

[1.11.2] missing texture of a vanilla item.


salvestrom

Recommended Posts

this was brought to my attention for the 1.11.2 version of my mod, but is present in the 1.9 and 1.10 version, too (but not the 1.7).

the vanilla item written book, that is a book that has been signed, has a missing texture. there are no errors on load.

the mod has a series of pre-written books, that use the book_written texture without issue. giving them their own texture did not resolve the issue.

 

i'm not wholly sure what you guys are going to want to see code wise, but below is the item file. the setup of the file is very old - something i found online over two years ago. extending Item instead of ItemWrittenBook does nothing to resolve the issue. I gutted the book text for posting convenience. also note that this code is the 1.10 version so file names can still have capitals.

 

Spoiler

public class bookScale extends ItemWrittenBook {
	
	public static ItemStack eastScale;
	public static ItemStack westScale;
	public static ItemStack northScale;
	public static ItemStack southScale;
	
	public bookScale(Item item) 
    {
		 super();
	    	this.setUnlocalizedName("bookScale");
	    	this.setContainerItem(this);
	    	this.setCreativeTab(w2theJungle.JungleModTab);
	    	this.setHasSubtypes(true);
    }
	
	{
		{		
        
		eastScale = new ItemStack(Items.WRITTEN_BOOK);
		eastScale.setItemDamage(367);
		
    	NBTTagCompound tag = new NBTTagCompound();
    	eastScale.setTagCompound(tag);
	    		
		tag.setString("author", ("Salvestrom"));
		tag.setString("title", ("The Books of Scale: The Bringer"));
		NBTTagList bookPages = new NBTTagList();
		tag.setTag("pages", bookPages);
	}
	{
		westScale = new ItemStack(Items.WRITTEN_BOOK);
		NBTTagCompound wtag = new NBTTagCompound();
		westScale.setTagCompound(wtag);
	    westScale.setItemDamage(368);

	    NBTTagList westPages = new NBTTagList();
	    wtag.setTag("pages", westPages);
		wtag.setString("author", ("Salvestrom"));
		wtag.setString("title", ("The Books of Scale: The Taker"));
	}
	{
		northScale = new ItemStack(Items.WRITTEN_BOOK);
		
		NBTTagCompound ntag = new NBTTagCompound();

		northScale.setTagCompound(ntag);
	    northScale.setItemDamage(369);
		
		ntag.setString("author", ("Salvestrom"));
		ntag.setString("title", ("The Books of Scale: The Shield"));
		NBTTagList northPages = new NBTTagList();
	    ntag.setTag("pages", northPages);
	}
	
	{
		southScale = new ItemStack(Items.WRITTEN_BOOK);
		NBTTagCompound stag = new NBTTagCompound();
		
		southScale.setTagCompound(stag);
	    southScale.setItemDamage(370);
	    
		NBTTagList southPages = new NBTTagList();

		stag.setTag("pages", southPages);
		stag.setString("author", ("Salvestrom"));
		stag.setString("title", ("The Books of Scale: The Sword"));
		}
	}

	@SuppressWarnings({"rawtypes", "unchecked"})
    @Override
	@SideOnly(Side.CLIENT)
	public void getSubItems(Item i, CreativeTabs c, List<ItemStack> list) {
		list.add(bookScale.eastScale);
	 	list.add(bookScale.westScale);
	 	list.add(bookScale.northScale);
	 	list.add(bookScale.southScale); 
	 	}
}

 

 

to my untrained eyes, nothing stands out from the render registering that should prevent the game from using a vanilla texture for a vanilla item. again, i stress, there is no issue with rendering my mod item, but something in my code is preventing minecraft from applying a vanilla texture to the vanilla written book.

 

Spoiler

this is from the render registry file:

	registerRender(JungleItems.bookScales);
	
	registerRenderWithMeta("east_scale", bookScale.eastScale.getMetadata(), bookScale.eastScale.getItem());
	registerRenderWithMeta("west_scale", bookScale.westScale.getMetadata(), bookScale.westScale.getItem());
	registerRenderWithMeta("north_scale", bookScale.northScale.getMetadata(), bookScale.northScale.getItem());
	registerRenderWithMeta("south_scale", bookScale.southScale.getMetadata(), bookScale.southScale.getItem());


	@SideOnly(Side.CLIENT)
	public static void registerRenderWithMeta(String string, int i, Item item)
	{
        ModelLoader.setCustomModelResourceLocation(item, i, new ModelResourceLocation(References.MODID + ":" + string, "inventory"));
	}

 

 

Link to comment
Share on other sites

If a texture is missing, then there should be a warning on load, but it may only show in the log file, not console output.

 

Post the client log file (not console output) and JSON files. Also: Clearly describe what you expected to see and what you actually saw (a pic might be helpful).

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

I looked over the client log. there's nothing about a missing texture. but then, i don't think the texture is missing, exactly. let me explain again:

if you use the vanilla edittable book, sign it to create a written book, that item has a missing texture. i know that there's something in my mod thats causing this - the issue is in 3 seperate minecraft versions and a new mod i started doesn't have this issue. my mod has 4 pre-written books which all work and have textures, but somwhere in this code its causing the vanilla written books to appear textureless.

Link to comment
Share on other sites

20 hours ago, salvestrom said:

i know that there's something in my mod thats causing this

In that case, you'll need to set a breakpoint in the vanilla renderer and step through until you spot the interference.

20 hours ago, salvestrom said:

somwhere in this code its causing the vanilla written books to appear textureless

BTW, What does that even mean? You still haven't given us a pic, so we don't know what you are seeing. "Textureless" has no meaning. Are you seeing the purple and black checker pattern (the "missing" texture)? Or are you seeing something else (e.g. plain unwritten book, or untextured model polygons)?

 

Get yourself into the debugger to find out what's happening.

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

i referred to it as a missing texture several times. calling it the missing texture texture, or "missing" texture seemed superfluous :P anyway, yes, black and purple.

 

so, this is from my op:

registerRender(JungleItems.bookScales);

 

registerRenderWithMeta("east_scale", bookScale.eastScale.getMetadata(), bookScale.eastScale.getItem()); registerRenderWithMeta("west_scale", bookScale.westScale.getMetadata(), bookScale.westScale.getItem()); registerRenderWithMeta("north_scale", bookScale.northScale.getMetadata(), bookScale.northScale.getItem()); registerRenderWithMeta("south_scale", bookScale.southScale.getMetadata(), bookScale.southScale.getItem());

 

the above is part of the cause. bookscale.eastscale.getitem is actually returning the vanilla item item.written_book. if i change it to:

 

registerRenderWithMeta("east_scale", bookScale.eastScale.getMetadata(), JungleItems.bookScales);      registerRenderWithMeta("west_scale", bookScale.westScale.getMetadata(), JungleItems.bookScales);        registerRenderWithMeta("north_scale", bookScale.northScale.getMetadata(), JungleItems.bookScales);        registerRenderWithMeta("south_scale", bookScale.southScale.getMetadata(), JungleItems.bookScales);
        

then the vanilla written books get their textures back. however, the mod books lose theirs. i'm wondering if i need to split the bookscale class into 4 seperate classes for each book. but then, if that was going to work i would expect the south-scale, ie, the last book registered to have its texture, which it doesn't..

 

Link to comment
Share on other sites

On 4/14/2017 at 9:55 AM, diesieben07 said:

Debugging this with just snippets of code is difficult. Please post a working Git repo of your mod.

As requested:

https://github.com/salvestrom/thejungle

 

This link is for 1.10.2 code. the issue exists in 3 different versions. One solution should correct them all. You will find that the method for adding subtypes to the bookScale item class and the itemrender class where the books get added have multiple variations, none of which have worked. the best result is still the original version in the op.

 

I'm not sure there's anyway around it.

Edited by salvestrom
add:
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.