From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 22 Nov 2020 06:02:32 -0600
Subject: [PATCH] Add twisting and weeping vines growth rates


diff --git a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
index 4c4d059ca5c93ed37bc4473911d265fcec56c396..f63e79ff0df4b4f152f74e55134dc72932e6ae55 100644
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -80,4 +80,10 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
     public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
         world.setBlock(pos, (BlockState) state.setValue(CaveVinesBlock.BERRIES, true), 2);
     }
+
+    // Purpur start
+    public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
+        return world.purpurConfig.caveVinesGrowthModifier;
+    }
+    // Purpur end
 }
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
index 3129c8db32fd79ab5917ffc93ee6dd5db58b1aad..9f1d43ad720750f9d50cc3cfbe1fc9b335cffd0d 100644
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
@@ -39,9 +39,11 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
         return (Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25;
     }
 
+    public abstract double getGrowthModifier(ServerLevel world); // Purpur
+
     @Override
     public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
-        if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (100.0D / world.spigotConfig.kelpModifier) * this.growPerTickProbability) { // Spigot
+        if (state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (100.0D / this.getGrowthModifier(world)) * this.growPerTickProbability) { // Spigot // Purpur
             BlockPos blockposition1 = pos.relative(this.growthDirection);
 
             if (this.canGrowInto(world.getBlockState(blockposition1))) {
diff --git a/src/main/java/net/minecraft/world/level/block/KelpBlock.java b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
index 2bd5db55656c9ace95ad5ffdc4a6d07daa0948e4..5f9a8dd6b4f7c9285ffcce8bbe0e334a28cc9699 100644
--- a/src/main/java/net/minecraft/world/level/block/KelpBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
@@ -64,4 +64,10 @@ public class KelpBlock extends GrowingPlantHeadBlock implements LiquidBlockConta
     public FluidState getFluidState(BlockState state) {
         return Fluids.WATER.getSource(false);
     }
+
+    // Purpur start
+    public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
+        return world.spigotConfig.kelpModifier;
+    }
+    // Purpur end
 }
diff --git a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
index bc9813ad36d95d90eafe51afa27857937b6eecc6..c877f7e4e55c63d91ce58c15850e279be3e159a7 100644
--- a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
@@ -27,4 +27,10 @@ public class TwistingVinesBlock extends GrowingPlantHeadBlock {
     protected boolean canGrowInto(BlockState state) {
         return NetherVines.isValidGrowthState(state);
     }
+
+    // Purpur start
+    public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
+        return world.purpurConfig.twistingVinesGrowthModifier;
+    }
+    // Purpur end
 }
diff --git a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
index 35b2bad76c45b5a94ba7f2e9c7a8cfeb8c3f498b..d2cb1a7e7ea364cb8e2af4c4e756d8e45bc0ca10 100644
--- a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
@@ -27,4 +27,10 @@ public class WeepingVinesBlock extends GrowingPlantHeadBlock {
     protected boolean canGrowInto(BlockState state) {
         return NetherVines.isValidGrowthState(state);
     }
+
+    // Purpur start
+    public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
+        return world.purpurConfig.weepingVinesGrowthModifier;
+    }
+    // Purpur end
 }
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 45363eb67ab0c30c687a556392afe8e44e3d5f0d..7d5493fea2b7cfb26221e8592c7c3ef9cb65d05d 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -418,6 +418,11 @@ public class PurpurWorldConfig {
         }
     }
 
+    public double caveVinesGrowthModifier = 0.10D;
+    private void caveVinesSettings() {
+        caveVinesGrowthModifier = getDouble("blocks.cave_vines.growth-modifier", caveVinesGrowthModifier);
+    }
+
     public boolean dispenserApplyCursedArmor = true;
     public boolean dispenserPlaceAnvils = false;
     private void dispenserSettings() {
@@ -487,6 +492,16 @@ public class PurpurWorldConfig {
         stonecutterDamage = (float) getDouble("blocks.stonecutter.damage", stonecutterDamage);
     }
 
+    public double twistingVinesGrowthModifier = 0.10D;
+    private void twistingVinesSettings() {
+        twistingVinesGrowthModifier = getDouble("blocks.twisting_vines.growth-modifier", twistingVinesGrowthModifier);
+    }
+
+    public double weepingVinesGrowthModifier = 0.10D;
+    private void weepingVinesSettings() {
+        weepingVinesGrowthModifier = getDouble("blocks.weeping_vines.growth-modifier", weepingVinesGrowthModifier);
+    }
+
     public boolean babiesAreRidable = true;
     public boolean untamedTamablesAreRidable = true;
     public boolean useNightVisionWhenRiding = false;
