Skip to content

Commit

Permalink
offlineplayer fly/walk speed: multiply/divide by 2
Browse files Browse the repository at this point in the history
to match what CraftPlayer does
  • Loading branch information
mcmonkey4eva committed Jul 16, 2023
1 parent 17cef98 commit 59dc230
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,12 @@ public void setFireTicks(int input) {
}

public float getFlySpeed() {
return ((CompoundTag) this.compound.getValue().get("abilities")).getFloat("flySpeed");
return ((CompoundTag) this.compound.getValue().get("abilities")).getFloat("flySpeed") * 2;
}

public void setFlySpeed(float speed) {
CompoundTag compoundTag = (CompoundTag) this.compound.getValue().get("abilities");
compoundTag = compoundTag.createBuilder().putFloat("flySpeed", speed).build();
compoundTag = compoundTag.createBuilder().putFloat("flySpeed", speed / 2).build();
this.compound = compound.createBuilder().put("abilities", compoundTag).build();
markModified();
}
Expand Down Expand Up @@ -396,12 +396,12 @@ public void setVelocity(Vector vector) {
}

public float getWalkSpeed() {
return ((CompoundTag) this.compound.getValue().get("abilities")).getFloat("walkSpeed");
return ((CompoundTag) this.compound.getValue().get("abilities")).getFloat("walkSpeed") * 2;
}

public void setWalkSpeed(float speed) {
CompoundTag compoundTag = (CompoundTag) this.compound.getValue().get("abilities");
compoundTag = compoundTag.createBuilder().putFloat("walkSpeed", speed).build();
compoundTag = compoundTag.createBuilder().putFloat("walkSpeed", speed / 2).build();
this.compound = compound.createBuilder().put("abilities", compoundTag).build();
markModified();
}
Expand Down

0 comments on commit 59dc230

Please sign in to comment.