From c739d45f4b4181879dc4f19bd12f46b1710b1086 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Thu, 21 Jul 2022 21:01:28 +1000 Subject: [PATCH] SPIGOT-5380, SPIGOT-6958, #1085: Add some missing entity API By: Ollie <69084614+olijeffers0n@users.noreply.github.com> --- .../bukkit/craftbukkit/entity/CraftFox.java | 5 ++ .../bukkit/craftbukkit/entity/CraftGhast.java | 10 ++++ .../bukkit/craftbukkit/entity/CraftPanda.java | 60 +++++++++++++++++++ .../craftbukkit/entity/CraftParrot.java | 5 ++ .../craftbukkit/entity/CraftTurtle.java | 10 ++++ .../bukkit/craftbukkit/entity/CraftWitch.java | 5 ++ .../bukkit/craftbukkit/entity/CraftWolf.java | 20 +++++++ .../craftbukkit/entity/CraftZombie.java | 10 ++++ 8 files changed, 125 insertions(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java index 02ff46c802..4014416fab 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java @@ -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(); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java index b24807364f..fb17b40ff8 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftGhast.java @@ -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); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java index 29eea7cfe2..06772804f6 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPanda.java @@ -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"); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java index ff4b16f330..4b7f8e3b8c 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftParrot.java @@ -39,4 +39,9 @@ public class CraftParrot extends CraftTameableAnimal implements Parrot { public EntityType getType() { return EntityType.PARROT; } + + @Override + public boolean isDancing() { + return getHandle().isPartyParrot(); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java index b46bb75926..301cfd1c63 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java @@ -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(); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java index 796bd26d41..0dd4ab8a19 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java @@ -24,4 +24,9 @@ public class CraftWitch extends CraftRaider implements Witch { public EntityType getType() { return EntityType.WITCH; } + + @Override + public boolean isDrinkingPotion() { + return getHandle().isDrinkingPotion(); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java index 63069368a1..49213ff3ce 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftWolf.java @@ -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); + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java index 389f88543e..72dadd8eea 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -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); + } }