--- a/net/minecraft/world/level/block/BlockVine.java +++ b/net/minecraft/world/level/block/BlockVine.java @@ -25,6 +25,8 @@ import net.minecraft.world.phys.shapes.VoxelShapeCollision; import net.minecraft.world.phys.shapes.VoxelShapes; +import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit + public class BlockVine extends Block { public static final MapCodec CODEC = simpleCodec(BlockVine::new); @@ -203,30 +205,34 @@ BlockPosition blockposition3 = blockposition2.relative(enumdirection1); BlockPosition blockposition4 = blockposition2.relative(enumdirection2); + // CraftBukkit start - Call BlockSpreadEvent + BlockPosition source = blockposition; + if (flag && isAcceptableNeighbour(worldserver, blockposition3, enumdirection1)) { - worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2); + CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2); } else if (flag1 && isAcceptableNeighbour(worldserver, blockposition4, enumdirection2)) { - worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2); + CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2); } else { EnumDirection enumdirection3 = enumdirection.getOpposite(); if (flag && worldserver.isEmptyBlock(blockposition3) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection1), enumdirection3)) { - worldserver.setBlock(blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2); + CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2); } else if (flag1 && worldserver.isEmptyBlock(blockposition4) && isAcceptableNeighbour(worldserver, blockposition.relative(enumdirection2), enumdirection3)) { - worldserver.setBlock(blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2); + CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection3), true), 2); } else if ((double) randomsource.nextFloat() < 0.05D && isAcceptableNeighbour(worldserver, blockposition2.above(), EnumDirection.UP)) { - worldserver.setBlock(blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2); + CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(BlockVine.UP, true), 2); } + // CraftBukkit end } } else if (isAcceptableNeighbour(worldserver, blockposition2, enumdirection)) { - worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(getPropertyForFace(enumdirection), true), 2); + CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(getPropertyForFace(enumdirection), true), 2); // CraftBukkit } } } else { if (enumdirection == EnumDirection.UP && blockposition.getY() < worldserver.getMaxBuildHeight() - 1) { if (this.canSupportAtFace(worldserver, blockposition, enumdirection)) { - worldserver.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockVine.UP, true), 2); + CraftEventFactory.handleBlockGrowEvent(worldserver, blockposition, (IBlockData) iblockdata.setValue(BlockVine.UP, true), 2); // CraftBukkit return; } @@ -246,7 +252,7 @@ } if (this.hasHorizontalConnection(iblockdata2)) { - worldserver.setBlock(blockposition1, iblockdata2, 2); + CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2, 2); // CraftBukkit } return; @@ -261,7 +267,7 @@ IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, randomsource); if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) { - worldserver.setBlock(blockposition2, iblockdata4, 2); + CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata4, 2); // CraftBukkit } } }