Use the spigot config for mangrove propagule / torchflower growth (#8597)

This commit is contained in:
Lulu13022002 2023-05-15 20:25:38 +02:00 committed by GitHub
parent b6817605ce
commit bcd8dc2c11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 53 additions and 7 deletions

View file

@ -4,11 +4,13 @@ Date: Fri, 3 Dec 2021 17:09:24 -0800
Subject: [PATCH] Fix Spigot growth modifiers Subject: [PATCH] Fix Spigot growth modifiers
Fixes kelp modifier changing growth for other crops Fixes kelp modifier changing growth for other crops
Also add growth modifiers for glow berries Also add growth modifiers for glow berries, mangrove propagules
and torchflower crops
Also fix above-mentioned modifiers from having the reverse effect Also fix above-mentioned modifiers from having the reverse effect
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com>
Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.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 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 55f2fa02a36f0500b47f9ce377926719557106e5..18b5bce1138d50be32e5da013221be69dc47e21f 100644 index 55f2fa02a36f0500b47f9ce377926719557106e5..18b5bce1138d50be32e5da013221be69dc47e21f 100644
@ -33,6 +35,21 @@ index 55f2fa02a36f0500b47f9ce377926719557106e5..18b5bce1138d50be32e5da013221be69
@Override @Override
public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) { public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) {
return new ItemStack(Items.GLOW_BERRIES); return new ItemStack(Items.GLOW_BERRIES);
diff --git a/src/main/java/net/minecraft/world/level/block/CropBlock.java b/src/main/java/net/minecraft/world/level/block/CropBlock.java
index 519d02a2009c4f09c9e8be7196a701f0f042012d..a140fed067e7e6c1c42e111f47d3678863ef95ce 100644
--- a/src/main/java/net/minecraft/world/level/block/CropBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/CropBlock.java
@@ -84,6 +84,10 @@ public class CropBlock extends BushBlock implements BonemealableBlock {
modifier = world.spigotConfig.carrotModifier;
} else if (this == Blocks.POTATOES) {
modifier = world.spigotConfig.potatoModifier;
+ // Paper start
+ } else if (this == Blocks.TORCHFLOWER_CROP) {
+ modifier = world.spigotConfig.torchFlowerModifier;
+ // Paper end
} else {
modifier = world.spigotConfig.wheatModifier;
}
diff --git a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java b/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java 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 53b91cf8092b46dbf45afea9ccf439d565d1914a..3a1aa4e2405090ccebefb7f5944f36462929e221 100644 index 53b91cf8092b46dbf45afea9ccf439d565d1914a..3a1aa4e2405090ccebefb7f5944f36462929e221 100644
--- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java --- a/src/main/java/net/minecraft/world/level/block/GrowingPlantHeadBlock.java
@ -57,11 +74,32 @@ index 53b91cf8092b46dbf45afea9ccf439d565d1914a..3a1aa4e2405090ccebefb7f5944f3646
protected BlockState getGrowIntoState(BlockState state, RandomSource random) { protected BlockState getGrowIntoState(BlockState state, RandomSource random) {
return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE); return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE);
} }
diff --git a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
index 5d78348fc18b22ccb7ad109890f867e20efec047..44c78f0d56c3459c063c104e401a521e3df7d8e5 100644
--- a/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/MangrovePropaguleBlock.java
@@ -89,7 +89,7 @@ public class MangrovePropaguleBlock extends SaplingBlock implements SimpleWaterl
@Override
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
if (!isHanging(state)) {
- if (random.nextInt(7) == 0) {
+ if (random.nextFloat() < (world.spigotConfig.saplingModifier / (100.0F * 7))) { // Paper
this.advanceTree(world, pos, state, random);
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index 102b038e2566cba4f259a61e502ff0808c47234c..6bcc46795d1f78746192cc107c4a1f61580ec3c5 100644 index 102b038e2566cba4f259a61e502ff0808c47234c..ccbbc64b0ffaf055f98db71acaed9f51591f0594 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -106,6 +106,7 @@ public class SpigotWorldConfig @@ -96,6 +96,7 @@ public class SpigotWorldConfig
public int beetrootModifier;
public int carrotModifier;
public int potatoModifier;
+ public int torchFlowerModifier; // Paper
public int wheatModifier;
public int wartModifier;
public int vineModifier;
@@ -106,6 +107,7 @@ public class SpigotWorldConfig
public int twistingVinesModifier; public int twistingVinesModifier;
public int weepingVinesModifier; public int weepingVinesModifier;
public int caveVinesModifier; public int caveVinesModifier;
@ -69,7 +107,15 @@ index 102b038e2566cba4f259a61e502ff0808c47234c..6bcc46795d1f78746192cc107c4a1f61
private int getAndValidateGrowth(String crop) private int getAndValidateGrowth(String crop)
{ {
int modifier = this.getInt( "growth." + crop.toLowerCase(java.util.Locale.ENGLISH) + "-modifier", 100 ); int modifier = this.getInt( "growth." + crop.toLowerCase(java.util.Locale.ENGLISH) + "-modifier", 100 );
@@ -139,6 +140,7 @@ public class SpigotWorldConfig @@ -129,6 +131,7 @@ public class SpigotWorldConfig
this.beetrootModifier = this.getAndValidateGrowth( "Beetroot" );
this.carrotModifier = this.getAndValidateGrowth( "Carrot" );
this.potatoModifier = this.getAndValidateGrowth( "Potato" );
+ this.torchFlowerModifier = this.getAndValidateGrowth("TorchFlower"); // Paper
this.wheatModifier = this.getAndValidateGrowth( "Wheat" );
this.wartModifier = this.getAndValidateGrowth( "NetherWart" );
this.vineModifier = this.getAndValidateGrowth( "Vine" );
@@ -139,6 +142,7 @@ public class SpigotWorldConfig
this.twistingVinesModifier = this.getAndValidateGrowth( "TwistingVines" ); this.twistingVinesModifier = this.getAndValidateGrowth( "TwistingVines" );
this.weepingVinesModifier = this.getAndValidateGrowth( "WeepingVines" ); this.weepingVinesModifier = this.getAndValidateGrowth( "WeepingVines" );
this.caveVinesModifier = this.getAndValidateGrowth( "CaveVines" ); this.caveVinesModifier = this.getAndValidateGrowth( "CaveVines" );

View file

@ -229,10 +229,10 @@ index 65dcb14241baadb2c9f8f16919d7b562198ad9c3..594a2dd3b1d4c29c969d1992b8e93795
@Override @Override
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
index fb1495f9afe87ad80098beedbaa44efb66e36bca..39a823c03c9542a193b6c9555a01a1562be7d339 100644 index 8c45f28450bc1079ee5d184591f1ac03babced4e..bbfafb1400721251dfd2cac4dd8a31be2d682d4b 100644
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -364,6 +364,16 @@ public class SpigotWorldConfig @@ -366,6 +366,16 @@ public class SpigotWorldConfig
public int mansionSeed; public int mansionSeed;
public int fossilSeed; public int fossilSeed;
public int portalSeed; public int portalSeed;
@ -249,7 +249,7 @@ index fb1495f9afe87ad80098beedbaa44efb66e36bca..39a823c03c9542a193b6c9555a01a156
private void initWorldGenSeeds() private void initWorldGenSeeds()
{ {
this.villageSeed = this.getInt( "seed-village", 10387312 ); this.villageSeed = this.getInt( "seed-village", 10387312 );
@@ -381,6 +391,12 @@ public class SpigotWorldConfig @@ -383,6 +393,12 @@ public class SpigotWorldConfig
this.mansionSeed = this.getInt( "seed-mansion", 10387319 ); this.mansionSeed = this.getInt( "seed-mansion", 10387319 );
this.fossilSeed = this.getInt( "seed-fossil", 14357921 ); this.fossilSeed = this.getInt( "seed-fossil", 14357921 );
this.portalSeed = this.getInt( "seed-portal", 34222645 ); this.portalSeed = this.getInt( "seed-portal", 34222645 );