aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0012-Configurable-fishing-time-ranges.patch
blob: 476c1d849a15f37980088ed7c01b832a05562f63 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 0412e6ba2083b44da0a780abf51da476268e1107 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Tue, 1 Mar 2016 13:14:11 -0600
Subject: [PATCH] Configurable fishing time ranges


diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index 55d8e74f8..a55163a45 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -79,4 +79,12 @@ public class PaperWorldConfig {
         babyZombieMovementSpeed = getDouble("baby-zombie-movement-speed", 0.5D); // Player moves at 0.1F, for reference
         log("Baby zombies will move at the speed of " + babyZombieMovementSpeed);
     }
+
+    public int fishingMinTicks;
+    public int fishingMaxTicks;
+    private void fishingTickRange() {
+        fishingMinTicks = getInt("fishing-time-range.MinimumTicks", 100);
+        fishingMaxTicks = getInt("fishing-time-range.MaximumTicks", 600);
+        log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks");
+    }
 }
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 83cfbd218..fd6ada184 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -386,8 +386,9 @@ public class EntityFishingHook extends Entity {
                     this.aw = MathHelper.nextInt(this.random, 20, 80);
                 }
             } else {
-                this.h = MathHelper.nextInt(this.random, 100, 600);
+                this.h = MathHelper.nextInt(this.random, world.paperConfig.fishingMinTicks, world.paperConfig.fishingMaxTicks); // Paper
                 this.h -= this.aA * 20 * 5;
+                this.h = Math.max(0, this.h); // Paper - Don't allow negative values
             }
         }
 
-- 
2.21.0