Explain new changes in BedrockMovePlayerTranslator

This commit is contained in:
Camotoy 2021-07-15 18:27:43 -04:00
parent 11874aaa9b
commit 89370ef648
No known key found for this signature in database
GPG Key ID: 7EEFB66FE798081F
1 changed files with 7 additions and 5 deletions

View File

@ -117,11 +117,13 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
if (notMovingUp) {
int floorY = position.getFloorY();
boolean overworld = session.getChunkCache().isExtendedHeight();
if (floorY <= (overworld ? BEDROCK_OVERWORLD_VOID_FLOOR_LOWER_Y : -38)
&& floorY >= (overworld ? BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y : -40)) {
// Work around there being a floor at Y -40 (Y - and teleport the player below it
// Moving from below Y -40 to above the void floor works fine
// If the client believes the world has extended height, then it also believes the void floor
// still exists, just at a lower spot
boolean extendedWorld = session.getChunkCache().isExtendedHeight();
if (floorY <= (extendedWorld ? BEDROCK_OVERWORLD_VOID_FLOOR_LOWER_Y : -38)
&& floorY >= (extendedWorld ? BEDROCK_OVERWORLD_VOID_FLOOR_UPPER_Y : -40)) {
// Work around there being a floor at the bottom of the world and teleport the player below it
// Moving from below to above the void floor works fine
entity.setPosition(entity.getPosition().sub(0, 4f, 0));
MovePlayerPacket movePlayerPacket = new MovePlayerPacket();
movePlayerPacket.setRuntimeEntityId(entity.getGeyserId());