SPIGOT-6428: World.generateTree does not generate bee nests

This commit is contained in:
md_5 2021-04-18 17:42:35 +10:00
parent 9294ebbf05
commit 28d72c4bd8
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11

View File

@ -751,18 +751,11 @@ public class CraftWorld implements World {
@Override @Override
public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) {
world.captureTreeGeneration = true; world.captureTreeGeneration = true;
world.captureBlockStates = true;
boolean grownTree = generateTree(loc, type); boolean grownTree = generateTree(loc, type);
world.captureBlockStates = false;
world.captureTreeGeneration = false; world.captureTreeGeneration = false;
if (grownTree) { // Copy block data to delegate if (grownTree) { // Copy block data to delegate
for (BlockState blockstate : world.capturedBlockStates.values()) { for (BlockState blockstate : world.capturedBlockStates.values()) {
BlockPosition position = ((CraftBlockState) blockstate).getPosition(); blockstate.update(true);
net.minecraft.world.level.block.state.IBlockData oldBlock = world.getType(position);
int flag = ((CraftBlockState) blockstate).getFlag();
delegate.setBlockData(blockstate.getX(), blockstate.getY(), blockstate.getZ(), blockstate.getBlockData());
net.minecraft.world.level.block.state.IBlockData newBlock = world.getType(position);
world.notifyAndUpdatePhysics(position, null, oldBlock, newBlock, newBlock, flag, 512);
} }
world.capturedBlockStates.clear(); world.capturedBlockStates.clear();
return true; return true;