Fix F3 debug crash when throwing ender pearl long distance (#934)
Signed-off-by: Ayush Thoren <ayushthoren@gmail.com>
This commit is contained in:
@@ -895,14 +895,14 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
int zBlockPos = Mth::floor(minecraft->player->z);
|
||||
|
||||
// Chunk player is in
|
||||
int xChunkPos = minecraft->player->xChunk;
|
||||
int yChunkPos = minecraft->player->yChunk;
|
||||
int zChunkPos = minecraft->player->zChunk;
|
||||
int xChunkPos = xBlockPos >> 4;
|
||||
int yChunkPos = yBlockPos >> 4;
|
||||
int zChunkPos = zBlockPos >> 4;
|
||||
|
||||
// Players offset within the chunk
|
||||
int xChunkOffset = xBlockPos - xChunkPos * 16;
|
||||
int yChunkOffset = yBlockPos - yChunkPos * 16;
|
||||
int zChunkOffset = zBlockPos - zChunkPos * 16;
|
||||
int xChunkOffset = xBlockPos & 15;
|
||||
int yChunkOffset = yBlockPos & 15;
|
||||
int zChunkOffset = zBlockPos & 15;
|
||||
|
||||
// Format the position like java with limited decumal places
|
||||
WCHAR posString[44]; // Allows upto 7 digit positions (+-9_999_999)
|
||||
@@ -951,7 +951,8 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
if (minecraft->level != NULL && minecraft->level->hasChunkAt(xBlockPos, fmod(yBlockPos, 256), zBlockPos))
|
||||
{
|
||||
LevelChunk *chunkAt = minecraft->level->getChunkAt(xBlockPos, zBlockPos);
|
||||
|
||||
if (chunkAt != NULL)
|
||||
{
|
||||
int skyLight = chunkAt->getBrightness(LightLayer::Sky, xChunkOffset, yChunkOffset, zChunkOffset);
|
||||
int blockLight = chunkAt->getBrightness(LightLayer::Block, xChunkOffset, yChunkOffset, zChunkOffset);
|
||||
int maxLight = fmax(skyLight, blockLight);
|
||||
@@ -964,6 +965,7 @@ void Gui::render(float a, bool mouseFree, int xMouse, int yMouse)
|
||||
|
||||
lines.push_back(L"Difficulty: " + std::to_wstring(minecraft->level->difficulty) + L" (Day " + std::to_wstring(minecraft->level->getGameTime() / Level::TICKS_PER_DAY) + L")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// This is all LCE only stuff, it was never on java
|
||||
|
||||
Reference in New Issue
Block a user