Paper/CraftBukkit-Patches/0009-Configurable-cactus-and-reed-natural-growth-heights.patch

72 lines
2.7 KiB
Diff

From 3bdde40036b6b182e64b4e97e3007313fae0d96a Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Tue, 24 Jun 2014 07:44:59 -0500
Subject: [PATCH] Configurable cactus and reed natural growth heights
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index f55e531..7c3e426 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -4,6 +4,8 @@ import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+import org.spigotmc.SpigotWorldConfig; // PaperSpigot
+
public class BlockCactus extends Block {
protected BlockCactus() {
@@ -20,7 +22,7 @@ public class BlockCactus extends Block {
;
}
- if (l < 3) {
+ if (l < SpigotWorldConfig.cactusMaxHeight) { // PaperSpigot - Configurable natural growth heights
int i1 = world.getData(i, j, k);
if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 6c04ad2..d41c2fe 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.spigotmc.SpigotWorldConfig; // PaperSpigot
+
import java.util.Random;
public class BlockReed extends Block {
@@ -21,7 +23,7 @@ public class BlockReed extends Block {
;
}
- if (l < 3) {
+ if (l < SpigotWorldConfig.reedMaxHeight) { // PaperSpigot - Configurable natural growth heights
int i1 = world.getData(i, j, k);
if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index c253a1b..48ae578 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -222,6 +222,14 @@ public class SpigotWorldConfig
squidMaxSpawnHeight = getDouble( "squid-spawn-height.maximum", 63.0D );
}
+ public static int cactusMaxHeight;
+ public static int reedMaxHeight;
+ private void blockGrowthHeight()
+ {
+ cactusMaxHeight = getInt( "max-growth-height.cactus", 3 );
+ reedMaxHeight = getInt ( "max-growth-height.reeds", 3 );
+ }
+
public boolean randomLightUpdates;
private void lightUpdates()
{
--
1.9.1