#Item disabled instead of breaking
7 messages · Page 1 of 1 (latest)
I haven't touched armor items yet but looking at the Elytra the code has an isUsable method in the ElytraItem class: public static boolean isUsable(ItemStack stack) { return stack.getDamage() < stack.getMaxDamage() - 1; }
Yah I saw that too. But the only place that it is used is in the player entity and living entity classes, to determine if the player can “fall fly” and if not the durability is halted from the fact that you cannot fly anymore.
But armor is weird since the damage is simply from taking damage while wearing it.
I do not even know for sure where the durability damage is dealt to the armor. Maybe I would mixin into that and disable the damage that way, but that seems clunky.
Mixins might be the way. It looks like there is the applyArmorToDamage method in the LivingEntity class that gets called when the the damage method gets called.
I would start with a custom damage handler through FabricItem
That looks like it might work. Would this be placed in the ArmorItem file as an inherited method or would it need to be in an interface that is implemented by the custom item.
I believe you set it up on the item settings?