testserver/CraftBukkit-Patches/0019-Configurable-fishing-t...

49 lines
3.0 KiB
Diff

From 5733313aae452f28afd6ae57cc1f44e88c93a700 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..acabaf6 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