PaperMC/nms-patches/BlockVine.patch

60 lines
4.3 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
2020-06-25 02:00:00 +02:00
@@ -5,6 +5,8 @@
import java.util.Random;
2016-05-10 13:47:39 +02:00
import javax.annotation.Nullable;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
public class BlockVine extends Block {
2019-04-23 04:00:00 +02:00
public static final BlockStateBoolean UP = BlockSprawling.e;
2020-06-25 02:00:00 +02:00
@@ -166,20 +168,24 @@
2019-12-10 23:00:00 +01:00
BlockPosition blockposition3 = blockposition2.shift(enumdirection1);
BlockPosition blockposition4 = blockposition2.shift(enumdirection2);
2015-01-07 00:53:53 +01:00
2019-12-10 23:00:00 +01:00
+ // CraftBukkit start - Call BlockSpreadEvent
+ BlockPosition source = blockposition;
2015-01-07 00:53:53 +01:00
+
2019-12-10 23:00:00 +01:00
if (flag && a((IBlockAccess) worldserver, blockposition3, enumdirection1)) {
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection1), true), 2);
} else if (flag1 && a((IBlockAccess) worldserver, blockposition4, enumdirection2)) {
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(getDirection(enumdirection2), true), 2);
} else {
EnumDirection enumdirection3 = enumdirection.opposite();
2018-07-15 02:00:00 +02:00
2019-12-10 23:00:00 +01:00
if (flag && worldserver.isEmpty(blockposition3) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection1), enumdirection3)) {
- worldserver.setTypeAndData(blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition3, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
} else if (flag1 && worldserver.isEmpty(blockposition4) && a((IBlockAccess) worldserver, blockposition.shift(enumdirection2), enumdirection3)) {
- worldserver.setTypeAndData(blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition4, (IBlockData) this.getBlockData().set(getDirection(enumdirection3), true), 2);
} else if ((double) worldserver.random.nextFloat() < 0.05D && a((IBlockAccess) worldserver, blockposition2.up(), EnumDirection.UP)) {
- worldserver.setTypeAndData(blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, source, blockposition2, (IBlockData) this.getBlockData().set(BlockVine.UP, true), 2);
2018-07-15 02:00:00 +02:00
}
2019-12-10 23:00:00 +01:00
+ // CraftBukkit end
}
} else if (a((IBlockAccess) worldserver, blockposition2, enumdirection)) {
worldserver.setTypeAndData(blockposition, (IBlockData) iblockdata.set(getDirection(enumdirection), true), 2);
2020-06-25 02:00:00 +02:00
@@ -209,7 +215,7 @@
2019-12-10 23:00:00 +01:00
}
2020-06-25 02:00:00 +02:00
if (this.canSpread(iblockdata2)) {
- worldserver.setTypeAndData(blockposition1, iblockdata2, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, iblockdata2, 2); // CraftBukkit
2019-12-10 23:00:00 +01:00
}
2018-07-15 02:00:00 +02:00
2019-12-10 23:00:00 +01:00
return;
2020-06-25 02:00:00 +02:00
@@ -224,7 +230,7 @@
IBlockData iblockdata4 = this.a(iblockdata, iblockdata3, random);
2018-07-15 02:00:00 +02:00
2020-06-25 02:00:00 +02:00
if (iblockdata3 != iblockdata4 && this.canSpread(iblockdata4)) {
- worldserver.setTypeAndData(blockposition2, iblockdata4, 2);
+ CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition2, iblockdata4, 2); // CraftBukkit
2018-07-15 02:00:00 +02:00
}
}
2019-12-10 23:00:00 +01:00
}