Skip to content

Commit

Permalink
Add get/set wait time for fish hooks. (#5595)
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen1212055 committed Mar 13, 2022
1 parent 1ce3555 commit c8e49cc
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build-data/paper.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
25 changes: 25 additions & 0 deletions patches/api/0373-More-Projectile-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions patches/server/0875-More-Projectile-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c8e49cc

Please sign in to comment.