mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-18 08:57:44 +01:00
Kelp weeping and twisting vines configurable max length
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 22 Nov 2020 20:13:27 -0600
|
||||
Subject: [PATCH] Kelp weeping and twisting vines configurable max length
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockGrowingTop.java b/src/main/java/net/minecraft/server/BlockGrowingTop.java
|
||||
index 6c084ad5c..910dae805 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockGrowingTop.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockGrowingTop.java
|
||||
@@ -15,19 +15,21 @@ public abstract class BlockGrowingTop extends BlockGrowingAbstract implements IB
|
||||
|
||||
@Override
|
||||
public IBlockData a(GeneratorAccess generatoraccess) {
|
||||
- return (IBlockData) this.getBlockData().set(BlockGrowingTop.d, generatoraccess.getRandom().nextInt(25));
|
||||
+ return (IBlockData) this.getBlockData().set(BlockGrowingTop.d, generatoraccess.getRandom().nextInt(getMaxLength(generatoraccess.getMinecraftWorld()))); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTicking(IBlockData iblockdata) {
|
||||
- return (Integer) iblockdata.get(BlockGrowingTop.d) < 25;
|
||||
+ return true; // Purpur
|
||||
}
|
||||
|
||||
public abstract double getGrowthModifier(WorldServer worldserver); // Purpur
|
||||
|
||||
+ public abstract int getMaxLength(WorldServer worldserver); // Purpur
|
||||
+
|
||||
@Override
|
||||
public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
|
||||
- if ((Integer) iblockdata.get(BlockGrowingTop.d) < 25 && random.nextDouble() < (100.0D / getGrowthModifier(worldserver)) * this.e) { // Spigot // Purpur
|
||||
+ if ((Integer) iblockdata.get(BlockGrowingTop.d) < getMaxLength(worldserver) && random.nextDouble() < (100.0D / getGrowthModifier(worldserver)) * this.e) { // Spigot // Purpur
|
||||
BlockPosition blockposition1 = blockposition.shift(this.a);
|
||||
|
||||
if (this.h(worldserver.getType(blockposition1))) {
|
||||
@@ -72,13 +74,13 @@ public abstract class BlockGrowingTop extends BlockGrowingAbstract implements IB
|
||||
@Override
|
||||
public void a(WorldServer worldserver, Random random, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
BlockPosition blockposition1 = blockposition.shift(this.a);
|
||||
- int i = Math.min((Integer) iblockdata.get(BlockGrowingTop.d) + 1, 25);
|
||||
+ int i = Math.min((Integer) iblockdata.get(BlockGrowingTop.d) + 1, getMaxLength(worldserver)); // Purpur
|
||||
int j = this.a(random);
|
||||
|
||||
for (int k = 0; k < j && this.h(worldserver.getType(blockposition1)); ++k) {
|
||||
worldserver.setTypeUpdate(blockposition1, (IBlockData) iblockdata.set(BlockGrowingTop.d, i));
|
||||
blockposition1 = blockposition1.shift(this.a);
|
||||
- i = Math.min(i + 1, 25);
|
||||
+ i = Math.min(i + 1, getMaxLength(worldserver)); // Purpur
|
||||
}
|
||||
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockKelp.java b/src/main/java/net/minecraft/server/BlockKelp.java
|
||||
index 2a7a6e594..92412612a 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockKelp.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockKelp.java
|
||||
@@ -58,5 +58,9 @@ public class BlockKelp extends BlockGrowingTop implements IFluidContainer {
|
||||
public double getGrowthModifier(WorldServer worldserver) {
|
||||
return worldserver.spigotConfig.kelpModifier;
|
||||
}
|
||||
+
|
||||
+ public int getMaxLength(WorldServer worldserver) {
|
||||
+ return worldserver.purpurConfig.kelpMaxLength;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockTwistingVines.java b/src/main/java/net/minecraft/server/BlockTwistingVines.java
|
||||
index 146638111..a8879e924 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockTwistingVines.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockTwistingVines.java
|
||||
@@ -29,5 +29,9 @@ public class BlockTwistingVines extends BlockGrowingTop {
|
||||
public double getGrowthModifier(WorldServer worldserver) {
|
||||
return worldserver.purpurConfig.twistingVinesGrowthModifier;
|
||||
}
|
||||
+
|
||||
+ public int getMaxLength(WorldServer worldserver) {
|
||||
+ return worldserver.purpurConfig.twistingVinesMaxLength;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockWeepingVines.java b/src/main/java/net/minecraft/server/BlockWeepingVines.java
|
||||
index 94ffadb91..f2168254b 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockWeepingVines.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockWeepingVines.java
|
||||
@@ -29,5 +29,9 @@ public class BlockWeepingVines extends BlockGrowingTop {
|
||||
public double getGrowthModifier(WorldServer worldserver) {
|
||||
return worldserver.purpurConfig.weepingVinesGrowthModifier;
|
||||
}
|
||||
+
|
||||
+ public int getMaxLength(WorldServer worldserver) {
|
||||
+ return worldserver.purpurConfig.weepingVinesMaxLength;
|
||||
+ }
|
||||
// Purpur end
|
||||
}
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index fd175e2ad..9dd8d694c 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -359,6 +359,11 @@ public class PurpurWorldConfig {
|
||||
furnaceInfiniteFuel = getBoolean("blocks.furnace.infinite-fuel", furnaceInfiniteFuel);
|
||||
}
|
||||
|
||||
+ public int kelpMaxLength = 25;
|
||||
+ public void kelpSettings() {
|
||||
+ kelpMaxLength = getInt("blocks.kelp.max-length", kelpMaxLength);
|
||||
+ }
|
||||
+
|
||||
public boolean lavaInfinite = false;
|
||||
public int lavaInfiniteRequiredSources = 2;
|
||||
public int lavaSpeedNether = 10;
|
||||
@@ -413,13 +418,17 @@ public class PurpurWorldConfig {
|
||||
}
|
||||
|
||||
public double twistingVinesGrowthModifier = 0.10D;
|
||||
+ public int twistingVinesMaxLength = 25;
|
||||
public void twistingVinesSettings() {
|
||||
twistingVinesGrowthModifier = getDouble("blocks.twisting_vines.growth-modifier", twistingVinesGrowthModifier);
|
||||
+ twistingVinesMaxLength = getInt("blocks.twisting_vines.max-length", twistingVinesMaxLength);
|
||||
}
|
||||
|
||||
public double weepingVinesGrowthModifier = 0.10D;
|
||||
+ public int weepingVinesMaxLength = 25;
|
||||
public void weepingVinesSettings() {
|
||||
weepingVinesGrowthModifier = getDouble("blocks.weeping_vines.growth-modifier", weepingVinesGrowthModifier);
|
||||
+ weepingVinesMaxLength = getInt("blocks.weeping_vines.max-length", weepingVinesMaxLength);
|
||||
}
|
||||
|
||||
public boolean babiesAreRidable = true;
|
||||
Reference in New Issue
Block a user