aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0344-More-Projectile-API.patch
diff options
context:
space:
mode:
authorSoSeDiK <[email protected]>2024-05-30 00:45:01 +0300
committerGitHub <[email protected]>2024-05-29 23:45:01 +0200
commit27d2ed84f43e7637e85f15d880fbad022038413e (patch)
treeec044b2a1d87a56fbb90d9b22a2a15ffa9377128 /patches/api/0344-More-Projectile-API.patch
parentefd91e52a670a1e1bae5ad09cdffac35484c1ee2 (diff)
downloadPaper-27d2ed84f43e7637e85f15d880fbad022038413e.tar.gz
Paper-27d2ed84f43e7637e85f15d880fbad022038413e.zip
Extend fishing API (#10634)
Adds a missing fishing state when the fish is lured and fires an event for it. Also adds a way to control the fish swimming time towards the bobber.
Diffstat (limited to 'patches/api/0344-More-Projectile-API.patch')
-rw-r--r--patches/api/0344-More-Projectile-API.patch35
1 files changed, 33 insertions, 2 deletions
diff --git a/patches/api/0344-More-Projectile-API.patch b/patches/api/0344-More-Projectile-API.patch
index ba63dbcd3b..f855759c3e 100644
--- a/patches/api/0344-More-Projectile-API.patch
+++ b/patches/api/0344-More-Projectile-API.patch
@@ -4,6 +4,7 @@ Date: Wed, 26 May 2021 19:34:43 -0400
Subject: [PATCH] More Projectile API
Co-authored-by: Nassim Jahnke <[email protected]>
+Co-authored-by: SoSeDiK <[email protected]>
diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
index 839e5b7df49f42b5fec7729997bef3370ba36d80..b36298679d6d52d09fe4bb8e52e19e18f6df742a 100644
@@ -183,10 +184,10 @@ index 0d31aa0b22cf1e849572294e2cfe38b48c9210af..217d348ad0bbef720b25d3b507a55ca8
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/FishHook.java b/src/main/java/org/bukkit/entity/FishHook.java
-index 94e1a30ea1bc26821065a6d89c1f5669bd1d08ae..6ed83d3e4d23e0dc0e1b156a1ee221aaba5c7210 100644
+index 94e1a30ea1bc26821065a6d89c1f5669bd1d08ae..fe32fa569afd62300f7fdc29eefaba291f265674 100644
--- a/src/main/java/org/bukkit/entity/FishHook.java
+++ b/src/main/java/org/bukkit/entity/FishHook.java
-@@ -322,4 +322,20 @@ public interface FishHook extends Projectile {
+@@ -322,4 +322,50 @@ public interface FishHook extends Projectile {
*/
BOBBING;
}
@@ -205,6 +206,36 @@ index 94e1a30ea1bc26821065a6d89c1f5669bd1d08ae..6ed83d3e4d23e0dc0e1b156a1ee221aa
+ * @param ticks Number of ticks
+ */
+ void setWaitTime(int ticks);
++
++ /**
++ * Get the number of ticks the fish has to swim until biting the hook.
++ * The {@link #getWaitTime()} has to be zero or below for the fish to start the time until bite timer.
++ *
++ * @return number of ticks.
++ * A value of one indicates that the fish bites the very next time the fish hook is ticked
++ * while a value of zero represents a fish that has already bitten the hook.
++ * @see #getWaitTime()
++ */
++ @org.jetbrains.annotations.Range(from = 0, to = Integer.MAX_VALUE)
++ int getTimeUntilBite();
++
++ /**
++ * Sets the number of ticks the fish has to swim until biting the hook.
++ *
++ * @param ticks number of ticks.
++ * One is the minimum that can be passed to this method and instructs the fish to bite the very next tick.
++ * @throws IllegalArgumentException if the passed tick value is less than one.
++ */
++ void setTimeUntilBite(@org.jetbrains.annotations.Range(from = 1, to = Integer.MAX_VALUE) int ticks) throws IllegalArgumentException;
++
++ /**
++ * Completely resets this fishing hook's fishing state, re-randomizing the time needed until a fish is lured and
++ * bites the hook.
++ * <p>
++ * This method takes all properties of the fishing hook into account when resetting said values, such as a lure
++ * enchantment.
++ */
++ void resetFishingState();
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Projectile.java b/src/main/java/org/bukkit/entity/Projectile.java