3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-12-23 23:00:21 +01:00

Config option to disable Bedrock scaffolding/godbridging

Dieser Commit ist enthalten in:
Camotoy 2022-01-15 16:28:52 -05:00
Ursprung a39de7d7d2
Commit 516d8e573e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 7EEFB66FE798081F
4 geänderte Dateien mit 25 neuen und 1 gelöschten Zeilen

Datei anzeigen

@ -76,6 +76,8 @@ public interface GeyserConfiguration {
boolean isShowCoordinates();
boolean isDisableBedrockScaffolding();
EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround();
String getDefaultLocale();

Datei anzeigen

@ -105,6 +105,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
@JsonProperty("show-coordinates")
private boolean showCoordinates = true;
@JsonProperty("disable-bedrock-scaffolding")
private boolean disableBedrockScaffolding = false;
@JsonDeserialize(using = EmoteOffhandWorkaroundOption.Deserializer.class)
@JsonProperty("emote-offhand-workaround")
private EmoteOffhandWorkaroundOption emoteOffhandWorkaround = EmoteOffhandWorkaroundOption.DISABLED;

Datei anzeigen

@ -109,6 +109,23 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
case ITEM_USE:
switch (packet.getActionType()) {
case 0 -> {
Vector3i blockPos = BlockUtils.getBlockPosition(packet.getBlockPosition(), packet.getBlockFace());
if (session.getGeyser().getConfig().isDisableBedrockScaffolding()) {
float yaw = session.getPlayerEntity().getYaw();
boolean isGodBridging = switch (packet.getBlockFace()) {
case 2 -> yaw <= -135f || yaw > 135f;
case 3 -> yaw <= 45f && yaw > -45f;
case 4 -> yaw > 45f && yaw <= 135f;
case 5 -> yaw <= -45f && yaw > -135f;
default -> false;
};
if (isGodBridging) {
restoreCorrectBlock(session, blockPos, packet);
return;
}
}
// Check to make sure the client isn't spamming interaction
// Based on Nukkit 1.0, with changes to ensure holding down still works
boolean hasAlreadyClicked = System.currentTimeMillis() - session.getLastInteractionTime() < 110.0 &&
@ -138,7 +155,6 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
}
}
Vector3i blockPos = BlockUtils.getBlockPosition(packet.getBlockPosition(), packet.getBlockFace());
/*
Checks to ensure that the range will be accepted by the server.
"Not in range" doesn't refer to how far a vanilla client goes (that's a whole other mess),

Datei anzeigen

@ -125,6 +125,9 @@ show-cooldown: title
# Controls if coordinates are shown to players.
show-coordinates: true
# Whether Bedrock players are blocked from performing their scaffolding-style bridging.
disable-bedrock-scaffolding: false
# If set, when a Bedrock player performs any emote, it will swap the offhand and mainhand items, just like the Java Edition keybind
# There are three options this can be set to:
# disabled - the default/fallback, which doesn't apply this workaround