#Fake Durability Attribute
27 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
Proof Of concept
onst duraTooltips = new $AttributeModifier(
"ced44d1a-cb27-403b-bee4-7989cd4d6d85",
"minecraft:durability",
1,
"ADDITION"
)
global.durabilityTooltips = event => {
let Damage = (event.itemStack.nbt.get("Damage")) || 0
if (Damage <= 0) return
event.addModifier("minecraft:durability", duraTooltips)
}
i made the minecraft:durability fake attribute btw
my probejs is not probing so i cant really @param this
i wanna minus the damage with max damage to get the current durability but how?
oh i forogt i have the source code
wait my proof of concept is not done yet :/
Maybe i need to test it
global.durabilityTooltips = event => {
let {itemStack} = event
let MaxDamage = (itemstack.getMaxDamage())
let Damage = (itemstack.getDamageValue()) || 0
let duraTooltips = new $AttributeModifier("ced44d1a-cb27-403b-bee4-7989cd4d6d85", "minecraft:durability", (MaxDamage - Damage), "ADDITION")
if (Damage <= 0) return
event.addModifier("minecraft:durability", duraTooltips)
}
declaration: package: net.minecraftforge.event, class: ItemAttributeModifierEvent
idk if i should use getitemstack or itemstack
Using methods is safer than using beans
ok then
It's up to you, if you are certain no shenanigans are going on in subclasses then go ahead and use beans
https://discordapp.com/channels/303440391124942858/1485749157376557116
Be watchful of traps like this one
If a bean causes unexplainable behavior, use method
got it 🫡
it works yippie but i need to check the slot somehow
if ($EquipmentSlot.CHEST || $EquipmentSlot.FEET || $EquipmentSlot.MAINHAND || $EquipmentSlot.OFFHAND || $EquipmentSlot.LEGS || $EquipmentSlot.CHEST) return
i have this but i dont know what to use it for
stack != $EquipmentSlot.CHEST?
merging this into https://discord.com/channels/303440391124942858/1489762747112620155
Please close your ticket (with </ticket close:1054771505520717835> or the button atop this thread) once you resolved your issue!
This also helps others that would like to help out, as they don't have to look into this thread to check if it has been resolved by now.
Do you have any other questions regarding your issue? Feel free to ask!
Note: You should create a new post for unrelated issues.
opps