Enhanced AI

Enhanced AI

7M Downloads

Use KubeJS to edit NBT before spawn does not allow for changing the range of skeletons

Lightfox-Lowell opened this issue ยท 6 comments

commented

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

  1. Use EntityEvents.spawned(event => { code here }) to grab the event that's fired off when something spawns.
  2. Set the NBT flags in forgedata to your liking.
  3. Go up to the sky and spawn a single skeleton. Check the ranges.

Screenshots (Range set to 10 in test)
image

Can the issue be reproduced with EnhancedAI only (or with a minimal set of mods)?
No

commented

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?

commented

You must use a high priority event. If KubeJS runs after Lowest priority events it will never work as it's too late.

commented

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?

commented

Didn't mean to close that.

commented

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.

commented

This was something I wanted to do, but it's way too much work