Files
neoStudiosLCE-neoLegacy/Minecraft.Client/BossMobGuiInfo.cpp
George V. ff96cd3687 feat: support separate boss health bars per dimension
Add dimension-aware tracking for boss mobs and update the boss health
GUI system to maintain independent state for each dimension (Overworld,
Nether, End). This prevents conflicts when multiple bosses exist across
different dimensions simultaneously.

- Add `getDimension()` to `BossMob` base class and implement in
  `EnderDragon` and `WitherBoss`
- Replace static boss GUI state with dimension-indexed storage
- Introduce `getIndexFromDimension()` helper for dimension mapping
- Update rendering logic to use per-dimension state
- Isolate darkening effects and health display per dimension

Ported from LCERenewed commit 5ec8a0e41ba8146aba450258d8620cd3cb0299e0 by 3UR
2026-04-08 03:34:54 +03:00

25 lines
910 B
C++

#include "stdafx.h"
#include "BossMobGuiInfo.h"
#include "../Minecraft.World/BossMob.h"
#include "../Minecraft.World/LevelData.h"
float BossMobGuiInfo::healthProgress[3] = { 0.0f, 0.0f, 0.0f };
int BossMobGuiInfo::displayTicks[3] = { 0, 0, 0 };
wstring BossMobGuiInfo::name[3];
bool BossMobGuiInfo::darkenWorld[3] = { false, false, false };
void BossMobGuiInfo::setBossHealth(shared_ptr<BossMob> boss, bool darkenWorld)
{
int idx = getIndexFromDimension(boss->getDimension());
healthProgress[idx] = (float) boss->getHealth() / (float) boss->getMaxHealth();
displayTicks[idx] = SharedConstants::TICKS_PER_SECOND * 5;
name[idx] = boss->getAName();
BossMobGuiInfo::darkenWorld[idx] = darkenWorld;
}
int BossMobGuiInfo::getIndexFromDimension(int dimension)
{
if (dimension == LevelData::DIMENSION_NETHER) return 1;
if (dimension == LevelData::DIMENSION_END) return 2;
return 0;
}