#Fake Durability Attribute

27 messages · Page 1 of 1 (latest)

night thorn
#

I really want to make a this attribute for Quark's Tooltip Effect, i did make a moon phase based attribute before but idk about durability.

unkempt sableBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

night thorn
#

i found a refrence

night thorn
#

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)
  }
#

idk if i should use getitemstack or itemstack

viscid tusk
#

Using methods is safer than using beans

night thorn
#

ok then

viscid tusk
#

It's up to you, if you are certain no shenanigans are going on in subclasses then go ahead and use beans

#

If a bean causes unexplainable behavior, use method

night thorn
#

got it 🫡

night thorn
#

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?

night thorn
alpine baneBOT
#

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.

night thorn
#

opps