mirror of
https://github.com/ViaVersion/ViaFabricPlus.git
synced 2024-12-22 16:48:25 +01:00
Fix entity position behaviour in <= 1.21.1 as well
EntityPositionPacket's now support entities where the logical movement side is on the client, revert this behaviour and fixup our previous injection for <= 1.19.3 which already implemented that behaviour.
This commit is contained in:
parent
8ff9354c04
commit
49db8cb3cb
@ -90,6 +90,11 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
super(client, connection, connectionState);
|
||||
}
|
||||
|
||||
@WrapWithCondition(method = "onEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/TrackedPosition;setPos(Lnet/minecraft/util/math/Vec3d;)V", ordinal = 0))
|
||||
private boolean dontHandleEntityPositionChange(TrackedPosition instance, Vec3d pos) {
|
||||
return ProtocolTranslator.getTargetVersion().newerThanOrEqualTo(ProtocolVersion.v1_21_2);
|
||||
}
|
||||
|
||||
@Redirect(method = "onEntityPosition", at = @At(value = "INVOKE", target = "Ljava/util/OptionalInt;isPresent()Z"))
|
||||
private boolean dontHandleRemovedVehiclePositionChange(OptionalInt instance) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_12_1)) {
|
||||
@ -202,7 +207,8 @@ public abstract class MixinClientPlayNetworkHandler extends ClientCommonNetworkH
|
||||
@Redirect(method = {"onEntityPosition", "onEntity"}, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;isLogicalSideForUpdatingMovement()Z"))
|
||||
private boolean allowPlayerToBeMovedByEntityPackets(Entity instance) {
|
||||
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_19_3) || ProtocolTranslator.getTargetVersion().equals(BedrockProtocolVersion.bedrockLatest)) {
|
||||
return instance.getControllingPassenger() instanceof PlayerEntity player ? player.isMainPlayer() : !instance.getWorld().isClient;
|
||||
final boolean logicalMovementSide = instance.getControllingPassenger() instanceof PlayerEntity player ? player.isMainPlayer() : !instance.getWorld().isClient;
|
||||
return !logicalMovementSide; // Older versions had the logic which is now executed if logicalMovementSide is false, so we need to invert values
|
||||
} else {
|
||||
return instance.isLogicalSideForUpdatingMovement();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user