2013-07-11 01:31:30 +00:00
|
|
|
From 33080e70fd655ca796ed9069fa2daef5bf71b8a3 Mon Sep 17 00:00:00 2001
|
2013-01-22 04:58:34 +00:00
|
|
|
From: md_5 <md_5@live.com.au>
|
2013-06-21 07:30:13 +00:00
|
|
|
Date: Fri, 21 Jun 2013 17:17:20 +1000
|
2013-06-21 06:47:56 +00:00
|
|
|
Subject: [PATCH] Crop Growth Rates
|
2013-01-15 01:18:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
|
2013-07-02 03:03:56 +00:00
|
|
|
index 2a85c1c..afe8735 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Block.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Block.java
|
2013-07-02 03:03:56 +00:00
|
|
|
@@ -781,4 +781,16 @@ public class Block {
|
2013-01-15 01:18:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
+
|
|
|
|
+ // Spigot start
|
|
|
|
+ public static float range(float min, float value, float max) {
|
|
|
|
+ if (value < min) {
|
|
|
|
+ return min;
|
|
|
|
+ }
|
|
|
|
+ if (value > max) {
|
|
|
|
+ return max;
|
|
|
|
+ }
|
|
|
|
+ return value;
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
|
2013-07-02 03:03:56 +00:00
|
|
|
index 03eece7..758ab84 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockCactus.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
|
|
|
|
@@ -23,7 +23,7 @@ public class BlockCactus extends Block {
|
|
|
|
if (l < 3) {
|
|
|
|
int i1 = world.getData(i, j, k);
|
|
|
|
|
|
|
|
- if (i1 == 15) {
|
2013-06-20 08:21:31 +00:00
|
|
|
+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.cactusModifier * 15) + 0.5F, 15)) { // Spigot
|
2013-01-15 01:18:40 +00:00
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
|
2013-03-15 21:35:56 +00:00
|
|
|
world.setData(i, j, k, 0, 4);
|
|
|
|
this.doPhysics(world, i, j + 1, k, this.id);
|
2013-01-15 01:18:40 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
|
2013-07-02 03:03:56 +00:00
|
|
|
index e157fbe..84a809b 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockCrops.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
|
2013-03-15 21:35:56 +00:00
|
|
|
@@ -28,7 +28,7 @@ public class BlockCrops extends BlockFlower {
|
2013-01-15 01:18:40 +00:00
|
|
|
if (l < 7) {
|
2013-03-15 21:35:56 +00:00
|
|
|
float f = this.k(world, i, j, k);
|
2013-01-15 01:18:40 +00:00
|
|
|
|
|
|
|
- if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
2013-06-20 08:21:31 +00:00
|
|
|
+ if (random.nextInt((int) (world.growthOdds / world.spigotConfig.wheatModifier * (25.0F / f)) + 1) == 0) { // Spigot
|
2013-01-15 01:18:40 +00:00
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
|
2013-03-22 23:08:09 +00:00
|
|
|
index 6f9301d..2ccc0b8 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockGrass.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockGrass.java
|
2013-03-22 23:08:09 +00:00
|
|
|
@@ -32,7 +32,8 @@ public class BlockGrass extends Block {
|
2013-01-15 01:18:40 +00:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
} else if (world.getLightLevel(i, j + 1, k) >= 9) {
|
|
|
|
- for (int l = 0; l < 4; ++l) {
|
2013-03-22 23:08:09 +00:00
|
|
|
+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot
|
|
|
|
+ for (int l = 0; l < numGrowth; ++l) { // Spigot
|
2013-01-15 01:18:40 +00:00
|
|
|
int i1 = i + random.nextInt(3) - 1;
|
|
|
|
int j1 = j + random.nextInt(5) - 3;
|
|
|
|
int k1 = k + random.nextInt(3) - 1;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
|
2013-07-02 03:03:56 +00:00
|
|
|
index 796527d..b4a6800 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java
|
2013-07-02 03:03:56 +00:00
|
|
|
@@ -24,7 +24,7 @@ public class BlockMushroom extends BlockFlower {
|
2013-01-15 01:18:40 +00:00
|
|
|
|
2013-03-15 21:35:56 +00:00
|
|
|
public void a(World world, int i, int j, int k, Random random) {
|
2013-01-27 22:46:19 +00:00
|
|
|
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
|
2013-01-15 01:18:40 +00:00
|
|
|
- if (random.nextInt(25) == 0) {
|
2013-06-20 08:21:31 +00:00
|
|
|
+ if (random.nextInt(Math.max(1, (int) world.growthOdds / world.spigotConfig.mushroomModifier * 25)) == 0) { // Spigot
|
2013-01-15 01:18:40 +00:00
|
|
|
byte b0 = 4;
|
|
|
|
int l = 5;
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java
|
2013-03-22 23:08:09 +00:00
|
|
|
index 1de8c83..fa11d1c 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockMycel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockMycel.java
|
2013-03-22 23:08:09 +00:00
|
|
|
@@ -32,7 +32,8 @@ public class BlockMycel extends Block {
|
2013-01-15 01:18:40 +00:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
|
|
|
} else if (world.getLightLevel(i, j + 1, k) >= 9) {
|
|
|
|
- for (int l = 0; l < 4; ++l) {
|
2013-03-22 23:08:09 +00:00
|
|
|
+ int numGrowth = Math.min(4, Math.max(20, (int) (4 * 100F / world.growthOdds))); // Spigot
|
|
|
|
+ for (int l = 0; l < numGrowth; ++l) { // Spigot
|
2013-01-15 01:18:40 +00:00
|
|
|
int i1 = i + random.nextInt(3) - 1;
|
|
|
|
int j1 = j + random.nextInt(5) - 3;
|
|
|
|
int k1 = k + random.nextInt(3) - 1;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
|
2013-06-20 08:21:31 +00:00
|
|
|
index 8657860..cf52501 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockReed.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockReed.java
|
2013-03-15 21:35:56 +00:00
|
|
|
@@ -23,7 +23,7 @@ public class BlockReed extends Block {
|
2013-01-15 01:18:40 +00:00
|
|
|
if (l < 3) {
|
|
|
|
int i1 = world.getData(i, j, k);
|
|
|
|
|
|
|
|
- if (i1 == 15) {
|
2013-06-20 08:21:31 +00:00
|
|
|
+ if (i1 >= (byte) range(3, (world.growthOdds / world.spigotConfig.caneModifier * 15) + 0.5F, 15)) { // Spigot
|
2013-01-15 01:18:40 +00:00
|
|
|
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
|
2013-03-15 21:35:56 +00:00
|
|
|
world.setData(i, j, k, 0, 4);
|
2013-01-15 01:18:40 +00:00
|
|
|
} else {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
|
2013-07-02 03:03:56 +00:00
|
|
|
index 706d6c9..fe675b3 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockSapling.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
|
2013-07-02 03:03:56 +00:00
|
|
|
@@ -25,7 +25,7 @@ public class BlockSapling extends BlockFlower {
|
2013-03-15 21:35:56 +00:00
|
|
|
public void a(World world, int i, int j, int k, Random random) {
|
|
|
|
if (!world.isStatic) {
|
|
|
|
super.a(world, i, j, k, random);
|
|
|
|
- if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
|
2013-06-21 06:47:56 +00:00
|
|
|
+ if (world.getLightLevel(i, j + 1, k) >= 9 && (random.nextInt(Math.max(2, (int) ((world.growthOdds / world.spigotConfig.saplingModifier * 7) + 0.5F))) == 0)) { // Spigot
|
2013-03-15 21:35:56 +00:00
|
|
|
this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
|
|
|
|
}
|
|
|
|
}
|
2013-01-15 01:18:40 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
|
2013-07-02 03:03:56 +00:00
|
|
|
index f2d4e57..5fe0a81 100644
|
2013-01-15 01:18:40 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/BlockStem.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/BlockStem.java
|
|
|
|
@@ -27,7 +27,7 @@ public class BlockStem extends BlockFlower {
|
|
|
|
if (world.getLightLevel(i, j + 1, k) >= 9) {
|
2013-03-15 21:35:56 +00:00
|
|
|
float f = this.m(world, i, j, k);
|
2013-01-15 01:18:40 +00:00
|
|
|
|
|
|
|
- if (random.nextInt((int) (25.0F / f) + 1) == 0) {
|
2013-06-20 08:21:31 +00:00
|
|
|
+ if (random.nextInt((int) (world.growthOdds / (this.id == Block.PUMPKIN_STEM.id ? world.spigotConfig.pumpkinModifier : world.spigotConfig.melonModifier) * (25.0F / f)) + 1) == 0) { // Spigot
|
2013-01-15 01:18:40 +00:00
|
|
|
int l = world.getData(i, j, k);
|
|
|
|
|
|
|
|
if (l < 7) {
|
2013-06-20 08:21:31 +00:00
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2013-06-22 04:16:11 +00:00
|
|
|
index 123fb7a..3ec38a1 100644
|
2013-06-20 08:21:31 +00:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
|
2013-06-22 04:07:01 +00:00
|
|
|
@@ -70,4 +70,36 @@ public class SpigotWorldConfig
|
2013-06-21 07:00:01 +00:00
|
|
|
chunksPerTick = getInt( "chunks-per-tick", 650 );
|
2013-06-20 08:21:31 +00:00
|
|
|
log( "Chunks to Grow per Tick: " + chunksPerTick );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Crop growth rates
|
2013-06-21 07:00:01 +00:00
|
|
|
+ public int cactusModifier;
|
|
|
|
+ public int caneModifier;
|
|
|
|
+ public int melonModifier;
|
|
|
|
+ public int mushroomModifier;
|
|
|
|
+ public int pumpkinModifier;
|
|
|
|
+ public int saplingModifier;
|
|
|
|
+ public int wheatModifier;
|
2013-06-20 08:21:31 +00:00
|
|
|
+ private void growthModifiers()
|
|
|
|
+ {
|
2013-06-21 07:00:01 +00:00
|
|
|
+ cactusModifier = getInt( "growth.cactus-modifier", 100 );
|
2013-06-20 08:21:31 +00:00
|
|
|
+ log( "Cactus Growth Modifier: " + cactusModifier + "%" );
|
|
|
|
+
|
2013-06-21 07:00:01 +00:00
|
|
|
+ caneModifier = getInt( "growth.cane-modifier", 100 );
|
2013-06-22 04:16:11 +00:00
|
|
|
+ log( "Cane Growth Modifier: " + caneModifier + "%" );
|
2013-06-20 08:21:31 +00:00
|
|
|
+
|
2013-06-21 07:00:01 +00:00
|
|
|
+ melonModifier = getInt( "growth.melon-modifier", 100 );
|
2013-06-22 04:16:11 +00:00
|
|
|
+ log( "Melon Growth Modifier: " + melonModifier + "%" );
|
2013-06-20 08:21:31 +00:00
|
|
|
+
|
2013-06-21 07:00:01 +00:00
|
|
|
+ mushroomModifier = getInt( "growth.mushroom-modifier", 100 );
|
2013-06-22 04:16:11 +00:00
|
|
|
+ log( "Mushroom Growth Modifier: " + mushroomModifier + "%" );
|
2013-06-20 08:21:31 +00:00
|
|
|
+
|
2013-06-21 07:00:01 +00:00
|
|
|
+ pumpkinModifier = getInt( "growth.pumpkin-modifier", 100 );
|
2013-06-22 04:16:11 +00:00
|
|
|
+ log( "Pumpkin Growth Modifier: " + pumpkinModifier + "%" );
|
2013-06-20 08:21:31 +00:00
|
|
|
+
|
2013-06-21 07:00:01 +00:00
|
|
|
+ saplingModifier = getInt( "growth.sapling-modifier", 100 );
|
2013-06-22 04:16:11 +00:00
|
|
|
+ log( "Sapling Growth Modifier: " + saplingModifier + "%" );
|
2013-06-20 08:21:31 +00:00
|
|
|
+
|
2013-06-21 07:00:01 +00:00
|
|
|
+ wheatModifier = getInt( "growth.wheat-modifier", 100 );
|
2013-06-22 04:16:11 +00:00
|
|
|
+ log( "Wheat Growth Modifier: " + wheatModifier + "%" );
|
2013-06-20 08:21:31 +00:00
|
|
|
+ }
|
|
|
|
}
|
2013-01-15 01:18:40 +00:00
|
|
|
--
|
2013-06-02 05:15:15 +00:00
|
|
|
1.8.1.2
|
2013-01-15 01:18:40 +00:00
|
|
|
|