mirror of
https://github.com/TeamMidnightDust/MidnightControls.git
synced 2025-12-13 23:25:10 +01:00
🎨 Improve fly drifting injection.
This commit is contained in:
@@ -19,7 +19,8 @@ import net.minecraft.util.math.Vec3d;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
/**
|
||||
* Injects the anti fly drifting feature.
|
||||
@@ -38,12 +39,12 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
||||
super(world, profile);
|
||||
}
|
||||
|
||||
@Redirect(method = "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"))
|
||||
public void lambdacontrols_move(AbstractClientPlayerEntity player, MovementType type, Vec3d movement)
|
||||
@Inject(method = "move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;move(Lnet/minecraft/entity/MovementType;Lnet/minecraft/util/math/Vec3d;)V"))
|
||||
public void lambdacontrols_move(MovementType type, Vec3d movement, CallbackInfo ci)
|
||||
{
|
||||
LambdaControlsClient mod = LambdaControlsClient.get();
|
||||
if (type == MovementType.SELF) {
|
||||
if (player.abilities.flying && !mod.config.has_fly_drifting()) {
|
||||
if (this.abilities.flying && !mod.config.has_fly_drifting()) {
|
||||
if (!this.method_22120()) {
|
||||
if (!this.lambdacontrols_drifting_prevented) {
|
||||
this.setVelocity(this.getVelocity().multiply(0, 1.0, 0));
|
||||
@@ -53,6 +54,5 @@ public abstract class ClientPlayerEntityMixin extends AbstractClientPlayerEntity
|
||||
this.lambdacontrols_drifting_prevented = false;
|
||||
}
|
||||
}
|
||||
super.move(type, movement);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user