Skip to content

Commit

Permalink
Fixed being unable to move vertically if horizontal speed is set to 0
Browse files Browse the repository at this point in the history
  • Loading branch information
hashalite committed Feb 26, 2022
1 parent 3d58fbf commit 359d4ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ minecraft_version=1.18.1
yarn_mappings=1.18.1+build.22
loader_version=0.13.1
# Mod Properties
mod_version=0.4.5
mod_version=0.4.6
maven_group=net.xolt
archives_base_name=freecam
# Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.client.network.ClientPlayerEntity;
import net.xolt.freecam.Freecam;
import net.xolt.freecam.config.ModConfig;
import net.xolt.freecam.util.FreeCamera;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -24,8 +25,10 @@ private void onIsCamera(CallbackInfoReturnable<Boolean> cir) {

@ModifyArgs(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;add(DDD)Lnet/minecraft/util/math/Vec3d;"))
private void onTickMovement(Args args) {
if (Freecam.isEnabled() && ModConfig.INSTANCE.flightMode.equals(ModConfig.FlightMode.CREATIVE) && this.equals(Freecam.getFreeCamera()) && ModConfig.INSTANCE.horizontalSpeed != 0.0) {
args.set(1, ((Double) args.get(1) / (ModConfig.INSTANCE.horizontalSpeed / 10)) * (ModConfig.INSTANCE.verticalSpeed / 10));
if (Freecam.isEnabled() && ModConfig.INSTANCE.flightMode.equals(ModConfig.FlightMode.CREATIVE) && this.equals(Freecam.getFreeCamera())) {
FreeCamera freeCamera = Freecam.getFreeCamera();
int verticalMovement = (freeCamera.input.jumping ? 1 : 0) - (freeCamera.input.sneaking ? 1 : 0);
args.set(1, (float) verticalMovement * (ModConfig.INSTANCE.verticalSpeed / 10) * 3.0F);
}
}
}

0 comments on commit 359d4ed

Please sign in to comment.