Ponies no longer have to be fully submerged to become seaponies

This commit is contained in:
Sollace 2018-12-09 23:15:44 +02:00
parent 21fab5e5fe
commit db65d36af1
3 changed files with 12 additions and 1 deletions

View file

@ -46,6 +46,11 @@ public interface IPony {
*/ */
boolean isFullySubmerged(EntityLivingBase entity); boolean isFullySubmerged(EntityLivingBase entity);
/**
* Returns true if the provided entity is partially submerged. That is if any part of it is in contact with water.
*/
boolean isPartiallySubmerged(EntityLivingBase entity);
/** /**
* Returns true if an entity is wearing any headgear. This is used to hide things like the snout when wearing items * Returns true if an entity is wearing any headgear. This is used to hide things like the snout when wearing items
* such as the pumpkin, a player's head, or any other types of blocks. * such as the pumpkin, a player's head, or any other types of blocks.

View file

@ -124,6 +124,12 @@ public class Pony implements IPony {
return isFullySubmerged(entity) && !(entity.onGround || entity.isOnLadder()); return isFullySubmerged(entity) && !(entity.onGround || entity.isOnLadder());
} }
@Override
public boolean isPartiallySubmerged(EntityLivingBase entity) {
return entity.isInWater()
|| entity.getEntityWorld().getBlockState(new BlockPos(entity.posX, entity.posY, entity.posZ)).getMaterial() == Material.WATER;
}
@Override @Override
public boolean isFullySubmerged(EntityLivingBase entity) { public boolean isFullySubmerged(EntityLivingBase entity) {
return entity.isInWater() return entity.isInWater()

View file

@ -22,7 +22,7 @@ public class RenderSeaponyPlayer extends RenderPonyPlayer {
public IPony getEntityPony(AbstractClientPlayer player) { public IPony getEntityPony(AbstractClientPlayer player) {
IPony pony = super.getEntityPony(player); IPony pony = super.getEntityPony(player);
boolean wet = pony.isFullySubmerged(player); boolean wet = pony.isPartiallySubmerged(player);
mainModel = renderPony.setPonyModel(wet ? seapony : normalPony); mainModel = renderPony.setPonyModel(wet ? seapony : normalPony);