Use KubeJS to edit NBT before spawn does not allow for changing the range of skeletons
Lightfox-Lowell opened this issue ยท 6 comments
Odd use case here, but it worked on a lot of other stuff in the mod.
Using Kobejs I'm editting the NBT data before the mob is spawned and that was allowing me to dynmaiclly set mob capablities based on conditions. (In this case distance from spawn.)
This does not appear to be working on the range value of Skeletons
- Minecraft: 1.19.2
- Forge: 43.2.14
- Enhanced AI: 1.8.1
- InsaneLib: 1.7.5
- Kubejs: 1902.6.0-build.142
Steps to reproduce
- Use EntityEvents.spawned(event => { code here }) to grab the event that's fired off when something spawns.
- Set the NBT flags in forgedata to your liking.
- Go up to the sky and spawn a single skeleton. Check the ranges.
Screenshots (Range set to 10 in test)
Can the issue be reproduced with EnhancedAI only (or with a minimal set of mods)?
No
So I just went and checked something. It is only the Skeletons that do this. All other mobs do not yet have their forgeData flags by the time I can grab them.
Is something about the skeletons that's making them get their flags faster?
You must use a high priority event. If KubeJS runs after Lowest priority events it will never work as it's too late.
You must use a high priority event. If KubeJS runs after Lowest priority events it will never work as it's too late.
I woundn't know myself but I just found something interesting. Zombies seem to be missing their forgeData flags when I grab the event. Skeleton's on the other hand already have all of theirs. Likely the cause of my woes.
If not so much a bug but a feture request can you look into the diffrance?
OKAY, while doing even more testing I discovered something worse.
So my tests showed that this method worked with your mod on kubejs on egg spawns, but I've discovered it doesn't TOUCH natural spawns.
This is less of a bug and more of a feture request now to allow us to dynamiclly edit mobs on the fly, but that feels like way too much work to do.
Feel free to close this ticket off if you want. Sorry for the time waste.