immortalmice Posted March 18, 2020 Posted March 18, 2020 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. @Override 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>(); textures.add(this.materials.get("base")); if(nbt.contains("ingredients")){ ListNBT list = (ListNBT)nbt.get("ingredients"); for(INBT ele : list){ CompoundNBT element = (CompoundNBT)ele; textures.add(this.materials.get(element.getString("name"))); } } 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? Quote
immortalmice Posted April 6, 2020 Author Posted April 6, 2020 (edited) 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.? ================================== UPDATE 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. thx. Edited April 6, 2020 by immortalmice Update info Quote
Recommended Posts
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.