#Air Movement Speed
7 messages · Page 1 of 1 (latest)
There is a method called setFlyingSpeed inside net.minecraft.world.entity.player.Abilities with which you can change the player flying speed. However, if you want to change air movement speed (jumping, while player in air, etc.) There is a method called travelInAir(final Vec3d input) (26.1-SNAPSHOT4) which you can you use mixin to implement what you need.
An example: (don't fly very high!)
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(LivingEntity.class)
public class LivingEntityMixin {
@Inject(
method = "travelInAir",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/world/entity/LivingEntity;handleRelativeFrictionAndCalculateMovement(Lnet/minecraft/world/phys/Vec3;F)Lnet/minecraft/world/phys/Vec3;"),
cancellable = false
)
private void scaleAirMovement(Vec3 input, CallbackInfo ci) {
LivingEntity self = (LivingEntity)(Object)this;
if (!self.onGround()) {
Vec3 original = self.getDeltaMovement();
double multiplier = 1.5;
self.setDeltaMovement(
original.x * multiplier,
original.y,
original.z * multiplier
);
}
}
}
No need to double cast
thx very much for the quick response, but the mod I am making is on 1.20.1 (hence my server nickname)
Yarn Mappings?
believe so
This last else block contains the values you want