mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Config option to disable Bedrock scaffolding/godbridging
This commit is contained in:
parent
a39de7d7d2
commit
516d8e573e
4 changed files with 25 additions and 1 deletions
|
@ -76,6 +76,8 @@ public interface GeyserConfiguration {
|
|||
|
||||
boolean isShowCoordinates();
|
||||
|
||||
boolean isDisableBedrockScaffolding();
|
||||
|
||||
EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround();
|
||||
|
||||
String getDefaultLocale();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue