PaperMC/Spigot-Server-Patches/0018-Configurable-fishing-time-ranges.patch
Zach Brown 7b0c576798 Restructure PaperSpigot as a new set of modules
Allows us much greater control over the Spigot portion of the code
and makes us more "proper"
Credit to @Dmck2b for originally passing the idea along a while back
2014-07-21 15:46:54 -05:00

48 lines
3 KiB
Diff

From 94e7e4ebcaa1e17fc85d42895a7528e4be896d67 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 197dca1..3cd7838 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.github.paperspigot.PaperSpigotWorldConfig; // 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, PaperSpigotWorldConfig.fishingMinTicks, PaperSpigotWorldConfig.fishingMaxTicks); // PaperSpigot - configurable fishing time range
this.ay -= EnchantmentManager.getLureEnchantmentLevel(this.owner) * 20 * 5;
}
}
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index c219cab..554e74a 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -116,4 +116,12 @@ public class PaperSpigotWorldConfig
InvertedDaylightDetectors = getBoolean( "inverted-daylight-detectors", false );
log( "Inverted Redstone Lamps: " + InvertedDaylightDetectors );
}
+
+ public static int fishingMinTicks = 100;
+ public static int fishingMaxTicks = 900;
+ private void fishingTickRange()
+ {
+ fishingMinTicks = getInt( "fishing-time-range.MinimumTicks", fishingMinTicks );
+ fishingMaxTicks = getInt( "fishing-time-range.MaximumTicks", fishingMaxTicks );
+ }
}
--
1.9.1