2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockVine.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockVine.java
|
2023-12-05 17:40:00 +01:00
|
|
|
@@ -25,6 +25,8 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
|
|
|
|
import net.minecraft.world.phys.shapes.VoxelShapes;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
|
|
|
|
+
|
|
|
|
public class BlockVine extends Block {
|
|
|
|
|
2023-12-05 17:40:00 +01:00
|
|
|
public static final MapCodec<BlockVine> CODEC = simpleCodec(BlockVine::new);
|
|
|
|
@@ -203,30 +205,34 @@
|
2023-03-14 17:30:00 +01:00
|
|
|
BlockPosition blockposition3 = blockposition2.relative(enumdirection1);
|
|
|
|
BlockPosition blockposition4 = blockposition2.relative(enumdirection2);
|
2015-01-07 00:53:53 +01:00
|
|
|
|
2023-03-14 17:30:00 +01:00
|
|
|
+ // CraftBukkit start - Call BlockSpreadEvent
|
|
|
|
+ BlockPosition source = blockposition;
|
2015-01-07 00:53:53 +01:00
|
|
|
+
|
2023-03-14 17:30:00 +01:00
|
|
|
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();
|
2018-07-15 02:00:00 +02:00
|
|
|
|
2023-03-14 17:30:00 +01:00
|
|
|
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)) {
|
2023-08-19 01:43:27 +02:00
|
|
|
- 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;
|
|
|
|
}
|
|
|
|
|
2023-12-05 17:40:00 +01:00
|
|
|
@@ -246,7 +252,7 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2023-03-14 17:30:00 +01:00
|
|
|
if (this.hasHorizontalConnection(iblockdata2)) {
|
|
|
|
- worldserver.setBlock(blockposition1, iblockdata2, 2);
|
|
|
|
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2, 2); // CraftBukkit
|
|
|
|
}
|
2018-07-15 02:00:00 +02:00
|
|
|
|
2023-03-14 17:30:00 +01:00
|
|
|
return;
|
2023-12-05 17:40:00 +01:00
|
|
|
@@ -261,7 +267,7 @@
|
2023-03-14 17:30:00 +01:00
|
|
|
IBlockData iblockdata4 = this.copyRandomFaces(iblockdata, iblockdata3, randomsource);
|
2018-07-15 02:00:00 +02:00
|
|
|
|
2023-03-14 17:30:00 +01:00
|
|
|
if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) {
|
|
|
|
- worldserver.setBlock(blockposition2, iblockdata4, 2);
|
|
|
|
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata4, 2); // CraftBukkit
|
|
|
|
}
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
|
|
|
}
|