mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Ponies no longer have to be fully submerged to become seaponies
This commit is contained in:
parent
21fab5e5fe
commit
db65d36af1
3 changed files with 12 additions and 1 deletions
|
@ -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.
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue