Chance for azalea blocks to grow into trees naturally

This commit is contained in:
William Blake Galbreath
2025-01-12 12:42:11 -08:00
committed by granny
parent ee67d017e2
commit 8ce5cc6607
4 changed files with 51 additions and 79 deletions

View File

@@ -0,0 +1,23 @@
--- a/net/minecraft/world/level/block/AzaleaBlock.java
+++ b/net/minecraft/world/level/block/AzaleaBlock.java
@@ -50,6 +_,20 @@
@Override
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
+ // Purpur start - Chance for azalea blocks to grow into trees naturally
+ growTree(level, random, pos, state);
+ }
+
+ @Override
+ public void randomTick(net.minecraft.world.level.block.state.BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
+ double chance = state.getBlock() == Blocks.FLOWERING_AZALEA ? world.purpurConfig.floweringAzaleaGrowthChance : world.purpurConfig.azaleaGrowthChance;
+ if (chance > 0.0D && world.getMaxLocalRawBrightness(pos.above()) > 9 && random.nextDouble() < chance) {
+ growTree(world, random, pos, state);
+ }
+ }
+
+ private void growTree(ServerLevel level, RandomSource random, BlockPos pos, net.minecraft.world.level.block.state.BlockState state) {
+ // Purpur end - Chance for azalea blocks to grow into trees naturally
TreeGrower.AZALEA.growTree(level, level.getChunkSource().getGenerator(), pos, state, random);
}

View File

@@ -0,0 +1,18 @@
--- a/net/minecraft/world/level/block/Blocks.java
+++ b/net/minecraft/world/level/block/Blocks.java
@@ -6486,6 +_,7 @@
BlockBehaviour.Properties.of()
.mapColor(MapColor.PLANT)
.forceSolidOff()
+ .randomTicks() // Purpur - Chance for azalea blocks to grow into trees naturally
.instabreak()
.sound(SoundType.AZALEA)
.noOcclusion()
@@ -6497,6 +_,7 @@
BlockBehaviour.Properties.of()
.mapColor(MapColor.PLANT)
.forceSolidOff()
+ .randomTicks() // Purpur - Chance for azalea blocks to grow into trees naturally
.instabreak()
.sound(SoundType.FLOWERING_AZALEA)
.noOcclusion()