testserver/patches/api/0312-Missing-Entity-Behavio...

656 lines
21 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Fri, 28 May 2021 21:06:59 -0400
Subject: [PATCH] Missing Entity Behavior API
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java
index 0d88dce9978243a1f995c5fb448c5d71b01136eb..cad47139de57642fb3bb483e7a5acaa7fea78cb4 100644
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
+++ b/src/main/java/org/bukkit/entity/AbstractHorse.java
@@ -119,4 +119,58 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable {
@NotNull
@Override
public AbstractHorseInventory getInventory();
+
+ // Paper start - Horse API
+ /**
+ * Gets if a horse is in their eating grass animation.
+ *
+ * @return eating grass animation is active
+ * @deprecated use {@link #isEatingHaystack()}
+ */
+ @Deprecated
+ public boolean isEatingGrass();
+
+ /**
+ * Sets if a horse is in their eating grass animation.
+ *
+ * <p>When true, the horse will lower its neck.</p>
+ *
+ * @param eating eating grass animation is active
+ * @deprecated use {@link #setEatingHaystack(boolean)}
+ */
+ @Deprecated
+ public void setEatingGrass(boolean eating);
+
+ /**
+ * Gets if a horse is in their rearing animation.
+ *
+ * @return rearing animation is active
+ */
+ public boolean isRearing();
+
+ /**
+ * Sets if a horse is in their rearing animation.
+ *
+ * <p>When true, the horse will stand on its hind legs.</p>
+ *
+ * @param rearing rearing animation is active
+ */
+ public void setRearing(boolean rearing);
+
+ /**
+ * Gets if a horse is in their eating animation.
+ *
+ * @return eating animation is active
+ */
+ public boolean isEating();
+
+ /**
+ * Sets if a horse is in their eating animation.
+ *
+ * <p>When true, the horse will bob its head.</p>
+ *
+ * @param eating eating animation is active
+ */
+ public void setEating(boolean eating);
+ // Paper end - Horse API
}
diff --git a/src/main/java/org/bukkit/entity/Bee.java b/src/main/java/org/bukkit/entity/Bee.java
index adb20a9abba33c32d553f620fa82b27dff64ab5f..ca6baec5ce00b4d169ab4ff416f616db32615010 100644
--- a/src/main/java/org/bukkit/entity/Bee.java
+++ b/src/main/java/org/bukkit/entity/Bee.java
@@ -93,4 +93,28 @@ public interface Bee extends Animals {
* @param ticks Ticks the bee cannot enter a hive for
*/
void setCannotEnterHiveTicks(int ticks);
+
+ // Paper start
+ /**
+ * Sets the override for if the bee is currently rolling.
+ *
+ * @param rolling is rolling, or unset for vanilla behavior
+ */
+ void setRollingOverride(@org.jetbrains.annotations.NotNull net.kyori.adventure.util.TriState rolling);
+
+ /**
+ * Gets the plugin set override for if the bee is currently rolling.
+ *
+ * @return plugin set rolling override
+ */
+ @org.jetbrains.annotations.NotNull
+ net.kyori.adventure.util.TriState getRollingOverride();
+
+ /**
+ * Gets if the bee is currently rolling.
+ *
+ * @return is rolling
+ */
+ boolean isRolling();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java
index c2a566b864c82ffb094b7334d9e6e25a1bfc87d1..c340fecb61bac66baf0f44189d21bc85289b1269 100644
--- a/src/main/java/org/bukkit/entity/Cat.java
+++ b/src/main/java/org/bukkit/entity/Cat.java
@@ -54,4 +54,36 @@ public interface Cat extends Tameable, Sittable {
JELLIE,
ALL_BLACK;
}
+
+ // Paper Start - More cat api
+ /**
+ * Sets if the cat is lying down.
+ * This is visual and does not affect the behaviour of the cat.
+ *
+ * @param lyingDown whether the cat should lie down
+ */
+ public void setLyingDown(boolean lyingDown);
+
+ /**
+ * Gets if the cat is lying down.
+ *
+ * @return whether the cat is lying down
+ */
+ public boolean isLyingDown();
+
+ /**
+ * Sets if the cat has its head up.
+ * This is visual and does not affect the behaviour of the cat.
+ *
+ * @param headUp head is up
+ */
+ public void setHeadUp(boolean headUp);
+
+ /**
+ * Gets if the cat has its head up.
+ *
+ * @return head is up
+ */
+ public boolean isHeadUp();
+ // Paper End - More cat api
}
diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java
index 94f3a8c4bf8cf14263d34d866db66728e98dfdb0..7937a0e082199554d3e8db1f9811be29abc9b3fd 100644
--- a/src/main/java/org/bukkit/entity/Enderman.java
+++ b/src/main/java/org/bukkit/entity/Enderman.java
@@ -54,4 +54,36 @@ public interface Enderman extends Monster {
* @param blockData data to set the carried block to, or null to remove
*/
public void setCarriedBlock(@Nullable BlockData blockData);
+
+ // Paper start
+ /**
+ * Returns whether the enderman is screaming/angry.
+ *
+ * @return whether the enderman is screaming
+ */
+ boolean isScreaming();
+
+ /**
+ * Sets whether the enderman is screaming/angry.
+ *
+ * @param screaming whether the enderman is screaming
+ */
+ void setScreaming(boolean screaming);
+
+ /**
+ * Returns whether the enderman has been stared at.
+ * If set to true, players will hear an ambient sound.
+ *
+ * @return whether the enderman has been stared at
+ */
+ boolean hasBeenStaredAt();
+
+ /**
+ * Sets whether the enderman has been stared at.
+ * If set to true, players will hear an ambient sound.
+ *
+ * @param hasBeenStaredAt whether the enderman has been stared at
+ */
+ void setHasBeenStaredAt(boolean hasBeenStaredAt);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Fox.java b/src/main/java/org/bukkit/entity/Fox.java
index c61a473453f33f9d10c330fc46cfa9d52251fe49..473a7e36ad64f866d1d2e09e2ecb2e9881668faf 100644
--- a/src/main/java/org/bukkit/entity/Fox.java
+++ b/src/main/java/org/bukkit/entity/Fox.java
@@ -92,4 +92,55 @@ public interface Fox extends Animals, Sittable {
RED,
SNOW;
}
+
+ // Paper start - Add more fox behavior API
+ /**
+ * Sets if the fox is interested.
+ *
+ * @param interested is interested
+ */
+ public void setInterested(boolean interested);
+
+ /**
+ * Gets if the fox is interested.
+ *
+ * @return fox is interested
+ */
+ public boolean isInterested();
+
+ /**
+ * Sets if the fox is leaping.
+ *
+ * @param leaping is leaping
+ */
+ public void setLeaping(boolean leaping);
+
+ /**
+ * Gets if the fox is leaping.
+ *
+ * @return fox is leaping
+ */
+ public boolean isLeaping();
+
+ /**
+ * Sets if the fox is defending.
+ *
+ * @param defending is defending
+ */
+ public void setDefending(boolean defending);
+
+ /**
+ * Gets if the fox is defending.
+ *
+ * @return fox is defending
+ */
+ public boolean isDefending();
+
+ /**
+ * Sets if the fox face planted.
+ *
+ * @param faceplanted face planted
+ */
+ public void setFaceplanted(boolean faceplanted);
+ // Paper end - Add more fox behavior API
}
diff --git a/src/main/java/org/bukkit/entity/Ghast.java b/src/main/java/org/bukkit/entity/Ghast.java
index d8eb2b5007091c25a14321cb389f3219d76ce452..0fc8a4fcc3ec2ce60bb095c31eb353337d57be34 100644
--- a/src/main/java/org/bukkit/entity/Ghast.java
+++ b/src/main/java/org/bukkit/entity/Ghast.java
@@ -18,4 +18,21 @@ public interface Ghast extends Flying {
* @param flag Whether the Ghast is charging
*/
void setCharging(boolean flag);
+
+ // Paper start
+ /**
+ * Returns the explosion power of shot fireballs.
+ *
+ * @return explosion power of shot fireballs
+ */
+ int getExplosionPower();
+
+ /**
+ * Sets the explosion power of shot fireballs.
+ *
+ * @param explosionPower explosion power of shot fireballs
+ * @throws IllegalArgumentException if the explosion power is less than 0 or greater than 127
+ */
+ void setExplosionPower(int explosionPower);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java
index 1f027927a1194f4f8e86c1375a2772e6e261c151..57cf24cfd15a541f60aafc8507c189344aead0f7 100644
--- a/src/main/java/org/bukkit/entity/Panda.java
+++ b/src/main/java/org/bukkit/entity/Panda.java
@@ -107,6 +107,87 @@ public interface Panda extends Animals, Sittable {
*/
int getUnhappyTicks();
+ // Paper start - Panda API
+ /**
+ * Sets the sneeze progress in this animation.
+ * This value counts up only if {@link Panda#isSneezing()} is true
+ *
+ * @param ticks sneeze progress
+ */
+ void setSneezeTicks(int ticks);
+
+ /**
+ * Gets the current sneeze progress, or how many ticks this panda will sneeze for.
+ *
+ * @return sneeze progress
+ */
+ int getSneezeTicks();
+
+ /**
+ * Sets the eating ticks for this panda.
+ * <p>
+ *
+ * This starts counting up as long as it is greater than 0.
+ *
+ * @param ticks eating ticks
+ */
+ void setEatingTicks(int ticks);
+
+ /**
+ * Gets the current eating progress, or how many ticks this panda has been eating for.
+ *
+ * @return eating progress
+ */
+ int getEatingTicks();
+
+ /**
+ * Sets the number of ticks this panda will be unhappy for.
+ * <p>
+ * This value counts down.
+ *
+ * @param ticks unhappy ticks
+ */
+ void setUnhappyTicks(int ticks);
+
+ /**
+ * Sets if this panda is currently on its back.
+ *
+ * @param onBack is on its back
+ * @deprecated use {@link #setOnBack(boolean)}
+ */
+ @Deprecated(forRemoval = true)
+ default void setIsOnBack(boolean onBack) {
+ this.setOnBack(onBack);
+ }
+
+ /**
+ * Sets if this panda is currently sitting.
+ *
+ * @param sitting is currently sitting
+ * @deprecated use {@link #setSitting(boolean)}
+ */
+ @Deprecated(forRemoval = true)
+ default void setIsSitting(boolean sitting) {
+ this.setSitting(sitting);
+ }
+
+ /**
+ * Sets if this panda is currently sitting.
+ *
+ * @param sitting is currently sitting
+ */
+ @Override
+ void setSitting(boolean sitting);
+
+ /**
+ * Gets if this panda is sitting.
+ *
+ * @return is sitting
+ */
+ @Override
+ boolean isSitting();
+ // Paper end - Panda API
+
public enum Gene {
NORMAL(false),
diff --git a/src/main/java/org/bukkit/entity/Piglin.java b/src/main/java/org/bukkit/entity/Piglin.java
index 6fdc0e0bb62189dbf3cf9ce7a87b7fbb995956a3..d4cb4b0ed1d9766a87867dcf1a3a839526ba9332 100644
--- a/src/main/java/org/bukkit/entity/Piglin.java
+++ b/src/main/java/org/bukkit/entity/Piglin.java
@@ -90,4 +90,25 @@ public interface Piglin extends PiglinAbstract, InventoryHolder, com.destroystok
*/
@NotNull
public Set<Material> getBarterList();
+
+ // Paper start
+ /**
+ * Causes the piglin to appear as if they are charging
+ * a crossbow.
+ * <p>
+ * This works with any item currently held in the piglin's hand.
+ *
+ * @param chargingCrossbow is charging
+ */
+ void setChargingCrossbow(boolean chargingCrossbow);
+
+ /**
+ * Gets if the piglin is currently charging the
+ * item in their hand.
+ *
+ * @return is charging
+ */
+ boolean isChargingCrossbow();
+ // Paper end
+
}
diff --git a/src/main/java/org/bukkit/entity/PolarBear.java b/src/main/java/org/bukkit/entity/PolarBear.java
index 479f7a7c54c85cb685f56e60906650d1989c03ff..60267ee382de80fab86b440ff72a2455f427d148 100644
--- a/src/main/java/org/bukkit/entity/PolarBear.java
+++ b/src/main/java/org/bukkit/entity/PolarBear.java
@@ -3,4 +3,21 @@ package org.bukkit.entity;
/**
* Represents a polar bear.
*/
-public interface PolarBear extends Animals {}
+// Paper start
+public interface PolarBear extends Animals {
+
+ /**
+ * Returns whether the polar bear is standing.
+ *
+ * @return whether the polar bear is standing
+ */
+ boolean isStanding();
+
+ /**
+ * Sets whether the polar bear is standing.
+ *
+ * @param standing whether the polar bear should be standing
+ */
+ void setStanding(boolean standing);
+}
+// Paper end
diff --git a/src/main/java/org/bukkit/entity/Raider.java b/src/main/java/org/bukkit/entity/Raider.java
index 987f9b0866b213450b4de1310600161c8587a545..144fdcfd1f35b6346b672006905aedb8a3773018 100644
--- a/src/main/java/org/bukkit/entity/Raider.java
+++ b/src/main/java/org/bukkit/entity/Raider.java
@@ -57,4 +57,20 @@ public interface Raider extends Monster {
*/
@NotNull
Sound getCelebrationSound();
+
+ // Paper start
+ /**
+ * Returns whether the raider is celebrating a raid victory.
+ *
+ * @return whether the raider is celebrating a raid victory
+ */
+ boolean isCelebrating();
+
+ /**
+ * Sets whether the raider is celebrating a raid victory.
+ *
+ * @param celebrating whether the raider is celebrating a raid victory
+ */
+ void setCelebrating(boolean celebrating);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java
index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7 100644
--- a/src/main/java/org/bukkit/entity/Trident.java
+++ b/src/main/java/org/bukkit/entity/Trident.java
@@ -3,4 +3,40 @@ package org.bukkit.entity;
/**
* Represents a thrown trident.
*/
-public interface Trident extends AbstractArrow, ThrowableProjectile { }
+// Paper start
+public interface Trident extends AbstractArrow, ThrowableProjectile {
+
+ /**
+ * Returns whether the trident has an enchanted glow.
+ * This can be separate from the underlying item having any enchantments.
+ *
+ * @return whether the trident has an enchanted glow
+ */
+ boolean hasGlint();
+
+ /**
+ * Sets whether the trident has an enchanted glow.
+ * This is separate from the underlying item having any enchantments.
+ *
+ * @param glint whether the trident should have an enchanted glow
+ */
+ void setGlint(boolean glint);
+
+ /**
+ * Returns the loyalty level of the trident.
+ * This can be separate from the underlying item's enchantments.
+ *
+ * @return loyalty level of the trident
+ */
+ int getLoyaltyLevel();
+
+ /**
+ * Sets the loyalty level of the trident.
+ * This is separate from the underlying item's enchantments.
+ *
+ * @param loyaltyLevel loyalty level
+ * @throws IllegalArgumentException if the loyalty level is lower than 0 or greater than 127
+ */
+ void setLoyaltyLevel(int loyaltyLevel);
+}
+// Paper end
diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java
index 627e3c1a96ae3331f5aa2dd7803dd2a31c7204be..3c447d2300c866ae605eeca97bd869f400d6be6f 100644
--- a/src/main/java/org/bukkit/entity/Vex.java
+++ b/src/main/java/org/bukkit/entity/Vex.java
@@ -57,21 +57,30 @@ public interface Vex extends Monster {
* Gets the remaining lifespan of this entity.
*
* @return life in ticks
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
int getLifeTicks();
/**
* Sets the remaining lifespan of this entity.
*
* @param lifeTicks life in ticks, or negative for unlimited lifepan
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
void setLifeTicks(int lifeTicks);
/**
* Gets if the entity has a limited life.
*
* @return true if the entity has limited life
+ * @deprecated This API duplicates existing API which uses the more
+ * preferable name due to mirroring internals better
*/
+ @Deprecated
boolean hasLimitedLife();
// Paper start
@@ -89,5 +98,37 @@ public interface Vex extends Monster {
* @param summoner New summoner
*/
void setSummoner(@Nullable Mob summoner);
+
+ /**
+ * Gets if this vex should start to take damage
+ * once {@link Vex#getLimitedLifetimeTicks()} is less than or equal to 0.
+ *
+ * @return will take damage
+ */
+ boolean hasLimitedLifetime();
+
+ /**
+ * Sets if this vex should start to take damage
+ * once {@link Vex#getLimitedLifetimeTicks()} is less than or equal to 0.
+ *
+ * @param hasLimitedLifetime should take damage
+ */
+ void setLimitedLifetime(boolean hasLimitedLifetime);
+
+ /**
+ * Gets the number of ticks remaining until the vex will start
+ * to take damage.
+ *
+ * @return ticks until the vex will start to take damage
+ */
+ int getLimitedLifetimeTicks();
+
+ /**
+ * Sets the number of ticks remaining until the vex takes damage.
+ * This number is ticked down only if {@link Vex#hasLimitedLifetime()} is true.
+ *
+ * @param ticks ticks remaining
+ */
+ void setLimitedLifetimeTicks(int ticks);
// Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Warden.java b/src/main/java/org/bukkit/entity/Warden.java
index 3794db8867b53f3b3735ad82fdd8765a26df2bfb..efaa45f41bc1dc8df6665c55b4e5ade343d60d4c 100644
--- a/src/main/java/org/bukkit/entity/Warden.java
+++ b/src/main/java/org/bukkit/entity/Warden.java
@@ -30,6 +30,18 @@ public interface Warden extends Monster {
*/
int getAnger(@NotNull Entity entity);
+ // Paper start
+ /**
+ * Gets the highest anger level of this warden.
+ * <p>
+ * Anger is an integer from 0 to 150. Once a Warden reaches 80 anger at a
+ * target it will actively pursue it.
+ *
+ * @return highest anger level
+ */
+ int getHighestAnger();
+ // Paper end
+
/**
* Increases the anger level of this warden.
*
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
index b86f0196e6eb8070830f63a94f732522c2a6c2f1..a1b42ae35dda2da90ba00a2d6666514f7c5b11dd 100644
--- a/src/main/java/org/bukkit/entity/Wither.java
+++ b/src/main/java/org/bukkit/entity/Wither.java
@@ -48,4 +48,35 @@ public interface Wither extends Monster, Boss, com.destroystokyo.paper.entity.Ra
LEFT,
RIGHT
}
+
+ // Paper start
+ /**
+ * @return whether the wither is charged
+ */
+ boolean isCharged();
+
+ /**
+ * @return ticks the wither is invulnerable for
+ */
+ int getInvulnerableTicks();
+
+ /**
+ * Sets for how long in the future, the wither should be invulnerable.
+ *
+ * @param ticks ticks the wither is invulnerable for
+ */
+ void setInvulnerableTicks(int ticks);
+
+ /**
+ * @return whether the wither can travel through portals
+ */
+ boolean canTravelThroughPortals();
+
+ /**
+ * Sets whether the wither can travel through portals.
+ *
+ * @param value whether the wither can travel through portals
+ */
+ void setCanTravelThroughPortals(boolean value);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/ZombieVillager.java b/src/main/java/org/bukkit/entity/ZombieVillager.java
index 7cc1d9a966454af70b7c25735fe474fe3eb97eb4..ad2eaee347cd2864aef30d2af48c1be6dc115c22 100644
--- a/src/main/java/org/bukkit/entity/ZombieVillager.java
+++ b/src/main/java/org/bukkit/entity/ZombieVillager.java
@@ -90,4 +90,22 @@ public interface ZombieVillager extends Zombie {
* @param conversionPlayer the player
*/
void setConversionPlayer(@Nullable OfflinePlayer conversionPlayer);
+
+ // Paper start - missing entity behaviour api - converting without entity event
+ /**
+ * Sets the amount of ticks until this entity will be converted to a
+ * Villager as a result of being cured.
+ * <p>
+ * When this reaches 0, the entity will be converted. A value of less than 0
+ * will stop the current conversion process without converting the current
+ * entity.
+ *
+ * @param time new conversion time
+ * @param broadcastEntityEvent whether this conversion time mutation should broadcast the
+ * org.bukkit.{@link org.bukkit.EntityEffect#ZOMBIE_TRANSFORM} entity event to the
+ * world. If false, no entity event is published, preventing for example the
+ * org.bukkit.{@link org.bukkit.Sound#ENTITY_ZOMBIE_VILLAGER_CURE} from playing.
+ */
+ void setConversionTime(int time, boolean broadcastEntityEvent);
+ // Paper stop - missing entity behaviour api - converting without entity event
}