SPIGOT-7095: StructureGrowEvent doesn't fire for mangrove propagules growing to a tree

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2022-07-10 14:12:30 +10:00
parent 86d63605da
commit 35388a73b0

View file

@ -21,14 +21,14 @@
protected BlockSapling(WorldGenTreeProvider worldgentreeprovider, BlockBase.Info blockbase_info) {
super(blockbase_info);
@@ -35,7 +43,30 @@
@Override
public void randomTick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, RandomSource randomsource) {
if (worldserver.getMaxLocalRawBrightness(blockposition.above()) >= 9 && randomsource.nextInt(7) == 0) {
@@ -44,7 +52,30 @@
if ((Integer) iblockdata.getValue(BlockSapling.STAGE) == 0) {
worldserver.setBlock(blockposition, (IBlockData) iblockdata.cycle(BlockSapling.STAGE), 4);
} else {
+ // CraftBukkit start
+ worldserver.captureTreeGeneration = true;
+ // CraftBukkit end
this.advanceTree(worldserver, blockposition, iblockdata, randomsource);
this.treeGrower.growTree(worldserver, worldserver.getChunkSource().getGenerator(), blockposition, iblockdata, randomsource);
+ // CraftBukkit start
+ worldserver.captureTreeGeneration = false;
+ if (worldserver.capturedBlockStates.size() > 0) {