-
-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chance for azalea blocks to grow into trees naturally
- Loading branch information
1 parent
612b1b9
commit dfb10bf
Showing
1 changed file
with
75 additions
and
0 deletions.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
patches/server/0256-Chance-for-azalea-blocks-to-grow-into-trees-naturall.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: William Blake Galbreath <blake.galbreath@gmail.com> | ||
Date: Mon, 23 Aug 2021 20:57:04 -0500 | ||
Subject: [PATCH] Chance for azalea blocks to grow into trees naturally | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java | ||
index 47b32d89766862b998824fd3dd97265899651c15..3ac8538f33c858495fa750e60c0b6dba113e2870 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/AzaleaBlock.java | ||
@@ -48,6 +48,21 @@ public class AzaleaBlock extends BushBlock implements BonemealableBlock { | ||
|
||
@Override | ||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, net.minecraft.world.level.block.state.BlockState state) { | ||
+ // Purpur start | ||
+ growTree(world, random, pos, state); | ||
+ } | ||
+ | ||
+ @Override | ||
+ public void randomTick(net.minecraft.world.level.block.state.BlockState state, ServerLevel world, BlockPos pos, Random random) { | ||
+ double chance = state.getBlock() == Blocks.FLOWERING_AZALEA ? world.purpurConfig.floweringAzaleaGrowthChance : world.purpurConfig.azaleaGrowthChance; | ||
+ System.out.println("random tick " + chance); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
+ if (chance > 0.0D && world.getMaxLocalRawBrightness(pos.above()) > 9 && random.nextDouble() < chance) { | ||
+ growTree(world, random, pos, state); | ||
+ } | ||
+ } | ||
+ | ||
+ private void growTree(ServerLevel world, Random random, BlockPos pos, net.minecraft.world.level.block.state.BlockState state) { | ||
+ // Purpur end | ||
// CraftBukkit start | ||
world.captureTreeGeneration = true; | ||
// CraftBukkit end | ||
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java | ||
index af4287e2fff8bc920f615ba56f78bd5acdec8721..31f84a7231667b593da8ed6cdada976f7769feef 100644 | ||
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java | ||
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java | ||
@@ -992,8 +992,8 @@ public class Blocks { | ||
public static final Block CAVE_VINES = register("cave_vines", new CaveVinesBlock(BlockBehaviour.Properties.of(Material.PLANT).randomTicks().noCollission().lightLevel(CaveVines.emission(14)).instabreak().sound(SoundType.CAVE_VINES))); | ||
public static final Block CAVE_VINES_PLANT = register("cave_vines_plant", new CaveVinesPlantBlock(BlockBehaviour.Properties.of(Material.PLANT).noCollission().lightLevel(CaveVines.emission(14)).instabreak().sound(SoundType.CAVE_VINES))); | ||
public static final Block SPORE_BLOSSOM = register("spore_blossom", new SporeBlossomBlock(BlockBehaviour.Properties.of(Material.PLANT).instabreak().noCollission().sound(SoundType.SPORE_BLOSSOM))); | ||
- public static final Block AZALEA = register("azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).instabreak().sound(SoundType.AZALEA).noOcclusion())); | ||
- public static final Block FLOWERING_AZALEA = register("flowering_azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).instabreak().sound(SoundType.FLOWERING_AZALEA).noOcclusion())); | ||
+ public static final Block AZALEA = register("azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).randomTicks().instabreak().sound(SoundType.AZALEA).noOcclusion())); // Purpur | ||
+ public static final Block FLOWERING_AZALEA = register("flowering_azalea", new AzaleaBlock(BlockBehaviour.Properties.of(Material.PLANT).randomTicks().instabreak().sound(SoundType.FLOWERING_AZALEA).noOcclusion())); // Purpur | ||
public static final Block MOSS_CARPET = register("moss_carpet", new CarpetBlock(BlockBehaviour.Properties.of(Material.PLANT, MaterialColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS_CARPET))); | ||
public static final Block MOSS_BLOCK = register("moss_block", new MossBlock(BlockBehaviour.Properties.of(Material.MOSS, MaterialColor.COLOR_GREEN).strength(0.1F).sound(SoundType.MOSS))); | ||
public static final Block BIG_DRIPLEAF = register("big_dripleaf", new BigDripleafBlock(BlockBehaviour.Properties.of(Material.PLANT).strength(0.1F).sound(SoundType.BIG_DRIPLEAF))); | ||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
index bbb420508b9e5522135bc8644d97cdfe820f42a2..5c8422a3022f2ac8723450b7566b9ac9a823931a 100644 | ||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java | ||
@@ -704,6 +704,11 @@ public class PurpurWorldConfig { | ||
anvilAllowColors = getBoolean("blocks.anvil.allow-colors", anvilAllowColors); | ||
} | ||
|
||
+ 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; | ||
@@ -840,6 +845,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) { |
Is it just for debugging and forgot to remove it before the release ...? Because the console is spammed by this line