Occultism

Occultism

19M Downloads

Allow adding NBT to entities summoned via ritual (e.g. for Buffable Summons via KubeJS)

MuteTiefling opened this issue ยท 10 comments

commented

Just a quick thought I had. Would be neat if we had a way to specify buffs to mobs summoned by ritual. Like setting health, speed, strength, and even adding potion effects.

I'd imagine all this could just be added to the recipe and read from there as it is summoned.

commented

I like the idea, although I am not sure if it is that simple to implement.
Specifying such settings in the recipe wouldn't be too hard I'd say. It might even be possible to just have a generic "attribute" handler where in the recipe the attribute name and the added value are provided. Potion effects could work similarly with potion effect name + duration or no duration for infinite.

I am not sure though if minecraft supports persistent "buffs" aka attribute modifiers and potion effects like that or if they e.g. vanish on server restart.

commented

Apotheosis has a similar system, and at least in 1.16, they appear to persist. We've given iron golems huge health bonuses, for example, and those dudes stick around without issue. Also very long lasting potion effects that are effectively infinite.

Not sure what it takes to get there though. If they had to do anything weird, that is.

commented

When I find some time I will experiment with it, its entirely possible MC does it out of the box, if not I can take a look how to implement that

commented

Awesome! Thanks!

commented

That is a lot more manageable - I assume you can access the getPersistentData() for entities?
AFAIK that is the only place where they store nbt

commented

This slipped through the cracks a bit. Initial research showed it is not as trivial as I thought so will have to icebox that

commented

Actually, if you'd be willing to simply put an NBT value on anything summoned by the ritual, I could do the rest myself. With KubeJS I can target mobs on spawn and check for that NBT value, then apply a bunch of arbitrary buffs to them.

commented

@MuteTiefling if you could show an example of how this works in kubejs (eg link to the Enigmatica repo) it would be great to serve as documentation if others want to use it in a similar fashion

commented

Alright, just for the sake of simplifying things, I've put up a Gist with an example, rather than linking to anything specific in Enigmatica. This has a script for overriding the Possessed Skeleton recipe as well as equiping it with gear, setting boosted health, and adding a potion effect.

https://gist.github.com/MuteTiefling/0e452f4a2722690b2ef4a69e679cc9d4

commented

Fantastic, thanks a lot!