#Custom Kubejs Attribute Not Working

15 messages · Page 1 of 1 (latest)

worn oracle
#

I used a script that creates an attribute but when using /attribute while wearing an item that has the attribute returns null?

midnight zincBOT
#

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

worn oracle
#

its based of this

#
ForgeEvents.onEvent("net.minecraftforge.event.entity.living.LivingHurtEvent", event => global.hurt(event))
/**
 *
 * @param {Internal.LivingHurtEvent} event
 */
global.hurt = event => {
    // Sculk Script
    let {entity,source,amount} = event
    let attacker = source.actual
    let bulletsources = [
        "jeg.bullet.killed",
        "jeg.bullet.eliminated",
        "jeg.bullet.annihilated",
        "jeg.bullet.executed",
        "jeg.bullet.decimated"

    ]
    if (bulletsources.includes(source.getType())) {
        if (!attacker) return
            let pazazz = (attacker.attributes.getValue("jeg:generic.gun_damage"));
            //event.setAmount((amount * pazazz))
            if (pazazz > 0){
            event.setAmount((amount * pazazz))
            attacker.tell("PAINPOWER: " + pazazz + ", DAMAGE: " + amount + ", FINALDAMAGE: " + (amount * pazazz))
            }
    }
}
#

switching the attirbute with generic.armor fixes this and the custom attribute "jeg:generic.gun_damage" does not return any value at all

#

the script acts like a generic damage script or the arrow attribute mod

#

but for these damage sources

worn oracle
polar basinBOT
#

Paste version of message.txt from @worn oracle

worn oracle
#

x(

#

i tried /attribute @p jeg:generic.gun_damage get

#

did not get any value

#
let $RangedAttribute = Java.loadClass('net.minecraft.world.entity.ai.attributes.RangedAttribute')
StartupEvents.registry('attribute', event => {
    // first number is default value, second is min, third is max
    event.createCustom('jeg:generic.gun_damage', () => new $RangedAttribute('attribute.kubejs.test_attribute', 0.0, 0.0, 10.0))
})
worn oracle
#

It's actually fixed due to an example script