Schoolable Fish API (#7089)
This commit is contained in:
parent
4048d3ec68
commit
f59c802697
|
@ -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: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
Co-authored-by: William Blake Galbreath <blake.galbreath@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 8fd399f791b45eb7fc62693ca954eea0c68e2881..2e9006700782924aa8f79e48194200cb1f13110f 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/VanillaGoal.java
|
||||||
|
@@ -23,7 +23,7 @@ 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..39ad7d283609d7e427a2ab35b6fad839e032fe92
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/entity/SchoolableFish.java
|
||||||
|
@@ -0,0 +1,47 @@
|
||||||
|
+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
|
diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||||
index 0d88dce9978243a1f995c5fb448c5d71b01136eb..8b1048c94dffd058eb9fd9144f7f59fc9bd219ad 100644
|
index 0d88dce9978243a1f995c5fb448c5d71b01136eb..8b1048c94dffd058eb9fd9144f7f59fc9bd219ad 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
|
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||||
|
@ -254,6 +320,16 @@ index cb3ec6ef6c38c2071cb6ad91da094fca2de8d5c6..b4c1a262602d4ca5ffc9fcc21d6aa79a
|
||||||
+ void setEggLayTime(int eggLayTime);
|
+ void setEggLayTime(int eggLayTime);
|
||||||
+}
|
+}
|
||||||
+// Paper end
|
+// Paper end
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/Cod.java b/src/main/java/org/bukkit/entity/Cod.java
|
||||||
|
index 191ce6c0e32ab3d05b1376e0fa56d1292c2d442c..8de09075e14a08a6c68f9c24e8960cc04a018036 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/Cod.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/Cod.java
|
||||||
|
@@ -4,4 +4,4 @@ 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
|
diff --git a/src/main/java/org/bukkit/entity/Enderman.java b/src/main/java/org/bukkit/entity/Enderman.java
|
||||||
index 94f3a8c4bf8cf14263d34d866db66728e98dfdb0..7937a0e082199554d3e8db1f9811be29abc9b3fd 100644
|
index 94f3a8c4bf8cf14263d34d866db66728e98dfdb0..7937a0e082199554d3e8db1f9811be29abc9b3fd 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Enderman.java
|
--- a/src/main/java/org/bukkit/entity/Enderman.java
|
||||||
|
@ -782,6 +858,16 @@ index 4374d5206d4d15a4d8d228c137ed9a96821a1f02..0eb7214472f3a43641a3526000af6bee
|
||||||
+
|
+
|
||||||
+}
|
+}
|
||||||
+// Paper end
|
+// Paper end
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/Salmon.java b/src/main/java/org/bukkit/entity/Salmon.java
|
||||||
|
index a52a7af219633d575dcbe8ac4b219834bfd4d4d2..1e839b247182af6873a4d74b236d6412817c18bf 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/Salmon.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/Salmon.java
|
||||||
|
@@ -4,4 +4,4 @@ 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
|
diff --git a/src/main/java/org/bukkit/entity/Trident.java b/src/main/java/org/bukkit/entity/Trident.java
|
||||||
index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7 100644
|
index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f3785d9c7 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Trident.java
|
--- a/src/main/java/org/bukkit/entity/Trident.java
|
||||||
|
@ -828,6 +914,19 @@ index 28cdb3b544572ba7aeb9061e3163e3895ac7d4e6..c8015ff610e3c1222cb368ea1d8a0c2f
|
||||||
+ void setLoyaltyLevel(int loyaltyLevel);
|
+ void setLoyaltyLevel(int loyaltyLevel);
|
||||||
+}
|
+}
|
||||||
+// Paper end
|
+// Paper end
|
||||||
|
diff --git a/src/main/java/org/bukkit/entity/TropicalFish.java b/src/main/java/org/bukkit/entity/TropicalFish.java
|
||||||
|
index bc5055f2d96addb722d576a9ed1dfad3deb203ed..bbe4324370812fdac1190242122762a55910626a 100644
|
||||||
|
--- a/src/main/java/org/bukkit/entity/TropicalFish.java
|
||||||
|
+++ b/src/main/java/org/bukkit/entity/TropicalFish.java
|
||||||
|
@@ -6,7 +6,7 @@ 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
|
diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java
|
||||||
index 627e3c1a96ae3331f5aa2dd7803dd2a31c7204be..3c447d2300c866ae605eeca97bd869f400d6be6f 100644
|
index 627e3c1a96ae3331f5aa2dd7803dd2a31c7204be..3c447d2300c866ae605eeca97bd869f400d6be6f 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Vex.java
|
--- a/src/main/java/org/bukkit/entity/Vex.java
|
||||||
|
|
|
@ -26,11 +26,96 @@ public net.minecraft.world.entity.vehicle.MinecartHopper cooldownTime
|
||||||
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
|
public net.minecraft.world.entity.projectile.AbstractArrow soundEvent
|
||||||
public net.minecraft.world.entity.monster.Phantom anchorPoint
|
public net.minecraft.world.entity.monster.Phantom anchorPoint
|
||||||
public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
|
public net.minecraft.world.entity.npc.WanderingTrader getWanderTarget()Lnet/minecraft/core/BlockPos;
|
||||||
|
public net.minecraft.world.entity.animal.AbstractSchoolingFish leader
|
||||||
|
public net.minecraft.world.entity.animal.AbstractSchoolingFish schoolSize
|
||||||
|
|
||||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||||
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||||
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
Co-authored-by: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
|
|
||||||
|
diff --git a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
||||||
|
index c9901f8c7f3af57cb2e0bec315caa97adcb6f5ea..8f47d471c29d89bae5ae06a0d495d8c694117b72 100644
|
||||||
|
--- a/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
||||||
|
+++ b/src/main/java/com/destroystokyo/paper/entity/ai/MobGoalHelper.java
|
||||||
|
@@ -163,7 +163,7 @@ public class MobGoalHelper {
|
||||||
|
bukkitMap.put(net.minecraft.world.entity.monster.Endermite.class, Endermite.class);
|
||||||
|
bukkitMap.put(net.minecraft.world.entity.monster.Evoker.class, Evoker.class);
|
||||||
|
bukkitMap.put(AbstractFish.class, Fish.class);
|
||||||
|
- bukkitMap.put(AbstractSchoolingFish.class, Fish.class); // close enough
|
||||||
|
+ bukkitMap.put(AbstractSchoolingFish.class, io.papermc.paper.entity.SchoolableFish.class);
|
||||||
|
bukkitMap.put(FlyingMob.class, Flying.class);
|
||||||
|
bukkitMap.put(net.minecraft.world.entity.animal.Fox.class, Fox.class);
|
||||||
|
bukkitMap.put(net.minecraft.world.entity.monster.Ghast.class, Ghast.class);
|
||||||
|
diff --git a/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000000000000000000000000000000000000..41bf71d116ffc5431586ce54abba7f8def6c1dcf
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/src/main/java/io/papermc/paper/entity/PaperSchoolableFish.java
|
||||||
|
@@ -0,0 +1,52 @@
|
||||||
|
+package io.papermc.paper.entity;
|
||||||
|
+
|
||||||
|
+import net.minecraft.world.entity.animal.AbstractSchoolingFish;
|
||||||
|
+import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
+import org.bukkit.craftbukkit.entity.CraftFish;
|
||||||
|
+import org.jetbrains.annotations.NotNull;
|
||||||
|
+
|
||||||
|
+public class PaperSchoolableFish extends CraftFish implements SchoolableFish {
|
||||||
|
+
|
||||||
|
+ public PaperSchoolableFish(CraftServer server, AbstractSchoolingFish entity) {
|
||||||
|
+ super(server, entity);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public AbstractSchoolingFish getHandle() {
|
||||||
|
+ return (AbstractSchoolingFish) super.getHandle();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void startFollowing(@NotNull SchoolableFish fish) {
|
||||||
|
+ if (this.getHandle().isFollower()) { // If following a fish already, properly remove the old one
|
||||||
|
+ this.stopFollowing();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ this.getHandle().startFollowing(((PaperSchoolableFish) fish).getHandle());
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public void stopFollowing() {
|
||||||
|
+ this.getHandle().stopFollowing();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public int getSchoolSize() {
|
||||||
|
+ return this.getHandle().schoolSize;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public int getMaxSchoolSize() {
|
||||||
|
+ return this.getHandle().getMaxSchoolSize();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ @Override
|
||||||
|
+ public SchoolableFish getSchoolLeader() {
|
||||||
|
+ AbstractSchoolingFish leader = this.getHandle().leader;
|
||||||
|
+ if (leader == null) {
|
||||||
|
+ return null;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return (SchoolableFish) leader.getBukkitEntity();
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
|
||||||
|
index e2efbf08e39f8966cb75c9f06f8e0990fbc1dbb4..ebe6ded8adc9de83f94d5a17968563916bc3ef9e 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/entity/animal/AbstractSchoolingFish.java
|
||||||
|
@@ -52,6 +52,7 @@ public abstract class AbstractSchoolingFish extends AbstractFish {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stopFollowing() {
|
||||||
|
+ if (this.leader == null) return; // Avoid NPE, plugins can now set the leader and certain fish goals might cause this method to be called
|
||||||
|
this.leader.removeFollower();
|
||||||
|
this.leader = null;
|
||||||
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
index 66293e620dcf2c7ee3e2fc91f8a7cf52f2950de1..f2243f65cdf0e4b327e8597dfefe5b2de8912cef 100644
|
index 66293e620dcf2c7ee3e2fc91f8a7cf52f2950de1..f2243f65cdf0e4b327e8597dfefe5b2de8912cef 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||||
|
@ -207,6 +292,36 @@ index c5b82dcf6c9da9d6699f699c3e13d9b949128cc8..d890446315787b7aaa2869637e905c25
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
|
protected EntityHitResult findHitEntity(Vec3 currentPosition, Vec3 nextPosition) {
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
|
index d1fca0e3227b5f37c11367548be362f5a49b6a71..11ee6a2b264b570b61facec5625f6257259432bd 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
|
@@ -797,14 +797,19 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||||
|
} else if (Phantom.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = net.minecraft.world.entity.EntityType.PHANTOM.create(world);
|
||||||
|
} else if (Fish.class.isAssignableFrom(clazz)) {
|
||||||
|
- if (Cod.class.isAssignableFrom(clazz)) {
|
||||||
|
- entity = net.minecraft.world.entity.EntityType.COD.create(world);
|
||||||
|
+ // Paper start - Schooling Fish API
|
||||||
|
+ if (io.papermc.paper.entity.SchoolableFish.class.isAssignableFrom(clazz)) {
|
||||||
|
+ if (Cod.class.isAssignableFrom(clazz)) {
|
||||||
|
+ entity = net.minecraft.world.entity.EntityType.COD.create(world);
|
||||||
|
+ } else if (Salmon.class.isAssignableFrom(clazz)) {
|
||||||
|
+ entity = net.minecraft.world.entity.EntityType.SALMON.create(world);
|
||||||
|
+ } else if (TropicalFish.class.isAssignableFrom(clazz)) {
|
||||||
|
+ entity = net.minecraft.world.entity.EntityType.TROPICAL_FISH.create(world);
|
||||||
|
+ }
|
||||||
|
+ // Paper stop
|
||||||
|
} else if (PufferFish.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = net.minecraft.world.entity.EntityType.PUFFERFISH.create(world);
|
||||||
|
- } else if (Salmon.class.isAssignableFrom(clazz)) {
|
||||||
|
- entity = net.minecraft.world.entity.EntityType.SALMON.create(world);
|
||||||
|
- } else if (TropicalFish.class.isAssignableFrom(clazz)) {
|
||||||
|
- entity = net.minecraft.world.entity.EntityType.TROPICAL_FISH.create(world);
|
||||||
|
+ // Paper - remove old fish impl
|
||||||
|
} else if (Tadpole.class.isAssignableFrom(clazz)) {
|
||||||
|
entity = net.minecraft.world.entity.EntityType.TADPOLE.create(world);
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
||||||
index 254d4f2e45d7c8f572a4368eccd84560d4d0d836..299ab868252c8f326e3a56e878c9ee230c9635dc 100644
|
index 254d4f2e45d7c8f572a4368eccd84560d4d0d836..299ab868252c8f326e3a56e878c9ee230c9635dc 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java
|
||||||
|
@ -385,6 +500,19 @@ index 178328042ad62f32ca2ae14a6bcf2b694418eb8c..fd87f979ee207dac13e4028d76bdd409
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
|
||||||
|
index fb4b3d30eded561f526dbd2daa74e49149eb55ac..801ed8241cad4ac890a6d99cd19a3dd7490d9339 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCod.java
|
||||||
|
@@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.entity.Cod;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
|
-public class CraftCod extends CraftFish implements Cod {
|
||||||
|
+public class CraftCod extends io.papermc.paper.entity.PaperSchoolableFish implements Cod { // Paper - School Fish API
|
||||||
|
|
||||||
|
public CraftCod(CraftServer server, net.minecraft.world.entity.animal.Cod entity) {
|
||||||
|
super(server, entity);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
||||||
index ae669a970aa1f17ed786640de8a481364543c58e..acdc4e578d70f8121c8c6be7682ba1ecef7687cf 100644
|
index ae669a970aa1f17ed786640de8a481364543c58e..acdc4e578d70f8121c8c6be7682ba1ecef7687cf 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java
|
||||||
|
@ -438,6 +566,30 @@ index 04976616da8c85b1278dad33ff05554aa74a6b33..75c7645fb5732c43d1da15181cf5c7ee
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
index d34e1da89e04df311c1627f43790851c23fef0b0..cc86c455588f33463100a58f3be6f21e26dda5da 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
|
@@ -223,10 +223,16 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
|
else { return new CraftSquid(server, (Squid) entity); }
|
||||||
|
}
|
||||||
|
else if (entity instanceof AbstractFish) {
|
||||||
|
- if (entity instanceof Cod) { return new CraftCod(server, (Cod) entity); }
|
||||||
|
+ // Paper start - Schooling Fish API
|
||||||
|
+ if (entity instanceof net.minecraft.world.entity.animal.AbstractSchoolingFish abstractSchoolingFish) {
|
||||||
|
+ if (entity instanceof Cod) { return new CraftCod(server, (Cod) entity); }
|
||||||
|
+ else if (entity instanceof Salmon) { return new CraftSalmon(server, (Salmon) entity); }
|
||||||
|
+ else if (entity instanceof TropicalFish) { return new CraftTropicalFish(server, (TropicalFish) entity); }
|
||||||
|
+ else { return new io.papermc.paper.entity.PaperSchoolableFish(server, abstractSchoolingFish); }
|
||||||
|
+ }
|
||||||
|
+ // Paper end
|
||||||
|
else if (entity instanceof Pufferfish) { return new CraftPufferFish(server, (Pufferfish) entity); }
|
||||||
|
- else if (entity instanceof Salmon) { return new CraftSalmon(server, (Salmon) entity); }
|
||||||
|
- else if (entity instanceof TropicalFish) { return new CraftTropicalFish(server, (TropicalFish) entity); }
|
||||||
|
+ // Paper - move fish
|
||||||
|
else if (entity instanceof Tadpole) { return new CraftTadpole(server, (Tadpole) entity); }
|
||||||
|
else { return new CraftFish(server, (AbstractFish) entity); }
|
||||||
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
||||||
index f6369a1b0ea3fc64e9e7902d9da25924a0745855..fce96b67300b8808984904ee19d4e987f5235bfd 100644
|
index f6369a1b0ea3fc64e9e7902d9da25924a0745855..fce96b67300b8808984904ee19d4e987f5235bfd 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFox.java
|
||||||
|
@ -818,6 +970,19 @@ index 796b784d7a50e3a4aea5c67b7cd16d288ed392b0..84899714b96a7ed31ceee10373a62c37
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
|
||||||
|
index f27a451f2e2343ab66c8cae24053fd1b6a0ea086..c888415f9b4f19db69667525e37279ab8be794f6 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSalmon.java
|
||||||
|
@@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.Salmon;
|
||||||
|
|
||||||
|
-public class CraftSalmon extends CraftFish implements Salmon {
|
||||||
|
+public class CraftSalmon extends io.papermc.paper.entity.PaperSchoolableFish implements Salmon { // Paper - Schooling Fish API
|
||||||
|
|
||||||
|
public CraftSalmon(CraftServer server, net.minecraft.world.entity.animal.Salmon entity) {
|
||||||
|
super(server, entity);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
||||||
index bf5b2fd6676c4430578db4cc6c603c501cc5e349..832981b07ef5c633ef00a382f56798ee87eec0df 100644
|
index bf5b2fd6676c4430578db4cc6c603c501cc5e349..832981b07ef5c633ef00a382f56798ee87eec0df 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
|
||||||
|
@ -850,6 +1015,19 @@ index bf5b2fd6676c4430578db4cc6c603c501cc5e349..832981b07ef5c633ef00a382f56798ee
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
||||||
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
||||||
|
index aca8111f7e435d7ab5499b0bba4100c6bc4cd079..e37abe9e28b6e2ff4fe892357300d3d0d205fecd 100644
|
||||||
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
||||||
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTropicalFish.java
|
||||||
|
@@ -8,7 +8,7 @@ import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.TropicalFish;
|
||||||
|
import org.bukkit.entity.TropicalFish.Pattern;
|
||||||
|
|
||||||
|
-public class CraftTropicalFish extends CraftFish implements TropicalFish {
|
||||||
|
+public class CraftTropicalFish extends io.papermc.paper.entity.PaperSchoolableFish implements TropicalFish { // Paper - Schooling Fish API
|
||||||
|
|
||||||
|
public CraftTropicalFish(CraftServer server, net.minecraft.world.entity.animal.TropicalFish entity) {
|
||||||
|
super(server, entity);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
||||||
index 2ba16e33dd21c3c72cb12244aa78c59bf53e76d1..634a5099fb6faea03615783f57e643ad0083fa30 100644
|
index 2ba16e33dd21c3c72cb12244aa78c59bf53e76d1..634a5099fb6faea03615783f57e643ad0083fa30 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java
|
||||||
|
|
|
@ -25,10 +25,10 @@ index 3abc8894f575e246201845b757dbef2699663859..dcbbf53b23a9347470986f052ecba014
|
||||||
return this.isPassenger() ? false : this.saveAsPassenger(nbt);
|
return this.isPassenger() ? false : this.saveAsPassenger(nbt);
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
index d34e1da89e04df311c1627f43790851c23fef0b0..8c273a7dc38c9c5dba83c998bab3427d3112106b 100644
|
index cc86c455588f33463100a58f3be6f21e26dda5da..99a9ddbeee75611c5bab8d0e8952a9291bf73a16 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
@@ -1324,5 +1324,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
@@ -1330,5 +1330,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
}
|
}
|
||||||
return set;
|
return set;
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ index d34e1da89e04df311c1627f43790851c23fef0b0..8c273a7dc38c9c5dba83c998bab3427d
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
index 7b6231f7696fa949c657e05a1d35d0d7e482284e..d0c3b2582aba507dce69eb91d6c0803a4bb6ea06 100644
|
index 8d1212436f3a70986dae9868e80fa5b7fe893541..2f71e549c5c3f7e8ebfd10a7b0c8601fcc1d9c49 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
|
||||||
@@ -462,6 +462,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
@@ -462,6 +462,30 @@ public final class CraftMagicNumbers implements UnsafeValues {
|
||||||
|
|
|
@ -7,10 +7,10 @@ Subject: [PATCH] Entity powdered snow API
|
||||||
public net.minecraft.world.entity.monster.Skeleton inPowderSnowTime
|
public net.minecraft.world.entity.monster.Skeleton inPowderSnowTime
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
index 8c273a7dc38c9c5dba83c998bab3427d3112106b..702d0fc5ebd2d39b038dae05135f551848544818 100644
|
index 99a9ddbeee75611c5bab8d0e8952a9291bf73a16..446e6e97c4468d3cd60576c8d37e075f5a5b4dba 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
@@ -1334,5 +1334,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
@@ -1340,5 +1340,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
entity.setRot(location.getYaw(), location.getPitch());
|
entity.setRot(location.getYaw(), location.getPitch());
|
||||||
return !entity.valid && entity.level.addFreshEntity(entity, reason);
|
return !entity.valid && entity.level.addFreshEntity(entity, reason);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ index 305a70f4b4646fa6cb8f36af367222a2b7fa39d4..476668fe955841f61cf12d032b0d3bd1
|
||||||
|
|
||||||
} catch (Throwable throwable) {
|
} catch (Throwable throwable) {
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
index 8bf7d54cbdbc1dc2ec0482855d7f531b2dc648be..30013439192c9d32d3e1ebba5aec81140392d152 100644
|
index 6b01f56aadda10a89796f2b017d0fca3e10dfd98..655253c267925a704e55abe23f1142c15ecb8d2e 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||||
@@ -3390,7 +3390,7 @@ public abstract class LivingEntity extends Entity {
|
@@ -3390,7 +3390,7 @@ public abstract class LivingEntity extends Entity {
|
||||||
|
@ -59,10 +59,10 @@ index 8bf7d54cbdbc1dc2ec0482855d7f531b2dc648be..30013439192c9d32d3e1ebba5aec8114
|
||||||
if (this.isInPowderSnow && this.canFreeze()) {
|
if (this.isInPowderSnow && this.canFreeze()) {
|
||||||
this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
|
this.setTicksFrozen(Math.min(this.getTicksRequiredToFreeze(), i + 1));
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
index 702d0fc5ebd2d39b038dae05135f551848544818..2015147126f463f11202d04ca475cc86e5ac12c2 100644
|
index 446e6e97c4468d3cd60576c8d37e075f5a5b4dba..ea9622e80c8799b33e0edfc2a4a94ba35d1a3b12 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
@@ -644,6 +644,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
@@ -650,6 +650,17 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
return this.getHandle().isFullyFrozen();
|
return this.getHandle().isFullyFrozen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@ index 0227a7df2b3a30d1c0d95acdd1b0a43f9170d19b..a42e2cb31d636637db9f4e7edbe06acd
|
||||||
d0 = to.getX();
|
d0 = to.getX();
|
||||||
d1 = to.getY();
|
d1 = to.getY();
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
index 2015147126f463f11202d04ca475cc86e5ac12c2..a1e2664c9a6cc41edf0dfb92cd2b9d77170d8fde 100644
|
index ea9622e80c8799b33e0edfc2a4a94ba35d1a3b12..e6780f645f456b0def13aef17ddfb231dc94cde7 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
@@ -542,15 +542,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
@@ -548,15 +548,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean teleport(Location location, TeleportCause cause) {
|
public boolean teleport(Location location, TeleportCause cause) {
|
||||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Collision API
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
index 6445c2e4c97860e1c98f5263188d309cf55936f0..62bca85da6c5d9877e21fecb702370506ddf671c 100644
|
index d5cc47eb1fd1ea9a0638827483b03165f6a7e10c..afa802987f96e7d0c5f28d26b759e36edf34b8f4 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
|
||||||
@@ -962,5 +962,12 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
@@ -967,5 +967,12 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
|
||||||
|
|
||||||
return this.getHandle().clip(new net.minecraft.world.level.ClipContext(vec3d, vec3d1, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, null)).getType() == net.minecraft.world.phys.HitResult.Type.MISS;
|
return this.getHandle().clip(new net.minecraft.world.level.ClipContext(vec3d, vec3d1, net.minecraft.world.level.ClipContext.Block.COLLIDER, net.minecraft.world.level.ClipContext.Fluid.NONE, null)).getType() == net.minecraft.world.phys.HitResult.Type.MISS;
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@ index 6445c2e4c97860e1c98f5263188d309cf55936f0..62bca85da6c5d9877e21fecb70237050
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
index a1e2664c9a6cc41edf0dfb92cd2b9d77170d8fde..9368ec01e498f913bc5b7b3e77fe87659090d9b5 100644
|
index e6780f645f456b0def13aef17ddfb231dc94cde7..01132b10799034232e7e5cbb460d848601e04012 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||||
@@ -1369,4 +1369,19 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
@@ -1375,4 +1375,19 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||||
return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed.
|
return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed.
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
Loading…
Reference in New Issue