PaperSpigot-Parent/CraftBukkit-Patches/0020-Configurable-fishing-time-ranges.patch
2014-06-29 13:33:49 -05:00

51 lines
2.9 KiB
Diff

From 2d42162a4b2397f6c90082122f0ef5696e394f77 Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Sun, 29 Jun 2014 13:22:09 -0500
Subject: [PATCH] Configurable fishing time ranges
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 0763dd1..0ad1dd9 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -10,6 +10,8 @@ import org.bukkit.entity.Fish;
import org.bukkit.event.player.PlayerFishEvent;
// CraftBukkit end
+import org.spigotmc.SpigotWorldConfig; // PaperSpigot
+
public class EntityFishingHook extends Entity {
private static final List d = Arrays.asList(new PossibleFishingResult[] { (new PossibleFishingResult(new ItemStack(Items.LEATHER_BOOTS), 10)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.LEATHER), 10), new PossibleFishingResult(new ItemStack(Items.BONE), 10), new PossibleFishingResult(new ItemStack(Items.POTION), 10), new PossibleFishingResult(new ItemStack(Items.STRING), 5), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 2)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.BOWL), 10), new PossibleFishingResult(new ItemStack(Items.STICK), 5), new PossibleFishingResult(new ItemStack(Items.INK_SACK, 10, 0), 1), new PossibleFishingResult(new ItemStack(Blocks.TRIPWIRE_SOURCE), 10), new PossibleFishingResult(new ItemStack(Items.ROTTEN_FLESH), 10)});
@@ -315,7 +317,7 @@ public class EntityFishingHook extends Entity {
this.az = MathHelper.nextInt(this.random, 20, 80);
}
} else {
- this.ay = MathHelper.nextInt(this.random, 100, 900);
+ this.ay = MathHelper.nextInt(this.random, SpigotWorldConfig.fishingMinTicks, SpigotWorldConfig.fishingMaxTicks); // PaperSpigot - configurable fishing time range
this.ay -= EnchantmentManager.getLureEnchantmentLevel(this.owner) * 20 * 5;
}
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 4faa4c7..c0ba707 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -230,6 +230,14 @@ public class SpigotWorldConfig
reedMaxHeight = getInt ( "max-growth-height.reeds", 3 );
}
+ public static int fishingMinTicks = 100;
+ public static int fishingMaxTicks = 900;
+ private void fishingRange()
+ {
+ fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", fishingMinTicks );
+ fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", fishingMaxTicks );
+ }
+
public boolean randomLightUpdates;
private void lightUpdates()
{
--
1.9.1