Mais il y a rien qui y ressemble , sinon voila la class ArmorItem :
public class ArmorItem extends Item {
private static final UUID[] ARMOR_MODIFIERS = new UUID[]{UUID.fromString("845DB27C-C624-495F-8C9F-6020A9A58B6B"), UUID.fromString("D8499B04-0E66-4726-AB29-64469D734E0D"), UUID.fromString("9F3D476D-C118-4544-8365-64846904B48E"), UUID.fromString("2AD3F246-FEE1-4E67-B886-69FD380BB150")};
public static final IDispenseItemBehavior DISPENSER_BEHAVIOR = new DefaultDispenseItemBehavior() {
protected ItemStack dispenseStack(IBlockSource p_82487_1_, ItemStack p_82487_2_) {
ItemStack itemstack = ArmorItem.dispenseArmor(p_82487_1_, p_82487_2_);
return itemstack.isEmpty() ? super.dispenseStack(p_82487_1_, p_82487_2_) : itemstack;
}
};
protected final EquipmentSlotType slot;
protected final int damageReduceAmount;
protected final float toughness;
protected final IArmorMaterial material;
public static ItemStack dispenseArmor(IBlockSource p_185082_0_, ItemStack p_185082_1_) {
BlockPos blockpos = p_185082_0_.getBlockPos().offset((Direction)p_185082_0_.getBlockState().get(DispenserBlock.FACING));
List<LivingEntity> list = p_185082_0_.getWorld().getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB(blockpos), EntityPredicates.NOT_SPECTATING.and(new ArmoredMob(p_185082_1_)));
if (list.isEmpty()) {
return ItemStack.EMPTY;
} else {
LivingEntity livingentity = (LivingEntity)list.get(0);
EquipmentSlotType equipmentslottype = MobEntity.getSlotForItemStack(p_185082_1_);
ItemStack itemstack = p_185082_1_.split(1);
livingentity.setItemStackToSlot(equipmentslottype, itemstack);
if (livingentity instanceof MobEntity) {
((MobEntity)livingentity).setDropChance(equipmentslottype, 2.0F);
((MobEntity)livingentity).enablePersistence();
}
return p_185082_1_;
}
}
public ArmorItem(IArmorMaterial p_i48534_1_, EquipmentSlotType p_i48534_2_, Properties p_i48534_3_) {
super(p_i48534_3_.defaultMaxDamage(p_i48534_1_.getDurability(p_i48534_2_)));
this.material = p_i48534_1_;
this.slot = p_i48534_2_;
this.damageReduceAmount = p_i48534_1_.getDamageReductionAmount(p_i48534_2_);
this.toughness = p_i48534_1_.getToughness();
DispenserBlock.registerDispenseBehavior(this, DISPENSER_BEHAVIOR);
}
public EquipmentSlotType getEquipmentSlot() {
return this.slot;
}
public int getItemEnchantability() {
return this.material.getEnchantability();
}
public IArmorMaterial getArmorMaterial() {
return this.material;
}
public boolean getIsRepairable(ItemStack p_82789_1_, ItemStack p_82789_2_) {
return this.material.getRepairMaterial().test(p_82789_2_) || super.getIsRepairable(p_82789_1_, p_82789_2_);
}
public ActionResult<ItemStack> onItemRightClick(World p_77659_1_, PlayerEntity p_77659_2_, Hand p_77659_3_) {
ItemStack itemstack = p_77659_2_.getHeldItem(p_77659_3_);
EquipmentSlotType equipmentslottype = MobEntity.getSlotForItemStack(itemstack);
ItemStack itemstack1 = p_77659_2_.getItemStackFromSlot(equipmentslottype);
if (itemstack1.isEmpty()) {
p_77659_2_.setItemStackToSlot(equipmentslottype, itemstack.copy());
itemstack.setCount(0);
return new ActionResult(ActionResultType.SUCCESS, itemstack);
} else {
return new ActionResult(ActionResultType.FAIL, itemstack);
}
}
public Multimap<String, AttributeModifier> getAttributeModifiers(EquipmentSlotType p_111205_1_) {
Multimap<String, AttributeModifier> multimap = super.getAttributeModifiers(p_111205_1_);
if (p_111205_1_ == this.slot) {
multimap.put(SharedMonsterAttributes.ARMOR.getName(), new AttributeModifier(ARMOR_MODIFIERS[p_111205_1_.getIndex()], "Armor modifier", (double)this.damageReduceAmount, Operation.ADDITION));
multimap.put(SharedMonsterAttributes.ARMOR_TOUGHNESS.getName(), new AttributeModifier(ARMOR_MODIFIERS[p_111205_1_.getIndex()], "Armor toughness", (double)this.toughness, Operation.ADDITION));
}
return multimap;
}
public int getDamageReduceAmount() {
return this.damageReduceAmount;
}
public float getToughness() {
return this.toughness;
}
}