SPIGOT-5380, SPIGOT-6958, #1085: Add some missing entity API

By: Ollie <69084614+olijeffers0n@users.noreply.github.com>
This commit is contained in:
CraftBukkit/Spigot 2022-07-21 21:01:28 +10:00
parent 10e81b4c37
commit c739d45f4b
8 changed files with 125 additions and 0 deletions

View file

@ -115,4 +115,9 @@ public class CraftFox extends CraftAnimals implements Fox {
getHandle().getEntityData().set(EntityFox.DATA_TRUSTED_ID_1, player == null ? Optional.empty() : Optional.of(player.getUniqueId()));
}
@Override
public boolean isFaceplanted() {
return getHandle().isFaceplanted();
}
}

View file

@ -25,4 +25,14 @@ public class CraftGhast extends CraftFlying implements Ghast {
public EntityType getType() {
return EntityType.GHAST;
}
@Override
public boolean isCharging() {
return getHandle().isCharging();
}
@Override
public void setCharging(boolean flag) {
getHandle().setCharging(flag);
}
}

View file

@ -48,6 +48,66 @@ public class CraftPanda extends CraftAnimals implements Panda {
getHandle().setHiddenGene(toNms(gene));
}
@Override
public boolean isRolling() {
return getHandle().isRolling();
}
@Override
public void setRolling(boolean flag) {
getHandle().roll(flag);
}
@Override
public boolean isSneezing() {
return getHandle().isSneezing();
}
@Override
public void setSneezing(boolean flag) {
getHandle().sneeze(flag);
}
@Override
public boolean isSitting() {
return getHandle().isSitting();
}
@Override
public void setSitting(boolean flag) {
getHandle().sit(flag);
}
@Override
public boolean isOnBack() {
return getHandle().isOnBack();
}
@Override
public void setOnBack(boolean flag) {
getHandle().setOnBack(flag);
}
@Override
public boolean isEating() {
return getHandle().isEating();
}
@Override
public void setEating(boolean flag) {
getHandle().eat(flag);
}
@Override
public boolean isScared() {
return getHandle().isScared();
}
@Override
public int getUnhappyTicks() {
return getHandle().getUnhappyCounter();
}
public static Gene fromNms(EntityPanda.Gene gene) {
Preconditions.checkArgument(gene != null, "Gene may not be null");

View file

@ -39,4 +39,9 @@ public class CraftParrot extends CraftTameableAnimal implements Parrot {
public EntityType getType() {
return EntityType.PARROT;
}
@Override
public boolean isDancing() {
return getHandle().isPartyParrot();
}
}

View file

@ -25,4 +25,14 @@ public class CraftTurtle extends CraftAnimals implements Turtle {
public EntityType getType() {
return EntityType.TURTLE;
}
@Override
public boolean hasEgg() {
return getHandle().hasEgg();
}
@Override
public boolean isLayingEgg() {
return getHandle().isLayingEgg();
}
}

View file

@ -24,4 +24,9 @@ public class CraftWitch extends CraftRaider implements Witch {
public EntityType getType() {
return EntityType.WITCH;
}
@Override
public boolean isDrinkingPotion() {
return getHandle().isDrinkingPotion();
}
}

View file

@ -45,4 +45,24 @@ public class CraftWolf extends CraftTameableAnimal implements Wolf {
public void setCollarColor(DyeColor color) {
getHandle().setCollarColor(EnumColor.byId(color.getWoolData()));
}
@Override
public boolean isWet() {
return getHandle().isWet();
}
@Override
public float getTailAngle() {
return getHandle().getTailAngle();
}
@Override
public boolean isInterested() {
return getHandle().isInterested();
}
@Override
public void setInterested(boolean flag) {
getHandle().setIsInterested(flag);
}
}

View file

@ -123,4 +123,14 @@ public class CraftZombie extends CraftMonster implements Zombie {
@Override
public void setBreed(boolean b) {
}
@Override
public boolean canBreakDoors() {
return getHandle().canBreakDoors();
}
@Override
public void setCanBreakDoors(boolean flag) {
getHandle().setCanBreakDoors(flag);
}
}