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()

View File

@@ -773,6 +773,11 @@ public class PurpurWorldConfig {
anvilColorsUseMiniMessage = getBoolean("blocks.anvil.use-mini-message", anvilColorsUseMiniMessage);
}
public double azaleaGrowthChance = 0.0D;
private void azaleaSettings() {
azaleaGrowthChance = getDouble("blocks.azalea.growth-chance", azaleaGrowthChance);
}
public int beaconLevelOne = 20;
public int beaconLevelTwo = 30;
public int beaconLevelThree = 40;
@@ -910,6 +915,11 @@ public class PurpurWorldConfig {
farmlandTramplingFeatherFalling = getBoolean("blocks.farmland.feather-fall-distance-affects-trampling", farmlandTramplingFeatherFalling);
}
public double floweringAzaleaGrowthChance = 0.0D;
private void floweringAzaleaSettings() {
floweringAzaleaGrowthChance = getDouble("blocks.flowering_azalea.growth-chance", floweringAzaleaGrowthChance);
}
public boolean furnaceUseLavaFromUnderneath = false;
private void furnaceSettings() {
if (PurpurConfig.version < 17) {