mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 10:27:44 +01:00
Chance for azalea blocks to grow into trees naturally
This commit is contained in:
committed by
granny
parent
ee67d017e2
commit
8ce5cc6607
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user