diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/SaplingBlock.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/SaplingBlock.java.patch | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/SaplingBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/SaplingBlock.java.patch new file mode 100644 index 0000000000..d472f07842 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/SaplingBlock.java.patch @@ -0,0 +1,60 @@ +--- a/net/minecraft/world/level/block/SaplingBlock.java ++++ b/net/minecraft/world/level/block/SaplingBlock.java +@@ -16,6 +16,13 @@ + import net.minecraft.world.level.block.state.properties.IntegerProperty; + import net.minecraft.world.phys.shapes.CollisionContext; + import net.minecraft.world.phys.shapes.VoxelShape; ++// CraftBukkit start ++import org.bukkit.Location; ++import org.bukkit.TreeType; ++import org.bukkit.block.BlockState; ++import org.bukkit.craftbukkit.util.CraftLocation; ++import org.bukkit.event.world.StructureGrowEvent; ++// CraftBukkit end + + public class SaplingBlock extends BushBlock implements BonemealableBlock { + +@@ -27,7 +34,8 @@ + public static final IntegerProperty STAGE = BlockStateProperties.STAGE; + protected static final float AABB_OFFSET = 6.0F; + protected static final VoxelShape SHAPE = Block.box(2.0D, 0.0D, 2.0D, 14.0D, 12.0D, 14.0D); +- protected final TreeGrower treeGrower; ++ protected final WorldGenTreeProvider treeGrower; ++ public static TreeType treeType; // CraftBukkit + + @Override + @Override +@@ -60,7 +65,32 @@ + if ((Integer) blockstate.getValue(SaplingBlock.STAGE) == 0) { + serverlevel.setBlock(blockpos, (BlockState) blockstate.cycle(SaplingBlock.STAGE), 4); + } else { +- this.treeGrower.growTree(serverlevel, serverlevel.getChunkSource().getGenerator(), blockpos, blockstate, randomsource); ++ // CraftBukkit start ++ if (level.captureTreeGeneration) { ++ this.treeGrower.growTree(level, level.getChunkSource().getGenerator(), pos, state, random); ++ } else { ++ level.captureTreeGeneration = true; ++ this.treeGrower.growTree(level, level.getChunkSource().getGenerator(), pos, state, random); ++ level.captureTreeGeneration = false; ++ if (level.capturedBlockStates.size() > 0) { ++ TreeType treeType = SaplingBlock.treeType; ++ SaplingBlock.treeType = null; ++ Location location = CraftLocation.toBukkit(pos, level.getWorld()); ++ java.util.List<BlockState> blocks = new java.util.ArrayList<>(level.capturedBlockStates.values()); ++ level.capturedBlockStates.clear(); ++ StructureGrowEvent event = null; ++ if (treeType != null) { ++ event = new StructureGrowEvent(location, treeType, false, null, blocks); ++ org.bukkit.Bukkit.getPluginManager().callEvent(event); ++ } ++ if (event == null || !event.isCancelled()) { ++ for (BlockState blockstate : blocks) { ++ blockstate.update(true); ++ } ++ } ++ } ++ } ++ // CraftBukkit end + } + + } |