Add entity movement changes in <= 1.21.1

This commit is contained in:
FlorianMichael 2024-10-29 20:50:45 +01:00
parent 3195eeb5a0
commit 5d7dd8b247
No known key found for this signature in database
GPG Key ID: C2FB87E71C425126
2 changed files with 24 additions and 4 deletions

View File

@ -34,10 +34,12 @@ import java.util.concurrent.CompletableFuture;
/* /*
* TODO | Port 1.21.3 * TODO | Port 1.21.3
* - VehicleMovePacket handling now has distance check * - VehicleMovePacket handling now has distance check in ClientPlayNetworkHandler
* - Game options are now only send if they changed * - Illusioner/Sniffer don't override visibility bounding box anymore
* - Illusioner/Sniffer doesn't override visibility bounding box anymore * - AbstractFireabll/EyeOfEnder#shouldRender new
* - AbstractFireabll#shouldRender new * - Entity#baseTick doesn't set prev rotation anymore at top
* - LivingEntity movement code got refactored completely
* - BundleItem#use, ConsumableComponent behaviour in use functions
* *
* TODO | Port 1.20.6 * TODO | Port 1.20.6
* - ClientPlayerInteractionManager#interactBlockInternal added new condition * - ClientPlayerInteractionManager#interactBlockInternal added new condition

View File

@ -86,6 +86,24 @@ public abstract class MixinEntity implements IEntity {
@Unique @Unique
private boolean viaFabricPlus$isInLoadedChunkAndShouldTick; private boolean viaFabricPlus$isInLoadedChunkAndShouldTick;
@Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/Vec3d;lengthSquared()D"))
private double allowSmallValues(Vec3d instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
return 0;
} else {
return instance.lengthSquared();
}
}
@Redirect(method = "setPitch", at = @At(value = "INVOKE", target = "Ljava/lang/Math;clamp(FFF)F", remap = false))
private float dontClampPitch(float value, float min, float max) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_21)) {
return value;
} else {
return Math.clamp(value, min, max);
}
}
@Inject(method = "adjustMovementForCollisions(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true) @Inject(method = "adjustMovementForCollisions(Lnet/minecraft/util/math/Vec3d;)Lnet/minecraft/util/math/Vec3d;", at = @At("HEAD"), cancellable = true)
private void use1_20_6StepCollisionCalculation(Vec3d movement, CallbackInfoReturnable<Vec3d> cir) { private void use1_20_6StepCollisionCalculation(Vec3d movement, CallbackInfoReturnable<Vec3d> cir) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) {