KubeJS ‐ Passives - Senior-S/JustLeveling-Fork GitHub Wiki
This feature is only available from 1.0.1!
What's a passive?
Passives can have multiple levels and it can modify any attribute of the player. As an example you can have a passive that let's the player have more health as he level up.
Adding the passive.
The passive must be registered in a startup script! First we need to import the required class, you can do that using the next line:
const $Passive = Java.loadClass('com.seniors.justlevelingfork.registry.passive.Passive')
With the class loaded, now we can hook to the register event of passives and add our own passive.
StartupEvents.registry('justlevelingfork:passives', event => {
event.createCustom('passive_1', () => {
return $Passive.add("passive_1", "Strength", "textures/skill/strength/passive_1.png", "generic.attack_speed", "fac4ee09-94e0-4f3d-be36-2793546587b4", 8, 4, 6, 8, 10)
})
});
Let's explain a bit of the $Passive.add function, the function internally looks like this:
Passive add(String passiveName, String aptitudeName, String texture, Attribute attribute, String attributeUUID, Object attributeValue, int... levelsRequired)
So, having the internal arguments name, we can easily understand what we have done in the registry hook.
- "passive_1" ~ Passive name, it can't have spaces and it must be lowercase
- "Strength" ~ Aptitude name, this is in what aptitude this passive will be. Check all the original aptitudes here.
- "textures/skill/strength/passive_1.png" ~ Texture, the texture should be added using a resource pack. Find the template for this here.
- "generic.attack_speed" ~ Attribute, the attribute that the passive will modify on level up.
- "fac4ee09-94e0-4f3d-be36-2793546587b4" ~ Attribute UUID, as the argument name says, is the UUID of the attribute.
- 8 ~ Attribute value, the attribute value is basically what will be the max value the attribute can be.
- 4, 6, 8, 10 ~ Levels required, when the aptitude reaches the respective levels, it will unlock points to level up this passive. You can add as much numbers as you want separated with a comma.
And that's it! Passives are really simple to add and implement, for any questions feel free to join my discord and ask there.