mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 22:38:00 +01:00
Use the model's head position rather than the entities for determining if it's submerged
This commit is contained in:
parent
028b86d749
commit
b86403ae65
1 changed files with 8 additions and 1 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue