PaperMC/nms-patches/BlockVine.patch

60 lines
4.4 KiB
Diff
Raw Normal View History

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/BlockVine.java
+++ b/net/minecraft/server/BlockVine.java
2018-12-25 22:00:00 +01:00
@@ -6,6 +6,8 @@
import java.util.Map.Entry;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockVine extends Block {
2018-08-26 04:00:00 +02:00
public static final BlockStateBoolean UP = BlockSprawling.p;
2018-12-25 22:00:00 +01:00
@@ -182,20 +184,24 @@
2018-07-15 02:00:00 +02:00
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
2015-01-07 00:53:53 +01:00
2018-07-15 02:00:00 +02:00
+ // CraftBukkit start - Call BlockSpreadEvent
+ BlockPosition source = blockposition;
2015-01-07 00:53:53 +01:00
+
2018-07-22 04:00:00 +02:00
if (flag && this.b((IBlockAccess) world, blockposition3, enumdirection1)) {
2018-12-06 00:00:00 +01:00
- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
2018-07-22 04:00:00 +02:00
} else if (flag1 && this.b((IBlockAccess) world, blockposition4, enumdirection2)) {
2018-12-06 00:00:00 +01:00
- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
2018-07-15 02:00:00 +02:00
} else {
EnumDirection enumdirection3 = enumdirection.opposite();
2018-07-22 04:00:00 +02:00
if (flag && world.isEmpty(blockposition3) && this.b((IBlockAccess) world, blockposition.shift(enumdirection1), enumdirection3)) {
2018-12-06 00:00:00 +01:00
- world.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
2018-07-22 04:00:00 +02:00
} else if (flag1 && world.isEmpty(blockposition4) && this.b((IBlockAccess) world, blockposition.shift(enumdirection2), enumdirection3)) {
2018-12-06 00:00:00 +01:00
- world.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
2018-07-22 04:00:00 +02:00
} else if ((double) world.random.nextFloat() < 0.05D && this.b((IBlockAccess) world, blockposition2.up(), EnumDirection.UP)) {
2018-12-06 00:00:00 +01:00
- world.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
}
+ // CraftBukkit end
}
2018-07-22 04:00:00 +02:00
} else if (this.b((IBlockAccess) world, blockposition2, enumdirection)) {
2018-12-06 00:00:00 +01:00
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
2018-12-25 22:00:00 +01:00
@@ -225,7 +231,7 @@
2018-07-15 02:00:00 +02:00
}
2018-07-15 02:00:00 +02:00
if (this.x(iblockdata3)) {
- world.setTypeAndData(blockposition1, iblockdata3, 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition1, iblockdata3, 2); // CraftBukkit
}
return;
2018-12-25 22:00:00 +01:00
@@ -240,7 +246,7 @@
2018-07-15 02:00:00 +02:00
IBlockData iblockdata5 = this.a(iblockdata, iblockdata4, random);
if (iblockdata4 != iblockdata5 && this.x(iblockdata5)) {
- world.setTypeAndData(blockposition2, iblockdata5, 2);
+ CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition2, iblockdata5, 2); // CraftBukkit
}
}
}