#applying attributes to modded items.

18 messages · Page 1 of 1 (latest)

silver rover
#

so i have the following code which is intended to assign attributes to a few items. this method of applying these attributes worked just fine in my test case with a diamond sword (image attached of it working) that i used to prove the theory. so I'm not sure if this even should work at this point. asking here in case theirs something obvious im missing or some known weirdness with items added by mods, I specifically turned to this method because of load order weirdness and not being able to just add these via the mods config which allows controlling their item attributes, but obviously can't apply an attribute that hasn't been loaded yet. ultimately any ideas on why this isn't working would be appriecated.

ItemEvents.modification(event => {
    //Netherite Aqua Robes
    event.modify(`elemental_wizards_rpg:netherite_kelp_head`, item => {
        item.addAttribute("rpgmana:manaregen", "5c75f51a-3932-4379-abeb-ab3aa724a18f", "mana regen", 8, "addition")
        item.addAttribute("rpgmana:mana", "5fd5025c-5894-4bdb-be4b-2c14880dd707","mana", 30, "addition")
    });
    event.modify(`elemental_wizards_rpg:netherite_kelp_chest`, item => {
        item.addAttribute("rpgmana:manaregen", "6327acb4-8fb4-4487-b6e0-ee6860d3b97f", "mana regen", 8, "addition")
        item.addAttribute("rpgmana:mana", "4afd6d1f-2993-48fe-96f4-bdd83750e117","mana", 40, "addition")
    });
    event.modify(`elemental_wizards_rpg:netherite_kelp_legs`, item => {
        item.addAttribute("rpgmana:manaregen", "1935a01f-d695-4785-b58f-429c6f16e5fd", "mana regen", 8, "addition")
        item.addAttribute("rpgmana:mana", "d5880919-01d4-44d2-8413-a60e58c6644f","mana", 30, "addition")
    });
    event.modify(`elemental_wizards_rpg:netherite_kelp_feet`, item => {
        item.addAttribute("rpgmana:manaregen", "25c5abd8-23b7-4034-9563-0ef6c868cc6d", "mana regen", 8, "addition")
        item.addAttribute("rpgmana:mana", "d853a0f8-0555-4148-8ac5-19ecfe51d118","mana", 40, "addition")
    });
    // Aqua Robes
    event.modify(`elemental_wizards_rpg:kelp_head`, item => {
        item.addAttribute("rpgmana:manaregen", "5e23af2e-bd87-4d31-afea-3687044b5db6", "mana regen", 4, "addition")
        item.addAttribute("rpgmana:mana", "aaa64c25-934f-4044-a381-ac3bdb18fb6b","mana", 20, "addition")
    });
    event.modify(`elemental_wizards_rpg:kelp_chest`, item => {
        item.addAttribute("rpgmana:manaregen", "5b03f137-a72d-4f15-9f0d-ac6348da017f", "mana regen", 4, "addition")
        item.addAttribute("rpgmana:mana", "4ab2ba98-e372-48d2-864f-0152a28c5b70","mana", 30, "addition")
    });
    event.modify(`elemental_wizards_rpg:kelp_legs`, item => {
        item.addAttribute("rpgmana:manaregen", "e4a2ff72-f6b0-41b5-8165-ff4c0ccecc06", "mana regen", 4, "addition")
        item.addAttribute("rpgmana:mana", "a6323dc8-37a7-451f-b8d0-ae9acc5af2b8","mana", 20, "addition")
    });
    event.modify(`elemental_wizards_rpg:kelp_feet`, item => {
        item.addAttribute("rpgmana:manaregen", "61a44b16-1ee2-49eb-a3d4-64424ce346c6", "mana regen", 4, "addition")
        item.addAttribute("rpgmana:mana", "db89059f-6e94-491b-8309-4e1019800b60","mana", 20, "addition")
    });
    // Apprentice Robes
    event.modify(`elemental_wizards_rpg:elemental_head`, item => {
        item.addAttribute("rpgmana:mana", "43ae2617-e39b-4a23-8bf3-d5c4d301050b","mana", 20, "addition")
    });
    event.modify(`elemental_wizards_rpg:elemental_chest`, item => {
        item.addAttribute("rpgmana:mana", "a873cebd-3b60-44ba-9e1e-e970cfe4c4de","mana", 30, "addition")
    });
    event.modify(`elemental_wizards_rpg:elemental_legs`, item => {
        item.addAttribute("rpgmana:mana", "6185997c-5620-4910-83d9-4fe606244468","mana", 20, "addition")
    });
    event.modify(`elemental_wizards_rpg:elemental_feet`, item => {
        item.addAttribute("rpgmana:mana", "b5feaf94-75d3-43d2-abbf-c1536ae41374","mana", 20, "addition")
    });
})
nova hamletBOT
#

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

silver rover
#

Somehow feel like I'm just not gonna get help with this problem.
But anyway related to the above issue,
At what point do startup scripts run in reference to other start processes like mods initializing?
Is it only after everything else in the normal start progress?
Because right now my only guess at the issue here is somehow the items not yet being registered.

dusk osprey
#

What's the issue here, I'm not sure I follow

silver rover
#

Attributes only properly apply to vanilla itsms

#

They work correctly for any vanilla item.
But despite that the code in the initial post does nothing

#

Screenshot of the diamond sword working correctly was intended to show that it works for vanilla itema

dusk osprey
#

I'm not sure how to fix this on fabric, sorry

#

Or if its even possible

#

I know it's possible on forge but I doubt that's much help to you

silver rover
#

Mhm. I'm assuming it's an event issue between mod loaders? As to the difference I mean

#

It's honestly just weird to me that it works without a hitch for a vanilla item, then fails silently without any useful logging for a modded one.
Just struggling with what's functionally different between the two the KubeJS essentially can't see the modded items for this purpose

covert hearth
#

Item modification for attributes seems to be very hit and miss in general. As a possible workaround you could use kubejs additions to listen to the fabric event for modifying item attributes

silver rover
#

I see. I'll give that a look. yay more documentation to read

#

Ultimately I care way more about getting this working than the effort is required.
Modpack dev moment.

proud cipher
#

[COURTESY REDACTMENT]

dusk osprey
#

Please do not necro old threads