diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch new file mode 100644 index 0000000000..511200af88 --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/CaveVinesBlock.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/world/level/block/CaveVinesBlock.java ++++ b/net/minecraft/world/level/block/CaveVinesBlock.java +@@ -50,9 +50,18 @@ + return to.setValue(BERRIES, from.getValue(BERRIES)); + } + ++ // Paper start - Fix Spigot growth modifiers + @Override ++ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) { ++ final boolean value = random.nextFloat() < (level != null ? (0.11F * (level.spigotConfig.glowBerryModifier / 100.0F)) : 0.11F); ++ return (BlockState) super.getGrowIntoState(state, random).setValue(CaveVinesBlock.BERRIES, value); ++ } ++ // Paper end - Fix Spigot growth modifiers ++ ++ @Override + protected BlockState getGrowIntoState(BlockState state, RandomSource random) { +- return super.getGrowIntoState(state, random).setValue(BERRIES, Boolean.valueOf(random.nextFloat() < 0.11F)); ++ // Paper start - Fix Spigot growth modifiers ++ return this.getGrowIntoState(state, random, null); + } + + @Override diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch index 71ebb9a1f9..4883d93884 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/CropBlock.java.patch @@ -8,7 +8,7 @@ public class CropBlock extends BushBlock implements BonemealableBlock { -@@ -82,9 +83,22 @@ +@@ -82,9 +83,26 @@ if (i < this.getMaxAge()) { float f = CropBlock.getGrowthSpeed(this, world, pos); @@ -22,6 +22,10 @@ + modifier = world.spigotConfig.carrotModifier; + } else if (this == Blocks.POTATOES) { + modifier = world.spigotConfig.potatoModifier; ++ // Paper start - Fix Spigot growth modifiers ++ } else if (this == Blocks.TORCHFLOWER_CROP) { ++ modifier = world.spigotConfig.torchFlowerModifier; ++ // Paper end - Fix Spigot growth modifiers + } else { + modifier = world.spigotConfig.wheatModifier; } @@ -33,7 +37,7 @@ } } -@@ -98,7 +112,7 @@ +@@ -98,7 +116,7 @@ i = j; } @@ -42,7 +46,7 @@ } protected int getBonemealAgeIncrease(Level world) { -@@ -160,8 +174,9 @@ +@@ -160,8 +178,9 @@ @Override protected void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch index 738beeeb32..b55ee5aef9 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/GrowingPlantHeadBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/GrowingPlantHeadBlock.java +++ b/net/minecraft/world/level/block/GrowingPlantHeadBlock.java -@@ -44,11 +44,23 @@ +@@ -44,16 +44,34 @@ @Override protected void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { @@ -22,7 +22,18 @@ if (this.canGrowInto(world.getBlockState(blockposition1))) { - world.setBlockAndUpdate(blockposition1, this.getGrowIntoState(state, world.random)); -+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random)); // CraftBukkit ++ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, pos, blockposition1, this.getGrowIntoState(state, world.random, world)); // CraftBukkit // Paper - Fix Spigot growth modifiers } } + } + ++ // Paper start - Fix Spigot growth modifiers ++ protected BlockState getGrowIntoState(BlockState state, RandomSource random, @javax.annotation.Nullable Level level) { ++ return this.getGrowIntoState(state, random); ++ } ++ // Paper end - Fix Spigot growth modifiers ++ + protected BlockState getGrowIntoState(BlockState state, RandomSource random) { + return (BlockState) state.cycle(GrowingPlantHeadBlock.AGE); + } diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/MangrovePropaguleBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/MangrovePropaguleBlock.java.patch new file mode 100644 index 0000000000..8a2e3114dc --- /dev/null +++ b/paper-server/patches/sources/net/minecraft/world/level/block/MangrovePropaguleBlock.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/level/block/MangrovePropaguleBlock.java ++++ b/net/minecraft/world/level/block/MangrovePropaguleBlock.java +@@ -123,7 +123,7 @@ + @Override + protected 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 - Fix Spigot growth modifiers + this.advanceTree(world, pos, state, random); + } + } else { diff --git a/paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch b/paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch index 5ff278b072..ce43fed731 100644 --- a/paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/level/block/PitcherCropBlock.java.patch @@ -8,3 +8,12 @@ if (world instanceof ServerLevel serverLevel && entity instanceof Ravager && serverLevel.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { serverLevel.destroyBlock(pos, true, entity); } +@@ -131,7 +132,7 @@ + @Override + public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) { + float f = CropBlock.getGrowthSpeed(this, world, pos); +- boolean bl = random.nextInt((int)(25.0F / f) + 1) == 0; ++ boolean bl = random.nextFloat() < (world.spigotConfig.pitcherPlantModifier / (100.0F * (Math.floor(25.0F / f) + 1))); // Paper - Fix Spigot growth modifiers + if (bl) { + this.grow(world, state, pos, 1); + } diff --git a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java index 491dd55b28..e76f96a5c4 100644 --- a/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/paper-server/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -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,8 @@ public class SpigotWorldConfig public int twistingVinesModifier; public int weepingVinesModifier; public int caveVinesModifier; + public int glowBerryModifier; // Paper + public int pitcherPlantModifier; // Paper private int getAndValidateGrowth(String crop) { int modifier = this.getInt( "growth." + crop.toLowerCase(java.util.Locale.ENGLISH) + "-modifier", 100 ); @@ -129,6 +132,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 +143,8 @@ public class SpigotWorldConfig this.twistingVinesModifier = this.getAndValidateGrowth( "TwistingVines" ); this.weepingVinesModifier = this.getAndValidateGrowth( "WeepingVines" ); this.caveVinesModifier = this.getAndValidateGrowth( "CaveVines" ); + this.glowBerryModifier = this.getAndValidateGrowth("GlowBerry"); // Paper + this.pitcherPlantModifier = this.getAndValidateGrowth("PitcherPlant"); // Paper } public double itemMerge;