The-Aether-Team / The-Aether

The original "The Aether" mod, rewritten and ported to modern Minecraft versions.
https://modrinth.com/mod/aether
GNU Lesser General Public License v3.0
331 stars 109 forks source link

Use vanilla tags to denote inactive bosses #2223

Closed Neko2n closed 2 weeks ago

Neko2n commented 2 weeks ago

What Feature Types Apply to This Request?

Entity, System

Other Type

No response

Is This an Enhancement to a Preexisting Feature?

What Is Your Feature Request?

Currently all of Aether's bosses use an NBT tag called "BossFight" to denote whether their fight has started yet or not. For the sake of compatibility with other mods, it would be greatly appreciated if you could use a vanilla entity property like "isSleeping" to denote whether a boss is actively fighting the player or not.

Why Should It Be in the Mod?

I'm trying to write a mod that needs to detect when a bossfight is active or not, and because Aether doesn't use any vanilla tags or entity properties to denote when a boss is inactive I can't detect it without adding Aether as an optional dependency and hardcoding a unique check for the BossFight tag.

Does This Feature Improve Compatibility With Another Mod?

All mods that need to check an entity's hostility

Please Read and Confirm the Following

bconlon1 commented 2 weeks ago

Do any vanilla mobs or other mod bosses use isSleeping to denote activity, I'm curious about why that tag name specifically. Also it's still just a CompoundTag, shouldn't you be able to read it from the entity without needing any additional dependencies in your development environment?

Neko2n commented 2 weeks ago

isSleeping is a method in the LivingEntity class that returns this.getSleepingPos().isPresent(). So far I've seen it used by Endergetic Expansion's Brood Eetle, but I'm not entirely sure where else it's used. As for reading compound tags---I'm new to modding and don't know how to do that 😅 but I figured this could still be helpful to make this mod more compatible with other mods out-of-the-gate. Hardcoding a check for the BossFight tag to add compatibility with the Aether isn't something everyone's going to do, it's nice to just have a consistent way to check if a boss is actively fighting the player across all mods, and I thought isSleeping may be a good way to do that.

If you think this may break compatibility with addons or other mods and it's not worth it, feel free to close the issue; I can fix it by manually checking CompoundTags, which I'll likely have to do for other mods too.

bconlon1 commented 2 weeks ago

Yeah it's something I'd rather not change to avoid breaking any existing compatibility. It shouldn't be too hard to read all of an entity's NBT data and check the necessary boolean tags for what you're doing.