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:
@@ -50,13 +50,18 @@ UIScene_EndPoem::UIScene_EndPoem(int iPad, void *initData, UILayer *parentLayer)
|
||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
wstring playerName = L"";
|
||||
if(pMinecraft->localplayers[ui.GetWinUserIndex()] != nullptr)
|
||||
unsigned int winIdx = ui.GetWinUserIndex();
|
||||
if(winIdx < XUSER_MAX_COUNT && pMinecraft->localplayers[winIdx] != nullptr)
|
||||
{
|
||||
playerName = escapeXML( pMinecraft->localplayers[ui.GetWinUserIndex()]->getDisplayName() );
|
||||
playerName = escapeXML( pMinecraft->localplayers[winIdx]->getDisplayName() );
|
||||
}
|
||||
else if(pMinecraft->localplayers[ProfileManager.GetPrimaryPad()] != nullptr)
|
||||
{
|
||||
playerName = escapeXML( pMinecraft->localplayers[ProfileManager.GetPrimaryPad()]->getDisplayName() );
|
||||
}
|
||||
else
|
||||
{
|
||||
playerName = escapeXML( pMinecraft->localplayers[ProfileManager.GetPrimaryPad()]->getDisplayName() );
|
||||
playerName = L"Player";
|
||||
}
|
||||
noNoiseString = replaceAll(noNoiseString,L"{*PLAYER*}",playerName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user