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 Co-authored-by: Jake Potrebic Co-authored-by: William Blake Galbreath diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java +++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java @@ -0,0 +0,0 @@ public interface VanillaGoal extends Goal { GoalKey FLEE_SUN = GoalKey.of(Creature.class, NamespacedKey.minecraft("flee_sun")); GoalKey FLOAT = GoalKey.of(Mob.class, NamespacedKey.minecraft("float")); GoalKey FOLLOW_BOAT = GoalKey.of(Creature.class, NamespacedKey.minecraft("follow_boat")); - GoalKey FOLLOW_FLOCK_LEADER = GoalKey.of(Fish.class, NamespacedKey.minecraft("follow_flock_leader")); + GoalKey FOLLOW_FLOCK_LEADER = GoalKey.of(io.papermc.paper.entity.SchoolableFish.class, NamespacedKey.minecraft("follow_flock_leader")); GoalKey FOLLOW_MOB = GoalKey.of(Mob.class, NamespacedKey.minecraft("follow_mob")); GoalKey FOLLOW_OWNER = GoalKey.of(Tameable.class, NamespacedKey.minecraft("follow_owner")); GoalKey FOLLOW_PARENT = GoalKey.of(Animals.class, NamespacedKey.minecraft("follow_parent")); diff --git a/src/main/java/io/papermc/paper/entity/SchoolableFish.java b/src/main/java/io/papermc/paper/entity/SchoolableFish.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 --- /dev/null +++ b/src/main/java/io/papermc/paper/entity/SchoolableFish.java @@ -0,0 +0,0 @@ +package io.papermc.paper.entity; + +import org.bukkit.entity.Fish; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Represents a fish that can school with other fish. + */ +public interface SchoolableFish extends Fish { + + /** + * Forces this fish to follow the given fish. + * + * @param leader fish to follow + */ + void startFollowing(@NotNull SchoolableFish leader); + + /** + * Causes the fish to stop following their current + * leader. + */ + void stopFollowing(); + + /** + * Gets the amount of fish currently following this fish. + * + * @return school size + */ + int getSchoolSize(); + + /** + * Gets the maximum number of fish that will naturally follow this fish. + * + * @return max school size + */ + int getMaxSchoolSize(); + + /** + * Gets the fish that this entity is currently following. + * + * @return following fish + */ + @Nullable + SchoolableFish getSchoolLeader(); + +} diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/AbstractHorse.java +++ b/src/main/java/org/bukkit/entity/AbstractHorse.java @@ -0,0 +0,0 @@ public interface AbstractHorse extends Vehicle, InventoryHolder, Tameable { * Gets whether the horse is currently grazing hay. * * @return true if eating hay + * @deprecated use {@link #isEatingGrass()}, this name is incorrect */ + @Deprecated // Paper - Horse API boolean isEatingHaystack(); /** * Sets whether the horse is grazing hay. * * @param eatingHaystack new hay grazing status + * @deprecated use {@link #setEatingGrass(boolean)}, this name is incorrect */ + @Deprecated // Paper - Horse API void setEatingHaystack(boolean eatingHaystack); @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 + */ + public boolean isEatingGrass(); + + /** + * Sets if a horse is in their eating grass animation. + * + *

When true, the horse will lower its neck.

+ * + * @param eating eating grass animation is active + */ + 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. + * + *

When true, the horse will stand on its hind legs.

+ * + * @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. + * + *

When true, the horse will bob its head.

+ * + * @param eating eating animation is active + */ + public void setEating(boolean eating); + // Paper end - Horse API } diff --git a/src/main/java/org/bukkit/entity/Bat.java b/src/main/java/org/bukkit/entity/Bat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Bat.java +++ b/src/main/java/org/bukkit/entity/Bat.java @@ -0,0 +0,0 @@ public interface Bat extends Ambient { * @param state the new state */ void setAwake(boolean state); + + // Paper start + /** + * Gets the location that this bat is currently trying to move towards. + * + * @return target location, or null if it's going to find a new location + */ + @org.jetbrains.annotations.Nullable + org.bukkit.Location getTargetLocation(); + + /** + * Sets the location that this bat is currently trying to move towards. + *

+ * This can be set to null to cause the bat to recalculate its target location + * + * @param location location to move towards (world is ignored, will always use the entity's world) + */ + void setTargetLocation(@org.jetbrains.annotations.Nullable org.bukkit.Location location); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/Bee.java b/src/main/java/org/bukkit/entity/Bee.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Bee.java +++ b/src/main/java/org/bukkit/entity/Bee.java @@ -0,0 +0,0 @@ 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(); + + /** + * Sets how many crops this bee has grown since it last + * pollinated. + * @param crops number of crops + */ + void setCropsGrownSincePollination(int crops); + + /** + * Gets how many crops this bee has grown since it last + * pollinated. + * @return number of crops + */ + int getCropsGrownSincePollination(); + + /** + * Sets how many ticks this bee has gone without pollinating. + * + * @param ticks number of ticks + */ + void setTicksSincePollination(int ticks); + + /** + * Gets how many ticks this bee has gone without pollinating + * + * @return number of ticks + */ + int getTicksSincePollination(); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/Cat.java b/src/main/java/org/bukkit/entity/Cat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Cat.java +++ b/src/main/java/org/bukkit/entity/Cat.java @@ -0,0 +0,0 @@ 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/Chicken.java b/src/main/java/org/bukkit/entity/Chicken.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Chicken.java +++ b/src/main/java/org/bukkit/entity/Chicken.java @@ -0,0 +0,0 @@ package org.bukkit.entity; /** * Represents a Chicken. */ -public interface Chicken extends Animals {} +// Paper start +public interface Chicken extends Animals { + + /** + * Gets if this chicken was spawned as a chicken jockey. + * + * @return is chicken jockey + */ + boolean isChickenJockey(); + + /** + * Sets if this chicken was spawned as a chicken jockey. + * + * @param isChickenJockey is chicken jockey + */ + void setIsChickenJockey(boolean isChickenJockey); + + /** + * Gets the number of ticks till this chicken lays an egg. + * + * @return ticks till the chicken lays an egg + */ + int getEggLayTime(); + + /** + * Sets the number of ticks till this chicken lays an egg. + * + * @param eggLayTime ticks till the chicken lays an egg + */ + void setEggLayTime(int eggLayTime); +} +// Paper end diff --git a/src/main/java/org/bukkit/entity/Cod.java b/src/main/java/org/bukkit/entity/Cod.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Cod.java +++ b/src/main/java/org/bukkit/entity/Cod.java @@ -0,0 +0,0 @@ package org.bukkit.entity; /** * Represents a cod fish. */ -public interface Cod extends Fish { } +public interface Cod extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Enderman.java +++ b/src/main/java/org/bukkit/entity/Enderman.java @@ -0,0 +0,0 @@ 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/Endermite.java b/src/main/java/org/bukkit/entity/Endermite.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Endermite.java +++ b/src/main/java/org/bukkit/entity/Endermite.java @@ -0,0 +0,0 @@ public interface Endermite extends Monster { */ @Deprecated void setPlayerSpawned(boolean playerSpawned); + // Paper start + /** + * Sets how many ticks this endermite has been living for. + * If this value is greater than 2400, this endermite will despawn. + * + * @param ticks lifetime ticks + */ + void setLifetimeTicks(int ticks); + + /** + * Gets how long this endermite has been living for. + * This value will tick up while {@link LivingEntity#getRemoveWhenFarAway()} is false. + * If this value is greater than 2400, this endermite will despawn. + * + * @return lifetime ticks + */ + int getLifetimeTicks(); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/Fox.java b/src/main/java/org/bukkit/entity/Fox.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Fox.java +++ b/src/main/java/org/bukkit/entity/Fox.java @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Ghast.java +++ b/src/main/java/org/bukkit/entity/Ghast.java @@ -0,0 +0,0 @@ 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/Llama.java b/src/main/java/org/bukkit/entity/Llama.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Llama.java +++ b/src/main/java/org/bukkit/entity/Llama.java @@ -0,0 +0,0 @@ public interface Llama extends ChestedHorse, RangedEntity { // Paper @NotNull @Override LlamaInventory getInventory(); + + // Paper start + /** + * Checks if this llama is in a caravan. + * This means that this llama is currently following + * another llama. + * + * @return is in caravan + */ + boolean inCaravan(); + + /** + * Joins a caravan, with the provided llama being the leader + * of the caravan. + * This llama will then follow the provided llama. + * + * @param llama head of caravan to join + */ + void joinCaravan(@NotNull Llama llama); + + /** + * Leaves the current caravan that they are in. + */ + void leaveCaravan(); + + /** + * Get the llama that this llama is following. + *

+ * Does not necessarily mean the leader of the entire caravan. + * + * @return the llama currently being followed + */ + @org.jetbrains.annotations.Nullable + Llama getCaravanHead(); + + /** + * Checks if another llama is currently following behind + * this llama. + * + * @return true if being followed in the caravan + */ + boolean hasCaravanTail(); + + /** + * Gets the llama that is currently following behind + * this llama. + * + * @return the llama following this llama, or null if none is following them + */ + @org.jetbrains.annotations.Nullable + Llama getCaravanTail(); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/MushroomCow.java +++ b/src/main/java/org/bukkit/entity/MushroomCow.java @@ -0,0 +0,0 @@ public interface MushroomCow extends Cow { */ BROWN; } + // Paper start + + /** + * Gets how long the effect applied to stew + * from this mushroom cow is. + * + * @return duration of the effect (in ticks) + */ + int getStewEffectDuration(); + + /** + * Sets how long the effect applied to stew + * from this mushroom cow is. + * + * @param duration duration of the effect (in ticks) + */ + void setStewEffectDuration(int duration); + + /** + * Gets the type of effect applied to stew + * from this mushroom cow is. + * + * @return effect type, or null if an effect is currently not set + */ + @org.jetbrains.annotations.Nullable + org.bukkit.potion.PotionEffectType getStewEffectType(); + + /** + * Sets the type of effect applied to stew + * from this mushroom cow is. + * + * @param type new effect type + * or null if this cow does not give effects + */ + void setStewEffect(@org.jetbrains.annotations.Nullable org.bukkit.potion.PotionEffectType type); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/Panda.java b/src/main/java/org/bukkit/entity/Panda.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Panda.java +++ b/src/main/java/org/bukkit/entity/Panda.java @@ -0,0 +0,0 @@ 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. + *

+ * + * 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. + *

+ * 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/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Phantom.java +++ b/src/main/java/org/bukkit/entity/Phantom.java @@ -0,0 +0,0 @@ public interface Phantom extends Flying { * @param shouldBurnInDay True to burn in sunlight */ public void setShouldBurnInDay(boolean shouldBurnInDay); + + /** + * Gets the location that this phantom circles around when not attacking a player + * This will be changed after attacking a player. + * + * @return circling location + */ + @org.jetbrains.annotations.NotNull + org.bukkit.Location getAnchorLocation(); + + /** + * Sets the location that this phantom circles around when not attacking a player + * + * @param location circling location (world is ignored, will always use the entity's world) + */ + void setAnchorLocation(@org.jetbrains.annotations.NotNull org.bukkit.Location location); // Paper end } diff --git a/src/main/java/org/bukkit/entity/Piglin.java b/src/main/java/org/bukkit/entity/Piglin.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Piglin.java +++ b/src/main/java/org/bukkit/entity/Piglin.java @@ -0,0 +0,0 @@ public interface Piglin extends PiglinAbstract, InventoryHolder, com.destroystok */ @NotNull public Set getBarterList(); + + // Paper start + /** + * Causes the piglin to appear as if they are charging + * a crossbow. + *

+ * 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/PolarBear.java +++ b/src/main/java/org/bukkit/entity/PolarBear.java @@ -0,0 +0,0 @@ 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/Rabbit.java b/src/main/java/org/bukkit/entity/Rabbit.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Rabbit.java +++ b/src/main/java/org/bukkit/entity/Rabbit.java @@ -0,0 +0,0 @@ public interface Rabbit extends Animals { * @param type Sets the type of rabbit for this entity. */ public void setRabbitType(@NotNull Type type); + // Paper start + /** + * Sets how many ticks this rabbit will wait + * until trying to find more carrots. + * + * @param ticks ticks + */ + void setMoreCarrotTicks(int ticks); + + /** + * Returns how many ticks this rabbit + * will wait until trying to find more carrots. + * + * @return ticks + */ + int getMoreCarrotTicks(); + // Paper end /** * Represents the various types a Rabbit might be. diff --git a/src/main/java/org/bukkit/entity/Raider.java b/src/main/java/org/bukkit/entity/Raider.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Raider.java +++ b/src/main/java/org/bukkit/entity/Raider.java @@ -0,0 +0,0 @@ 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/Ravager.java b/src/main/java/org/bukkit/entity/Ravager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Ravager.java +++ b/src/main/java/org/bukkit/entity/Ravager.java @@ -0,0 +0,0 @@ package org.bukkit.entity; /** * Illager beast. */ -public interface Ravager extends Raider { } +// Paper start - Missing Entity Behavior +public interface Ravager extends Raider { + + /** + * Gets how many ticks this ravager is attacking for. + * When attacking, the ravager cannot move. + * + * @return ticks attacking or -1 if they are currently not attacking + */ + int getAttackTicks(); + + /** + * Sets how many ticks this ravager is attacking for. + * When attacking, the ravager cannot move. + * This will tick down till it gets to -1, where this ravager will no longer be attacking. + * + * @param ticks ticks attacking or -1 if they should no longer be attacking + */ + void setAttackTicks(int ticks); + + /** + * Gets how many ticks the ravager is stunned for. + * The ravager cannot move or attack while stunned. + * At 0, this will cause the ravager to roar. + * + * @return ticks stunned or -1 if they are currently not stunned + */ + int getStunnedTicks(); + + /** + * Sets how many ticks the ravager is stunned for. + * The ravager cannot move or attack while stunned. + * At 0, this will cause the ravager to roar. + * + * @param ticks ticks stunned or -1 if they should no longer be stunned + */ + void setStunnedTicks(int ticks); + + /** + * Gets how many ticks the ravager is roaring for. + * While roaring, the ravager cannot move + * + * @return ticks roaring or -1 if they are currently not roaring + */ + int getRoarTicks(); + + /** + * Sets how many ticks the ravager is roaring for. + * While roaring, the ravager cannot move + * This will tick down till it gets to -1, where it is no longer active. + * If set to 11, this will play a sound and hurt nearby players. + * + * @param ticks ticks roaring or -1 if they should no longer be roaring + */ + void setRoarTicks(int ticks); + +} +// Paper end diff --git a/src/main/java/org/bukkit/entity/Salmon.java b/src/main/java/org/bukkit/entity/Salmon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Salmon.java +++ b/src/main/java/org/bukkit/entity/Salmon.java @@ -0,0 +0,0 @@ package org.bukkit.entity; /** * Represents a salmon fish. */ -public interface Salmon extends Fish { } +public interface Salmon extends io.papermc.paper.entity.SchoolableFish { } // Paper - Schooling Fish API diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Trident.java +++ b/src/main/java/org/bukkit/entity/Trident.java @@ -0,0 +0,0 @@ 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/TropicalFish.java b/src/main/java/org/bukkit/entity/TropicalFish.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/TropicalFish.java +++ b/src/main/java/org/bukkit/entity/TropicalFish.java @@ -0,0 +0,0 @@ import org.jetbrains.annotations.NotNull; /** * Tropical fish. */ -public interface TropicalFish extends Fish { +public interface TropicalFish extends io.papermc.paper.entity.SchoolableFish { // Paper - Schooling Fish API /** * Gets the color of the fish's pattern. diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Vex.java +++ b/src/main/java/org/bukkit/entity/Vex.java @@ -0,0 +0,0 @@ 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 @@ -0,0 +0,0 @@ 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/WanderingTrader.java b/src/main/java/org/bukkit/entity/WanderingTrader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/WanderingTrader.java +++ b/src/main/java/org/bukkit/entity/WanderingTrader.java @@ -0,0 +0,0 @@ public interface WanderingTrader extends AbstractVillager { * @return whether the mob will drink */ public boolean canDrinkMilk(); + + /** + * Gets the location that this wandering trader is currently + * wandering towards. + *

+ * This will return null if the wandering trader has finished + * wandering towards the given location. + * + * @return the location currently wandering towards, or null if not wandering + */ + @org.jetbrains.annotations.Nullable + org.bukkit.Location getWanderingTowards(); + + /** + * Sets the location that this wandering trader is currently wandering towards. + *

+ * This can be set to null to prevent the wandering trader from wandering further. + * + * @param location location to wander towards (world is ignored, will always use the entity's world) + */ + void setWanderingTowards(@org.jetbrains.annotations.Nullable org.bukkit.Location location); // Paper end } diff --git a/src/main/java/org/bukkit/entity/Warden.java b/src/main/java/org/bukkit/entity/Warden.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Warden.java +++ b/src/main/java/org/bukkit/entity/Warden.java @@ -0,0 +0,0 @@ public interface Warden extends Monster { */ int getAnger(@NotNull Entity entity); + // Paper start + /** + * Gets the highest anger level of this warden. + *

+ * 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Wither.java +++ b/src/main/java/org/bukkit/entity/Wither.java @@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/ZombieVillager.java +++ b/src/main/java/org/bukkit/entity/ZombieVillager.java @@ -0,0 +0,0 @@ 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. + *

+ * 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 } diff --git a/src/main/java/org/bukkit/entity/minecart/ExplosiveMinecart.java b/src/main/java/org/bukkit/entity/minecart/ExplosiveMinecart.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/minecart/ExplosiveMinecart.java +++ b/src/main/java/org/bukkit/entity/minecart/ExplosiveMinecart.java @@ -0,0 +0,0 @@ import org.bukkit.entity.Minecart; * Represents a Minecart with TNT inside it that can explode when triggered. */ public interface ExplosiveMinecart extends Minecart { + // Paper start - Entity API + /** + * Set the number of ticks until the minecart explodes after being primed. + * + * @param fuseTicks fuse ticks or -1 if the fuse isn't primed + */ + void setFuseTicks(int fuseTicks); + + /** + * Retrieve the number of ticks until the explosive minecart explodes + * + * @return number of ticks or -1 if the fuse isn't primed + */ + int getFuseTicks(); + // Paper end } diff --git a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java +++ b/src/main/java/org/bukkit/entity/minecart/HopperMinecart.java @@ -0,0 +0,0 @@ public interface HopperMinecart extends Minecart, InventoryHolder, LootableEntit * @param enabled new enabled state */ void setEnabled(boolean enabled); + // Paper start + /** + * Gets the number of ticks that this hopper minecart cannot pickup items up for. + * + * @return ticks left on cooldown + */ + int getPickupCooldown(); + + /** + * Sets the number of ticks that this hopper minecart cannot pickup items for. + * + * @param cooldown cooldown length in ticks + */ + void setPickupCooldown(int cooldown); + // Paper end }