Skip to content

Commit

Permalink
Add magically eye position offset in <= 1.20.4 water detection
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianMichael committed Oct 5, 2024
1 parent 316ee89 commit 087a306
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,15 @@ private void use1_20_6StepCollisionCalculation(Vec3d movement, CallbackInfoRetur
}
}

@Redirect(method = "updateSubmergedInWaterState", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getEyeY()D"))
private double addMagicOffset(Entity instance) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_3)) {
return instance.getEyeY() - 0.11111111F;
} else {
return instance.getEyeY();
}
}

@Redirect(method = "updatePassengerPosition(Lnet/minecraft/entity/Entity;Lnet/minecraft/entity/Entity$PositionUpdater;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getVehicleAttachmentPos(Lnet/minecraft/entity/Entity;)Lnet/minecraft/util/math/Vec3d;"))
private Vec3d use1_20_1RidingOffset(Entity instance, Entity vehicle) {
if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20)) {
Expand Down

0 comments on commit 087a306

Please sign in to comment.