Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
Work around there being a void floor in Bedrock (#1405)
* Work around there being a void floor in Bedrock If the player's Y coordinate is -38 or below, we teleport the player below the void floor and they can safely die. :) * Don't teleport if below Y -40 * sigh * Have floorY be its own variable * Add more comment * More comments * Finish my thought
Dieser Commit ist enthalten in:
Ursprung
a17f2203a8
Commit
77153e6d4a
@ -100,11 +100,31 @@ public class BedrockMovePlayerTranslator extends PacketTranslator<MovePlayerPack
|
||||
movePacket = new ClientPlayerPositionPacket(packet.isOnGround(), position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
// Compare positions here for void floor fix below before the player's position variable is set to the packet position
|
||||
boolean notMovingUp = entity.getPosition().getY() >= packet.getPosition().getY();
|
||||
|
||||
entity.setPosition(packet.getPosition(), false);
|
||||
entity.setOnGround(packet.isOnGround());
|
||||
|
||||
// Send final movement changes
|
||||
session.sendDownstreamPacket(movePacket);
|
||||
|
||||
if (notMovingUp) {
|
||||
int floorY = position.getFloorY();
|
||||
if (floorY <= -38 && floorY >= -40) {
|
||||
// Work around there being a floor at Y -40 and teleport the player below it
|
||||
// Moving from below Y -40 to above the void floor works fine
|
||||
//TODO: This will need to be changed for 1.17
|
||||
entity.setPosition(entity.getPosition().sub(0, 4f, 0));
|
||||
MovePlayerPacket movePlayerPacket = new MovePlayerPacket();
|
||||
movePlayerPacket.setRuntimeEntityId(entity.getGeyserId());
|
||||
movePlayerPacket.setPosition(entity.getPosition());
|
||||
movePlayerPacket.setRotation(entity.getBedrockRotation());
|
||||
movePlayerPacket.setMode(MovePlayerPacket.Mode.TELEPORT);
|
||||
movePlayerPacket.setTeleportationCause(MovePlayerPacket.TeleportationCause.BEHAVIOR);
|
||||
session.sendUpstreamPacket(movePlayerPacket);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Not a valid move
|
||||
session.getConnector().getLogger().debug("Recalculating position...");
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren