Fix kelp modifier having reverse effect (#6806)

This commit is contained in:
Jake Potrebic 2021-12-03 18:12:42 -08:00 committed by GitHub
parent 675d1e3f58
commit 2b97750f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -107,7 +107,7 @@ index f57884fa5f0fbbdbf35c22e692da4f9b6f3f98cc..9b30b359f1559e5f97c3b2a7acffda5b
}
- if (i < 3) {
+ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height
+ if (i < world.paperConfig.reedMaxHeight) { // Paper - Configurable growth height
int j = (Integer) state.getValue(SugarCaneBlock.AGE);
if (j >= (byte) range(3, ((100.0F / world.spigotConfig.caneModifier) * 15) + 0.5F, 15)) { // Spigot

View File

@ -6,6 +6,10 @@ Subject: [PATCH] Fix kelp modifier changing growth for other crops
Also add growth modifiers for twisting vines, weeping vines, cave vines,
and glow berries
Also fix above-mentioned modifiers from having the reverse effect
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
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 87dabe3c80b48bff52f2e3dbbaceb37a1a21e431..effee89e308c9a663938ac5b00a8c6512ce407c2 100644
--- a/src/main/java/net/minecraft/world/level/block/CaveVinesBlock.java
@ -30,7 +34,7 @@ index 87dabe3c80b48bff52f2e3dbbaceb37a1a21e431..effee89e308c9a663938ac5b00a8c651
public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) {
return new ItemStack(Items.GLOW_BERRIES);
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 def3b62feada5cebae4049883fa967b12f6f32b4..d3dde8ce3f55bda0b7f55491aef3bc9aaad43dd3 100644
index def3b62feada5cebae4049883fa967b12f6f32b4..8e642ff6d387e05f900acfc3cf6cfa5975bf69e4 100644
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
@@ -40,16 +40,36 @@ public abstract class GrowingPlantHeadBlock extends GrowingPlantBlock implements
@ -51,7 +55,7 @@ index def3b62feada5cebae4049883fa967b12f6f32b4..d3dde8ce3f55bda0b7f55491aef3bc9a
+ } else {
+ modifier = 100; // Above cases are exhaustive as of 1.18
+ }
+ if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (100.0D / modifier) * this.growPerTickProbability) { // Spigot
+ if ((Integer) state.getValue(GrowingPlantHeadBlock.AGE) < 25 && random.nextDouble() < (modifier / 100.0D) * this.growPerTickProbability) { // Spigot // Paper - fix growth modifier having the reverse effect
+ // Paper end
BlockPos blockposition1 = pos.relative(this.growthDirection);