Files
Purpur/patches/server/0121-Kelp-weeping-and-twisting-vines-configurable-max-gro.patch
William Blake Galbreath 69c7c31f9a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
26c37d99d5 create random seeds for features using SecureRandom
589bf2f1bf Upgrade gson to 2.8.8 (Closes #6370)
0a6103597b Get entity default attributes (#6449)
40057019e0 Correctly inflate villager activation bounding box (#6798)
e5f9241d15 Left handed API (#6775)
40ee63496c Add advancement display API (#6175)
9d570042ed Add ItemFactory#getMonsterEgg API (#6772)
55ca459515 rename method to getSpawnEgg
bb397ba74c Add critical damage API (#6275)
f47aeafe00 Add Horse Animation API (#5599)
7a0886180f AT & Mapping fixes (#6809)
5553432644 docs: Update gradle instructions for Java 16 (#6811) [ci skip]
a1f49e4c60 Fix command suggestion leak (#6592)
9472d38f3c Fix method name for Critical damage (#6813)
2021-10-21 10:58:20 -05:00

150 lines
8.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 22 Nov 2020 20:13:27 -0600
Subject: [PATCH] Kelp weeping and twisting vines configurable max growth age
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 f63e79ff0df4b4f152f74e55134dc72932e6ae55..905ef84a959833c38898670126e0ac08da8d4ca2 100644
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
@@ -85,5 +85,9 @@ public class CaveVinesBlock extends GrowingPlantHeadBlock implements Bonemealabl
public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
return world.purpurConfig.caveVinesGrowthModifier;
}
+
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
+ return world.purpurConfig.caveVinesMaxGrowthAge;
+ }
// 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 9f1d43ad720750f9d50cc3cfbe1fc9b335cffd0d..1c3284f8bf7923361797a73077af0699fa58db29 100644
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
@@ -31,7 +31,7 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
@Override
public BlockState getStateForPlacement(LevelAccessor world) {
- return (BlockState) this.defaultBlockState().setValue(GrowingPlantHeadBlock.AGE, world.getRandom().nextInt(25));
+ return (BlockState) this.defaultBlockState().setValue(GrowingPlantHeadBlock.AGE, world.getRandom().nextInt(getMaxGrowthAge(world.getMinecraftWorld()))); // Purpur
}
@Override
@@ -41,9 +41,11 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
public abstract double getGrowthModifier(ServerLevel world); // Purpur
+ public abstract int getMaxGrowthAge(ServerLevel world); // Purpur
+
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
- if (state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (100.0D / this.getGrowthModifier(world)) * this.growPerTickProbability) { // Spigot // Purpur
+ if (state.getValue(GrowingPlantHeadBlock.AGE) < getMaxGrowthAge(world) && random.nextDouble() < (100.0D / this.getGrowthModifier(world)) * this.growPerTickProbability) { // Spigot // Purpur
BlockPos blockposition1 = pos.relative(this.growthDirection);
if (this.canGrowInto(world.getBlockState(blockposition1))) {
@@ -96,13 +98,13 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
@Override
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
BlockPos blockposition1 = pos.relative(this.growthDirection);
- int i = Math.min((Integer) state.getValue(GrowingPlantHeadBlock.AGE) + 1, 25);
+ int i = Math.min((Integer) state.getValue(GrowingPlantHeadBlock.AGE) + 1, getMaxGrowthAge(world)); // Purpur
int j = this.getBlocksToGrowWhenBonemealed(random);
for (int k = 0; k < j && this.canGrowInto(world.getBlockState(blockposition1)); ++k) {
world.setBlockAndUpdate(blockposition1, (BlockState) state.setValue(GrowingPlantHeadBlock.AGE, i));
blockposition1 = blockposition1.relative(this.growthDirection);
- i = Math.min(i + 1, 25);
+ i = Math.min(i + 1, getMaxGrowthAge(world)); // Purpur
}
}
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 5f9a8dd6b4f7c9285ffcce8bbe0e334a28cc9699..486a62617b594b66341fb9ef2f88c3f328cb943d 100644
--- a/src/main/java/net/minecraft/world/level/block/KelpBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/KelpBlock.java
@@ -69,5 +69,9 @@ public class KelpBlock extends GrowingPlantHeadBlock implements LiquidBlockConta
public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
return world.spigotConfig.kelpModifier;
}
+
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
+ return world.purpurConfig.kelpMaxGrowthAge;
+ }
// 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 c877f7e4e55c63d91ce58c15850e279be3e159a7..c8ca3b9da2df89540a80c08042ca9aee28f274ea 100644
--- a/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/TwistingVinesBlock.java
@@ -32,5 +32,9 @@ public class TwistingVinesBlock extends GrowingPlantHeadBlock {
public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
return world.purpurConfig.twistingVinesGrowthModifier;
}
+
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
+ return world.purpurConfig.twistingVinesMaxGrowthAge;
+ }
// 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 d2cb1a7e7ea364cb8e2af4c4e756d8e45bc0ca10..bb99dda3c5167f23b2500a1f37cbc1ca285f123a 100644
--- a/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WeepingVinesBlock.java
@@ -32,5 +32,9 @@ public class WeepingVinesBlock extends GrowingPlantHeadBlock {
public double getGrowthModifier(net.minecraft.server.level.ServerLevel world) {
return world.purpurConfig.weepingVinesGrowthModifier;
}
+
+ public int getMaxGrowthAge(net.minecraft.server.level.ServerLevel world) {
+ return world.purpurConfig.weepingVinesMaxGrowthAge;
+ }
// Purpur end
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 4a4d8cc7f36c6733bb56680dcf599ffba3898eab..821a925ff0499e84616b9fb9a6a541359d9ddd2c 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -427,8 +427,10 @@ public class PurpurWorldConfig {
}
public double caveVinesGrowthModifier = 0.10D;
+ public int caveVinesMaxGrowthAge = 25;
private void caveVinesSettings() {
caveVinesGrowthModifier = getDouble("blocks.cave_vines.growth-modifier", caveVinesGrowthModifier);
+ caveVinesMaxGrowthAge = getInt("blocks.cave_vines.max-growth-age", caveVinesMaxGrowthAge);
}
public boolean dispenserApplyCursedArmor = true;
@@ -474,6 +476,11 @@ public class PurpurWorldConfig {
waterInfiniteRequiredSources = getInt("blocks.water.infinite-required-sources", waterInfiniteRequiredSources);
}
+ public int kelpMaxGrowthAge = 25;
+ private void kelpSettings() {
+ kelpMaxGrowthAge = getInt("blocks.kelp.max-growth-age", kelpMaxGrowthAge);
+ }
+
public boolean respawnAnchorExplode = true;
public double respawnAnchorExplosionPower = 5.0D;
public boolean respawnAnchorExplosionFire = true;
@@ -508,13 +515,17 @@ public class PurpurWorldConfig {
}
public double twistingVinesGrowthModifier = 0.10D;
+ public int twistingVinesMaxGrowthAge = 25;
private void twistingVinesSettings() {
twistingVinesGrowthModifier = getDouble("blocks.twisting_vines.growth-modifier", twistingVinesGrowthModifier);
+ twistingVinesMaxGrowthAge = getInt("blocks.twisting_vines.max-growth-age", twistingVinesMaxGrowthAge);
}
public double weepingVinesGrowthModifier = 0.10D;
+ public int weepingVinesMaxGrowthAge = 25;
private void weepingVinesSettings() {
weepingVinesGrowthModifier = getDouble("blocks.weeping_vines.growth-modifier", weepingVinesGrowthModifier);
+ weepingVinesMaxGrowthAge = getInt("blocks.weeping_vines.max-growth-age", weepingVinesMaxGrowthAge);
}
public boolean babiesAreRidable = true;