From 57fc47e650183073de916c44ae78ddc267e64c6a Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Sun, 16 Apr 2023 10:10:23 +1000 Subject: [PATCH] #589: Expand the FishHook API By: Martoph --- .../main/java/org/bukkit/entity/FishHook.java | 176 +++++++++++++++++- 1 file changed, 168 insertions(+), 8 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/entity/FishHook.java b/paper-api/src/main/java/org/bukkit/entity/FishHook.java index d1b3753031..94e1a30ea1 100644 --- a/paper-api/src/main/java/org/bukkit/entity/FishHook.java +++ b/paper-api/src/main/java/org/bukkit/entity/FishHook.java @@ -9,47 +9,170 @@ import org.jetbrains.annotations.Nullable; public interface FishHook extends Projectile { /** - * Get the minimum number of ticks one has to wait for a fish biting. + * Get the minimum number of ticks one has to wait for a fish appearing. *

* The default is 100 ticks (5 seconds).
* Note that this is before applying lure. * - * @return Minimum number of ticks one has to wait for a fish biting + * @return Minimum number of ticks one has to wait for a fish appearing */ public int getMinWaitTime(); /** - * Set the minimum number of ticks one has to wait for a fish biting. + * Set the minimum number of ticks one has to wait for a fish appearing. *

* The default is 100 ticks (5 seconds).
* Note that this is before applying lure. * * @param minWaitTime Minimum number of ticks one has to wait for a fish - * biting + * appearing */ public void setMinWaitTime(int minWaitTime); /** - * Get the maximum number of ticks one has to wait for a fish biting. + * Get the maximum number of ticks one has to wait for a fish appearing. *

* The default is 600 ticks (30 seconds).
* Note that this is before applying lure. * - * @return Maximum number of ticks one has to wait for a fish biting + * @return Maximum number of ticks one has to wait for a fish appearing */ public int getMaxWaitTime(); /** - * Set the maximum number of ticks one has to wait for a fish biting. + * Set the maximum number of ticks one has to wait for a fish appearing. *

* The default is 600 ticks (30 seconds).
* Note that this is before applying lure. * * @param maxWaitTime Maximum number of ticks one has to wait for a fish - * biting + * appearing */ public void setMaxWaitTime(int maxWaitTime); + /** + * Set both the minimum (default 100) and maximum (default 600) amount + * of ticks one has to wait for a fish appearing. + * + * @param min minimum ticks for a fish to appear + * @param max maximum ticks for a fish to appear + */ + public void setWaitTime(int min, int max); + + /** + * Get the minimum number of ticks one has to wait for a fish to bite + * after appearing. + *

+ * The default is 20 ticks (1 second).
+ * Lure does not affect this value. + * This will also effect the radius (0.1 * lureTime) of where + * the fish will appear. + * + * @return Minimum number of ticks one has to wait for a fish to bite + */ + public int getMinLureTime(); + + /** + * Set the minimum number of ticks one has to wait for a fish to bite + * after appearing. + *

+ * The default is 20 ticks (1 second).
+ * Lure does not affect this value. + * This will also effect the radius (0.1 * lureTime) of where + * the fish will appear. + * + * @param minLureTime Minimum number of ticks one has to wait for a fish + * to bite + */ + public void setMinLureTime(int minLureTime); + + /** + * Get the maximum number of ticks one has to wait for a fish to bite + * after appearing. + *

+ * The default is 80 ticks (4 second).
+ * Lure does not affect this value. + * This will also effect the radius (0.1 * lureTime) of where + * the fish will appear. + * + * @return Maximum number of ticks one has to wait for a fish to bite + */ + public int getMaxLureTime(); + + /** + * Set the maximum number of ticks one has to wait for a fish to bite + * after appearing. + *

+ * The default is 80 ticks (4 second).
+ * Lure does not affect this value. + * This will also effect the radius (0.1 * lureTime) of where + * the fish will appear. + * + * @param maxLureTime Maximum number of ticks one has to wait for a fish + * to bite + */ + public void setMaxLureTime(int maxLureTime); + + /** + * Set both the minimum (default 20) and maximum (default 80) amount + * of ticks one has to wait for a fish to bite after appearing. + * + * @param min minimum ticks to wait for a bite + * @param max maximum ticks to wait for a bite + */ + public void setLureTime(int min, int max); + + /** + * Get the minimum angle (in degrees, 0 being positive Z 90 being negative + * X) of where a fish will appear after the wait time. + *

+ * The default is 0 degrees. + * + * @return Minimum angle of where a fish will appear + */ + public float getMinLureAngle(); + + /** + * Set the minimum angle (in degrees, 0 being positive Z 90 being negative + * X) of where a fish will appear after the wait time. + *

+ * The default is 0 degrees. + * + * @param minLureAngle Minimum angle of where a fish may appear + */ + public void setMinLureAngle(float minLureAngle); + + /** + * Get the maximum angle (in degrees, 0 being positive Z 90 being negative + * X) of where a fish will appear after the wait time. + *

+ * The default is 360 degrees. + * + * @return Maximum angle of where a fish will appear + */ + public float getMaxLureAngle(); + + /** + * Set the maximum angle (in degrees, 0 being positive Z 90 being negative + * X) of where a fish will appear after the wait time. + *

+ * The default is 360 degrees. + * + * @param maxLureAngle Maximum angle of where a fish may appear + */ + public void setMaxLureAngle(float maxLureAngle); + + /** + * Set both the minimum (default 0) and maximum (default 360) angle of where + * a fish will appear after the wait time. + * + * 0 degrees is positive Z, 90 degrees is negative X. + * + * @param min minimum angle in degrees + * @param max maximum angle in degrees + */ + public void setLureAngle(float min, float max); + /** * Get whether the lure enchantment should be applied to reduce the wait * time. @@ -135,6 +258,43 @@ public interface FishHook extends Projectile { */ public boolean pullHookedEntity(); + /** + * Whether or not wait and lure time will be impacted by direct sky access. + * + * True by default, causes a 50% time increase on average. + * + * @return skylight access influences catch rate + */ + public boolean isSkyInfluenced(); + + /** + * Set whether or not wait and lure time will be impacted by direct sky + * access. + * + * True by default, causes a 50% time increase on average. + * + * @param skyInfluenced if this hook is influenced by skylight access + */ + public void setSkyInfluenced(boolean skyInfluenced); + + /** + * Whether or not wait and lure time will be impacted by rain. + * + * True by default, causes a 25% time decrease on average. + * + * @return rain influences catch rate + */ + public boolean isRainInfluenced(); + + /** + * Set whether or not wait and lure time will be impacted by rain. + * + * True by default, causes a 25% time decrease on average. + * + * @param rainInfluenced if this hook is influenced by rain + */ + public void setRainInfluenced(boolean rainInfluenced); + /** * Get the current state of this fish hook. *