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 isShowCoordinates();
|
||||||
|
|
||||||
|
boolean isDisableBedrockScaffolding();
|
||||||
|
|
||||||
EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround();
|
EmoteOffhandWorkaroundOption getEmoteOffhandWorkaround();
|
||||||
|
|
||||||
String getDefaultLocale();
|
String getDefaultLocale();
|
||||||
|
|
|
@ -105,6 +105,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
||||||
@JsonProperty("show-coordinates")
|
@JsonProperty("show-coordinates")
|
||||||
private boolean showCoordinates = true;
|
private boolean showCoordinates = true;
|
||||||
|
|
||||||
|
@JsonProperty("disable-bedrock-scaffolding")
|
||||||
|
private boolean disableBedrockScaffolding = false;
|
||||||
|
|
||||||
@JsonDeserialize(using = EmoteOffhandWorkaroundOption.Deserializer.class)
|
@JsonDeserialize(using = EmoteOffhandWorkaroundOption.Deserializer.class)
|
||||||
@JsonProperty("emote-offhand-workaround")
|
@JsonProperty("emote-offhand-workaround")
|
||||||
private EmoteOffhandWorkaroundOption emoteOffhandWorkaround = EmoteOffhandWorkaroundOption.DISABLED;
|
private EmoteOffhandWorkaroundOption emoteOffhandWorkaround = EmoteOffhandWorkaroundOption.DISABLED;
|
||||||
|
|
|
@ -109,6 +109,23 @@ public class BedrockInventoryTransactionTranslator extends PacketTranslator<Inve
|
||||||
case ITEM_USE:
|
case ITEM_USE:
|
||||||
switch (packet.getActionType()) {
|
switch (packet.getActionType()) {
|
||||||
case 0 -> {
|
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
|
// Check to make sure the client isn't spamming interaction
|
||||||
// Based on Nukkit 1.0, with changes to ensure holding down still works
|
// Based on Nukkit 1.0, with changes to ensure holding down still works
|
||||||
boolean hasAlreadyClicked = System.currentTimeMillis() - session.getLastInteractionTime() < 110.0 &&
|
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.
|
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),
|
"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.
|
# Controls if coordinates are shown to players.
|
||||||
show-coordinates: true
|
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
|
# 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:
|
# There are three options this can be set to:
|
||||||
# disabled - the default/fallback, which doesn't apply this workaround
|
# disabled - the default/fallback, which doesn't apply this workaround
|
||||||
|
|
Loading…
Reference in a new issue