feat: allow disabling drift in vanillaflight

This commit is contained in:
əlemi 2023-06-21 00:10:37 +02:00
parent 134d6fedaa
commit bf5405d64d
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -4,6 +4,7 @@ import com.google.auto.service.AutoService;
import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.modules.QuickModule; import ftbsc.bscv.modules.QuickModule;
import ftbsc.bscv.patches.PacketPatch.PacketEvent; import ftbsc.bscv.patches.PacketPatch.PacketEvent;
import ftbsc.bscv.tools.Keyboard;
import ftbsc.bscv.tools.Setting; import ftbsc.bscv.tools.Setting;
import net.minecraft.network.play.client.CPlayerPacket; import net.minecraft.network.play.client.CPlayerPacket;
import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3d;
@ -24,6 +25,7 @@ public class VanillaFlight extends QuickModule {
private static final int MS_PER_TICK = 50; private static final int MS_PER_TICK = 50;
public final ForgeConfigSpec.ConfigValue<Boolean> force; public final ForgeConfigSpec.ConfigValue<Boolean> force;
public final ForgeConfigSpec.ConfigValue<Boolean> drift;
public final ForgeConfigSpec.ConfigValue<Double> speed; public final ForgeConfigSpec.ConfigValue<Double> speed;
public final ForgeConfigSpec.ConfigValue<AntikickMode> antikick; public final ForgeConfigSpec.ConfigValue<AntikickMode> antikick;
public final ForgeConfigSpec.ConfigValue<Double> antikick_magnitude; public final ForgeConfigSpec.ConfigValue<Double> antikick_magnitude;
@ -41,6 +43,12 @@ public class VanillaFlight extends QuickModule {
.fallback(false) .fallback(false)
.build(this); .build(this);
this.drift = Setting.Bool.builder()
.name("drift")
.comment("gradually reduce momentum")
.fallback(true)
.build(this);
this.speed = Setting.Decimal.builder() this.speed = Setting.Decimal.builder()
.min(0.) .min(0.)
.fallback(0.05) .fallback(0.05)
@ -101,6 +109,10 @@ public class VanillaFlight extends QuickModule {
MC.player.abilities.flying = true; MC.player.abilities.flying = true;
} }
if (!this.drift.get() && !Keyboard.isMoving()) {
MC.player.setDeltaMovement(Vector3d.ZERO);
}
this.tick = ( this.tick + 1 ) % this.antikick_cycle.get(); this.tick = ( this.tick + 1 ) % this.antikick_cycle.get();
Vector3d pos = MC.player.position(); Vector3d pos = MC.player.position();