Fix head position when riding more entity types (fixes compatibility with Sit mod and also mods where players can carry other players)

This commit is contained in:
Sollace 2024-12-15 15:00:55 +01:00
parent 884fb62ff5
commit ca04c3aed0
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -28,7 +28,6 @@ import net.minecraft.entity.*;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
@ -143,11 +142,7 @@ public class EquineRenderManager<
} }
float eyeHeight = dimensions.eyeHeight() * factor; float eyeHeight = dimensions.eyeHeight() * factor;
if (player.hasVehicle()) { if (player.hasVehicle()) {
Vec3d attachment = dimensions.attachments().getPointNullable(EntityAttachmentType.VEHICLE, 0, 0); eyeHeight += player.getVehicleAttachmentPos(player.getVehicle()).getY();
if (attachment != null) {
double yAttachment = attachment.getY();
eyeHeight += yAttachment * factor;
}
} }
return dimensions.withEyeHeight(eyeHeight); return dimensions.withEyeHeight(eyeHeight);