mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/LCE-Revelations.git
synced 2026-05-30 00:05:09 +00:00
Fix Ender Dragon damage, End portal transition, and End Poem crash
Dragon melee damage: reassign sub-entity IDs to be sequential from the parent entity ID in ServerLevel::entityAdded(), so the client's offset-based ID calculation matches the server. Previously the server's smallId pool allocated non-sequential IDs, causing melee attacks to target entity IDs the server didn't recognize. End portal transition: ensure the player entity is always added to the new level when transitioning from The End, not just for non-End dimensions. The addEntity call was previously gated behind a lastDimension != 1 check that also excluded it from End exits. End Poem crash: bounds-check the WIN_GAME event's player index before accessing localplayers[], with a fallback to prevent null dereference when the server sends an out-of-range index.
This commit is contained in:
@@ -965,15 +965,16 @@ void PlayerList::repositionAcrossDimension(shared_ptr<Entity> entity, int lastDi
|
||||
addPlayerToReceiving(player);
|
||||
}
|
||||
|
||||
if (lastDimension != 1)
|
||||
xt = static_cast<double>(Mth::clamp(static_cast<int>(xt), -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128));
|
||||
zt = static_cast<double>(Mth::clamp(static_cast<int>(zt), -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128));
|
||||
if (entity->isAlive())
|
||||
{
|
||||
xt = static_cast<double>(Mth::clamp(static_cast<int>(xt), -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128));
|
||||
zt = static_cast<double>(Mth::clamp(static_cast<int>(zt), -Level::MAX_LEVEL_SIZE + 128, Level::MAX_LEVEL_SIZE - 128));
|
||||
if (entity->isAlive())
|
||||
newLevel->addEntity(entity);
|
||||
entity->moveTo(xt, entity->y, zt, entity->yRot, entity->xRot);
|
||||
newLevel->tick(entity, false);
|
||||
// Portal forcing only for non-End exits (End exits go to spawn, not a portal)
|
||||
if (lastDimension != 1)
|
||||
{
|
||||
newLevel->addEntity(entity);
|
||||
entity->moveTo(xt, entity->y, zt, entity->yRot, entity->xRot);
|
||||
newLevel->tick(entity, false);
|
||||
newLevel->cache->autoCreate = true;
|
||||
newLevel->getPortalForcer()->force(entity, xOriginal, yOriginal, zOriginal, yRotOriginal);
|
||||
newLevel->cache->autoCreate = false;
|
||||
|
||||
Reference in New Issue
Block a user