From c8e49cc53e6f15ebc2e26a9a595f31890ee2b7af Mon Sep 17 00:00:00 2001 From: Owen <23108066+Owen1212055@users.noreply.github.com> Date: Sun, 13 Mar 2022 18:33:01 -0400 Subject: [PATCH] Add get/set wait time for fish hooks. (#5595) --- build-data/paper.at | 3 +++ patches/api/0373-More-Projectile-API.patch | 25 +++++++++++++++++++ patches/server/0875-More-Projectile-API.patch | 20 +++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/build-data/paper.at b/build-data/paper.at index c57689418..935d4f45f 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -324,3 +324,6 @@ protected net.minecraft.world.entity.projectile.Projectile hitCancelled # Expose firework item directly + manually setting flight ticks public net.minecraft.world.entity.projectile.FireworkRocketEntity life + +# More Projectile API +public net.minecraft.world.entity.projectile.FishingHook timeUntilLured diff --git a/patches/api/0373-More-Projectile-API.patch b/patches/api/0373-More-Projectile-API.patch index 934b09b0a..c9374b52d 100644 --- a/patches/api/0373-More-Projectile-API.patch +++ b/patches/api/0373-More-Projectile-API.patch @@ -70,6 +70,31 @@ index d616d5941b3c7b85e350e845901da798601b9a3c..b7a6e3b1ac327c4e03f9d73952c1ce4d + void setTicksToDetonate(int ticks); + // Paper stop } +diff --git a/src/main/java/org/bukkit/entity/FishHook.java b/src/main/java/org/bukkit/entity/FishHook.java +index d1b37530319f6d37ee37f62080289c1e45848bc8..e94c7e279356c510f60508b26277d4891a4258fa 100644 +--- a/src/main/java/org/bukkit/entity/FishHook.java ++++ b/src/main/java/org/bukkit/entity/FishHook.java +@@ -162,4 +162,20 @@ public interface FishHook extends Projectile { + */ + BOBBING; + } ++ ++ // Paper start - More FishHook API ++ /** ++ * Get the number of ticks the hook needs to wait for a fish to bite. ++ * ++ * @return Number of ticks ++ */ ++ int getWaitTime(); ++ ++ /** ++ * Sets the number of ticks the hook needs to wait for a fish to bite. ++ * ++ * @param ticks Number of ticks ++ */ ++ void setWaitTime(int ticks); ++ // Paper end + } diff --git a/src/main/java/org/bukkit/entity/ThrownPotion.java b/src/main/java/org/bukkit/entity/ThrownPotion.java index 10a3c297bd87ad3ab4555054858f47a479e76e1a..1afda5d6d948b7e8589e69d3cd2c045763b5e784 100644 --- a/src/main/java/org/bukkit/entity/ThrownPotion.java diff --git a/patches/server/0875-More-Projectile-API.patch b/patches/server/0875-More-Projectile-API.patch index 94ead9690..0e2e4acf0 100644 --- a/patches/server/0875-More-Projectile-API.patch +++ b/patches/server/0875-More-Projectile-API.patch @@ -111,6 +111,26 @@ index be86114eac3975b82ca74d4d6ed3f0402a642e8a..93fd9e87de3078f50431b5d80540d433 + } + // Paper end - Expose firework item directly + manually setting flight } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java +index 6bfa984781a483d048ef4318761203c701d8a632..5e0c2c5094e1578162d1a50d50701fbd25e6d961 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java +@@ -119,4 +119,15 @@ public class CraftFishHook extends CraftProjectile implements FishHook { + public HookState getState() { + return HookState.values()[this.getHandle().currentState.ordinal()]; + } ++ // Paper start - More FishHook API ++ @Override ++ public int getWaitTime() { ++ return this.getHandle().timeUntilLured; ++ } ++ ++ @Override ++ public void setWaitTime(int ticks) { ++ this.getHandle().timeUntilLured = ticks; ++ } ++ // Paper end + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java index b08739dd1ffd041f0885af6c1f57dca9027763b6..2edaae449f936b210a48c52ab8d921544c8a0005 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftThrownPotion.java