Jump to content

Render broken on side of ItemStack by using ItemLayerModel


Recommended Posts

This is what ItemStack look now.




All the thing in the front and back of ItemStack rendered correctly, but when holding in hand, you'll see the every side of this ItemStack is broken.


Repo is here

The code closely related with model is under meal folder


I used a custom Loader, IModelGeometry and ItemOverrideList.

My goal is select what textures to use by overriding ItemOverrideList#getModelWithOverrides

And at the final of method I directly using ItemLayerModel to bake a new model.To stack textures together is actually what I want.

public IBakedModel getModelWithOverrides(IBakedModel model, ItemStack stack, @Nullable World worldIn, @Nullable LivingEntity entityIn){
	IBakedModel returnModel = model;
	if(stack.getItem() instanceof Meal){
		CompoundNBT nbt = stack.hasTag() ? stack.getTag() : new CompoundNBT();

		List<Material> textures = new ArrayList<Material>();

			ListNBT list = (ListNBT)nbt.get("ingredients");
			for(INBT ele : list){
				CompoundNBT element = (CompoundNBT)ele;
		returnModel = new ItemLayerModel(ImmutableList.copyOf(textures))
			.bake(this.owner, this.bakery, this.spriteGetter, this.modelTransform, this.overrides, this.modelLocation);
	return returnModel;


It success, the three thing in the item frame is the same Item "salad" with different CompoundNBT.

But as the title, the side of this item is broken.

I tried using ItemLayerModel#getQuadsForSprites before, but every thing is the same, including which little square surface is missiing.


Someone has any idea?

Link to comment
Share on other sites

  • 3 weeks later...

OK, because nobody reply me, so I tried to generate quads by my own code.

Repo is here


But I got another problem.


Now everything looks fine when stack is in item frame or dropped on the ground, the side quads is not missing.

They are in the right place with right color.





But when on the left/right hand of first person camera, the side quads missing.

BTW, stack in third person camera looks fine.



I don't know where I did it wrong....and it confuse me why only first person camera will get this problem.

I think I did something wrong when processing Model Transform, but I can't find it.?




I found that if right hand is empty or holding a block, stack in left hand will render correctly, otherwise not.

How strange it is......I'm really confused.....




Ok.....I found problem and it fixed now.

Only y need to be subtracted by 1 like (1 - y).

But z doesn't need to do this.....

Everything is fine now, and I plan to make catch of the baked quads next, since it won't change after a stack is made.


Edited by immortalmice
Update info
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.

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.


  • Create New...

Important Information

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