mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 20:22:05 -07:00
Schoolable Fish API (#7089)
This commit is contained in:
@@ -7,6 +7,72 @@ Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
|
||||
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<T extends Mob> extends Goal<T> {
|
||||
GoalKey<Creature> FLEE_SUN = GoalKey.of(Creature.class, NamespacedKey.minecraft("flee_sun"));
|
||||
GoalKey<Mob> FLOAT = GoalKey.of(Mob.class, NamespacedKey.minecraft("float"));
|
||||
GoalKey<Creature> FOLLOW_BOAT = GoalKey.of(Creature.class, NamespacedKey.minecraft("follow_boat"));
|
||||
- GoalKey<Fish> FOLLOW_FLOCK_LEADER = GoalKey.of(Fish.class, NamespacedKey.minecraft("follow_flock_leader"));
|
||||
+ GoalKey<io.papermc.paper.entity.SchoolableFish> FOLLOW_FLOCK_LEADER = GoalKey.of(io.papermc.paper.entity.SchoolableFish.class, NamespacedKey.minecraft("follow_flock_leader"));
|
||||
GoalKey<Mob> FOLLOW_MOB = GoalKey.of(Mob.class, NamespacedKey.minecraft("follow_mob"));
|
||||
GoalKey<Tameable> FOLLOW_OWNER = GoalKey.of(Tameable.class, NamespacedKey.minecraft("follow_owner"));
|
||||
GoalKey<Animals> 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
|
||||
@@ -254,6 +320,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ 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
|
||||
@@ -782,6 +858,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+}
|
||||
+// 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
|
||||
@@ -828,6 +914,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ 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
|
||||
|
Reference in New Issue
Block a user