mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
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.
This commit is contained in:
24
patches/api/Add-missing-fishing-event-state.patch
Normal file
24
patches/api/Add-missing-fishing-event-state.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: SoSeDiK <mrsosedik@gmail.com>
|
||||
Date: Wed, 1 May 2024 07:44:50 +0300
|
||||
Subject: [PATCH] Add missing fishing event state
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerFishEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerFishEvent.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerFishEvent extends PlayerEvent implements Cancellable {
|
||||
* in.
|
||||
*/
|
||||
BITE
|
||||
+ // Paper start - Add missing fishing event state
|
||||
+ ,
|
||||
+ /**
|
||||
+ * Called when a bobber was lured, and is now waiting to be hooked
|
||||
+ * (when a "fish" starts to swim toward the bobber to bite it).
|
||||
+ */
|
||||
+ LURED,
|
||||
+ // Paper end - Add missing fishing event state
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@ Date: Wed, 26 May 2021 19:34:43 -0400
|
||||
Subject: [PATCH] More Projectile API
|
||||
|
||||
Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>
|
||||
Co-authored-by: SoSeDiK <mrsosedik@gmail.com>
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/AbstractArrow.java b/src/main/java/org/bukkit/entity/AbstractArrow.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@@ -205,6 +206,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * @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
|
||||
|
Reference in New Issue
Block a user