aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/VineBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/VineBlock.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/VineBlock.java.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/VineBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/VineBlock.java.patch
new file mode 100644
index 0000000000..7769430bf5
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/VineBlock.java.patch
@@ -0,0 +1,102 @@
+--- a/net/minecraft/world/level/block/VineBlock.java
++++ b/net/minecraft/world/level/block/VineBlock.java
+@@ -24,6 +24,7 @@
+ import net.minecraft.world.phys.shapes.CollisionContext;
+ import net.minecraft.world.phys.shapes.Shapes;
+ import net.minecraft.world.phys.shapes.VoxelShape;
++import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
+ public class VineBlock extends Block {
+ public static final MapCodec<VineBlock> CODEC = simpleCodec(VineBlock::new);
+@@ -188,19 +194,23 @@
+ BlockPos blockPos = pos.above();
+ if (random1.getAxis().isHorizontal() && !state.getValue(getPropertyForFace(random1))) {
+ if (this.canSpread(level, pos)) {
+- BlockPos blockPos1 = pos.relative(random1);
+- BlockState blockState = level.getBlockState(blockPos1);
+- if (blockState.isAir()) {
+- Direction clockWise = random1.getClockWise();
+- Direction counterClockWise = random1.getCounterClockWise();
+- boolean flag = state.getValue(getPropertyForFace(clockWise));
+- boolean flag1 = state.getValue(getPropertyForFace(counterClockWise));
+- BlockPos blockPos2 = blockPos1.relative(clockWise);
+- BlockPos blockPos3 = blockPos1.relative(counterClockWise);
+- if (flag && isAcceptableNeighbour(level, blockPos2, clockWise)) {
+- level.setBlock(blockPos1, this.defaultBlockState().setValue(getPropertyForFace(clockWise), Boolean.valueOf(true)), 2);
+- } else if (flag1 && isAcceptableNeighbour(level, blockPos3, counterClockWise)) {
+- level.setBlock(blockPos1, this.defaultBlockState().setValue(getPropertyForFace(counterClockWise), Boolean.valueOf(true)), 2);
++ blockposition2 = pos.relative(enumdirection);
++ iblockdata1 = level.getBlockState(blockposition2);
++ if (iblockdata1.isAir()) {
++ enumdirection1 = enumdirection.getClockWise();
++ Direction enumdirection2 = enumdirection.getCounterClockWise();
++ boolean flag = (Boolean) state.getValue(getPropertyForFace(enumdirection1));
++ boolean flag1 = (Boolean) state.getValue(getPropertyForFace(enumdirection2));
++ BlockPos blockposition3 = blockposition2.relative(enumdirection1);
++ BlockPos blockposition4 = blockposition2.relative(enumdirection2);
++
++ // CraftBukkit start - Call BlockSpreadEvent
++ BlockPos source = pos;
++
++ if (flag && isAcceptableNeighbour(level, blockposition3, enumdirection1)) {
++ CraftEventFactory.handleBlockSpreadEvent(level, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection1), true), 2);
++ } else if (flag1 && isAcceptableNeighbour(level, blockposition4, enumdirection2)) {
++ CraftEventFactory.handleBlockSpreadEvent(level, source, blockposition2, (IBlockData) this.defaultBlockState().setValue(getPropertyForFace(enumdirection2), true), 2);
+ } else {
+ Direction opposite = random1.getOpposite();
+ if (flag && level.isEmptyBlock(blockPos2) && isAcceptableNeighbour(level, pos.relative(clockWise), opposite)) {
+@@ -210,15 +221,16 @@
+ } else if ((double)random.nextFloat() < 0.05 && isAcceptableNeighbour(level, blockPos1.above(), Direction.UP)) {
+ level.setBlock(blockPos1, this.defaultBlockState().setValue(UP, Boolean.valueOf(true)), 2);
+ }
++ // CraftBukkit end
+ }
+- } else if (isAcceptableNeighbour(level, blockPos1, random1)) {
+- level.setBlock(pos, state.setValue(getPropertyForFace(random1), Boolean.valueOf(true)), 2);
++ } else if (isAcceptableNeighbour(level, blockposition2, enumdirection)) {
++ CraftEventFactory.handleBlockGrowEvent(level, pos, (IBlockData) state.setValue(getPropertyForFace(enumdirection), true), 2); // CraftBukkit
+ }
+ }
+ } else {
+- if (random1 == Direction.UP && pos.getY() < level.getMaxBuildHeight() - 1) {
+- if (this.canSupportAtFace(level, pos, random1)) {
+- level.setBlock(pos, state.setValue(UP, Boolean.valueOf(true)), 2);
++ if (enumdirection == Direction.UP && pos.getY() < level.getMaxBuildHeight() - 1) {
++ if (this.canSupportAtFace(level, pos, enumdirection)) {
++ CraftEventFactory.handleBlockGrowEvent(level, pos, (IBlockData) state.setValue(VineBlock.UP, true), 2); // CraftBukkit
+ return;
+ }
+
+@@ -235,8 +250,8 @@
+ }
+ }
+
+- if (this.hasHorizontalConnection(blockState1)) {
+- level.setBlock(blockPos, blockState1, 2);
++ if (this.hasHorizontalConnection(iblockdata2)) {
++ CraftEventFactory.handleBlockSpreadEvent(level, pos, blockposition1, iblockdata2, 2); // CraftBukkit
+ }
+
+ return;
+@@ -244,13 +259,14 @@
+ }
+
+ if (pos.getY() > level.getMinBuildHeight()) {
+- BlockPos blockPos1 = pos.below();
+- BlockState blockState = level.getBlockState(blockPos1);
+- if (blockState.isAir() || blockState.is(this)) {
+- BlockState blockState2 = blockState.isAir() ? this.defaultBlockState() : blockState;
+- BlockState blockState3 = this.copyRandomFaces(state, blockState2, random);
+- if (blockState2 != blockState3 && this.hasHorizontalConnection(blockState3)) {
+- level.setBlock(blockPos1, blockState3, 2);
++ blockposition2 = pos.below();
++ iblockdata1 = level.getBlockState(blockposition2);
++ if (iblockdata1.isAir() || iblockdata1.is((Block) this)) {
++ IBlockData iblockdata3 = iblockdata1.isAir() ? this.defaultBlockState() : iblockdata1;
++ IBlockData iblockdata4 = this.copyRandomFaces(state, iblockdata3, random);
++
++ if (iblockdata3 != iblockdata4 && this.hasHorizontalConnection(iblockdata4)) {
++ CraftEventFactory.handleBlockSpreadEvent(level, pos, blockposition2, iblockdata4, 2); // CraftBukkit
+ }
+ }
+ }