From ea136b269c75e669ef38618ab2e10ac353cd63d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=9F=E8=92=BB?= <41978811+patyhank@users.noreply.github.com> Date: Sun, 14 May 2023 05:29:30 +0800 Subject: [PATCH] Add Spectator mode ability layer (#3770) Fixes #3769 --- .../java/org/geysermc/geyser/session/GeyserSession.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java index e841dd43c..052222be1 100644 --- a/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java +++ b/core/src/main/java/org/geysermc/geyser/session/GeyserSession.java @@ -1739,7 +1739,12 @@ public class GeyserSession implements GeyserConnection, GeyserCommandSource { abilities.add(Ability.NO_CLIP); } - abilityLayer.setLayerType(AbilityLayer.Type.BASE); + // https://github.com/GeyserMC/Geyser/issues/3769 Setting Spectator mode ability layer + if (spectator) { + abilityLayer.setLayerType(AbilityLayer.Type.SPECTATOR); + } else { + abilityLayer.setLayerType(AbilityLayer.Type.BASE); + } abilityLayer.setFlySpeed(flySpeed); // https://github.com/GeyserMC/Geyser/issues/3139 as of 1.19.10 abilityLayer.setWalkSpeed(walkSpeed == 0f ? 0.01f : walkSpeed);