Poulpinou Posted December 2, 2018 Posted December 2, 2018 (edited) I'm currently creating an armor with a custom model. Everything work fine, but I would like to make a part of the armor appear sonly if the player wears the full set. How can I do that? public class ItemCustomArmor extends ItemArmor { ... @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped _default) { if(!itemStack.isEmpty()) { if(itemStack.getItem() instanceof ItemArmor) { ModelBiped armorModel = getCustomArmorModel(0.0F, armorSlot, entityLiving); armorModel.setModelAttributes(_default); return armorModel; } } return null; } ... } public class ItemRaijinArmor extends ItemCustomArmor{ ... @Override public ModelBiped getCustomArmorModel(float scale, EntityEquipmentSlot slot, EntityLivingBase entityLiving) { return (ModelBiped)new ModelRaijinArmor(scale, slot); } ... } public class ModelRaijinArmor extends ModelBiped { private final EntityEquipmentSlot slot; private boolean fullSet = true; public ModelRenderer chestNecklace; public ModelRenderer flyA; public ModelRaijinArmor(float scale, EntityEquipmentSlot slot) { super(scale, 0, 64, 64); this.slot = slot; this.fullSet = ???????; switch (slot) { case CHEST: this.chestNecklace = new ModelRenderer(this, 0, 7); this.chestNecklace.setRotationPoint(0.0F, 0.0F, 0.0F); this.chestNecklace.addBox(-4.0F, 0.0F, -2.0F, 8, 5, 4, 0.1F); this.bipedBody = chestNecklace; if(this.fullSet) { this.flyA = new ModelRenderer(this, 45, 0); this.flyA.setRotationPoint(9.0F, 2.0F, 3.0F); this.flyA.addBox(-1.5F, -1.5F, 0.0F, 3, 3, 2, 0.0F); this.bipedBody.addChild(this.flyA); } default: break; } } @Override public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadyaw, float headPitch, float scaleFactor) { this.setVisible(false); switch (this.slot) { case CHEST: bipedBody.showModel = true; break; default: break; } super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadyaw, headPitch, scaleFactor); } } As you can see, I created a boolean fullSet that will take the value (isFullSet), but I don't know how to get this value... I would be glad to get some help! Edited December 2, 2018 by Poulpinou Quote
Animefan8888 Posted December 2, 2018 Posted December 2, 2018 9 hours ago, Poulpinou said: but I don't know how to get this value... Use Minecraft.getMinecraft().player To get an EntityPlayer instance since you are client side only this will work. Then you have to get the pieces of armor that the player is wearing there is a method for it and it takes in a EntityEquipmentSlot parameter. 1 Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
Poulpinou Posted December 2, 2018 Author Posted December 2, 2018 (edited) Thank you for your help! It works perfectly ? EDIT : I corrected following your advice. @Override public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadyaw, float headPitch, float scaleFactor) { this.setVisible(false); switch (this.slot) { case HEAD: bipedHead.showModel = true; if(entity instanceof EntityLivingBase) { EntityLivingBase playerCheck = (EntityLivingBase) entity; if(playerCheck.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem().equals(MillenaireItems.raijin_chestplate) && playerCheck.getItemStackFromSlot(EntityEquipmentSlot.LEGS).getItem().equals(MillenaireItems.raijin_leggings) && playerCheck.getItemStackFromSlot(EntityEquipmentSlot.FEET).getItem().equals(MillenaireItems.raijin_boots)) { bipedBody.showModel = true; } } break; default: break; } super.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadyaw, headPitch, scaleFactor); } Edited December 2, 2018 by Poulpinou 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.