Skip to content
This repository was archived by the owner on Jul 19, 2025. It is now read-only.

Commit a42a9e0

Browse files
committed
Only use faster WorldGuard Bypass when sprinting
1 parent 61c6a89 commit a42a9e0

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ This means it can only move `0.06` blocks per tick, and then has to send a posit
3131
for the next repeat. However, this can be improved because WorldGuard only checks regions when you cross a block boundary.
3232
So when we can move almost a full block while not crossing the boundary, and then only move a small amount to cross the boundary.
3333

34-
When this hack is activated using the default `;` (semicolon) keybind, it will allow you to move in this way with your `WASD` keys.
34+
When this hack is activated using the default `;` (semicolon) keybind, it will allow you to move in this way with your `WASD` keys.
35+
To activate the **faster** movement mode, you can press your **sprint** key (or toggle). This will enable the trick to
36+
move faster by moving almost a full block without crossing the boundary, but won't always work in some other plugins that detect `PlayerMoveEvent`s
37+
without taking this shortcut.
3538

3639
* [Keybinds.java](src/main/java/com/jorianwoltjer/liveoverflowmod/client/Keybinds.java):
3740
When the keybind is pressed, `worldGuardBypassEnabled` is activated and `WASD` keys send the required packets to bypass WorldGuard

src/main/java/com/jorianwoltjer/liveoverflowmod/client/Keybinds.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
44
import net.minecraft.client.MinecraftClient;
55
import net.minecraft.client.network.ClientPlayNetworkHandler;
6+
import net.minecraft.client.option.GameOptions;
67
import net.minecraft.client.option.KeyBinding;
78
import net.minecraft.entity.player.PlayerEntity;
89
import net.minecraft.network.Packet;
@@ -132,9 +133,11 @@ public static void checkKeybinds(MinecraftClient client) {
132133
Vec3d newPos = new Vec3d(client.player.getX() + vec.x, client.player.getY() + vec.y, client.player.getZ() + vec.z);
133134
// If able to add more without going over a block boundary, add more
134135
boolean extra = false;
135-
while (inSameBlock(newPos.add(vec.multiply(1.5)), new Vec3d(client.player.prevX, client.player.prevY, client.player.prevZ))) {
136-
newPos = newPos.add(vec);
137-
extra = true;
136+
if (client.options.sprintKey.isPressed()) { // Trigger by sprinting
137+
while (inSameBlock(newPos.add(vec.multiply(1.5)), new Vec3d(client.player.prevX, client.player.prevY, client.player.prevZ))) {
138+
newPos = newPos.add(vec);
139+
extra = true;
140+
}
138141
}
139142

140143
client.player.setPosition(newPos);

0 commit comments

Comments
 (0)