Skip to content

Commit

Permalink
Don't let setbacks bypass stuck speed
Browse files Browse the repository at this point in the history
  • Loading branch information
SamB440 committed Dec 1, 2024
1 parent 88dc6a4 commit 7737337
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main/java/ac/grim/grimac/manager/SetbackTeleportUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ private void simulateFriction(Vector vector) {
vector.setY(vector.getY() - 0.05); // Make the player fall a bit
} else { // Gliding doesn't have friction, we handle it differently
PredictionEngineNormal.staticVectorEndOfTick(player, vector); // Lava and normal movement
vector.multiply(player.stuckSpeedMultiplier); // Prevent abusing setbacks to move out of blocks like webs
}

// stop 1.8 players from stepping onto 1.25 high blocks, because why not?
Expand Down Expand Up @@ -397,15 +398,15 @@ public void addSentTeleport(Location position, int transaction, RelativeFlag fla
Vector3d safePosition = new Vector3d(position.getX(), position.getY(), position.getZ());

// We must convert relative teleports to avoid them becoming client controlled in the case of setback
if (flags.isSet(RelativeFlag.X.getMask())) {
if (flags.has(RelativeFlag.X)) {
safePosition = safePosition.withX(safePosition.getX() + lastKnownGoodPosition.pos.getX());
}

if (flags.isSet(RelativeFlag.Y.getMask())) {
if (flags.has(RelativeFlag.Y)) {
safePosition = safePosition.withY(safePosition.getY() + lastKnownGoodPosition.pos.getY());
}

if (flags.isSet(RelativeFlag.Z.getMask())) {
if (flags.has(RelativeFlag.Z)) {
safePosition = safePosition.withZ(safePosition.getZ() + lastKnownGoodPosition.pos.getZ());
}

Expand Down

0 comments on commit 7737337

Please sign in to comment.