From b86403ae651fd92454b8ad14ec1273b14e5dcf3b Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 27 Jul 2018 00:17:23 +0200 Subject: [PATCH] Use the model's head position rather than the entities for determining if it's submerged --- src/main/java/com/minelittlepony/pony/data/Pony.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/pony/data/Pony.java b/src/main/java/com/minelittlepony/pony/data/Pony.java index 0d9af777..b3b92297 100644 --- a/src/main/java/com/minelittlepony/pony/data/Pony.java +++ b/src/main/java/com/minelittlepony/pony/data/Pony.java @@ -19,6 +19,7 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import java.awt.image.BufferedImage; import java.io.FileNotFoundException; @@ -113,7 +114,13 @@ public class Pony { } public boolean isFullySubmerged(EntityLivingBase entity) { - return entity.isInWater() && entity.getEntityWorld().getBlockState(new BlockPos(entity.getPositionEyes(1))).getMaterial() == Material.WATER; + return entity.isInWater() && entity.getEntityWorld().getBlockState(new BlockPos(getVisualEyePosition(entity))).getMaterial() == Material.WATER; + } + + protected Vec3d getVisualEyePosition(EntityLivingBase entity) { + PonySize size = entity.isChild() ? PonySize.FOAL : metadata.getSize(); + + return new Vec3d(entity.posX, entity.posY + (double)entity.getEyeHeight() * size.getScaleFactor(), entity.posZ); } public boolean isWearingHeadgear(EntityLivingBase entity) {