Paper/nms-patches/BlockVine.patch

76 lines
7.0 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
2016-05-10 13:47:39 +02:00
@@ -4,6 +4,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 {
public static final BlockStateBoolean UP = BlockStateBoolean.of("up");
2017-05-14 04:00:00 +02:00
@@ -176,7 +178,13 @@
}
if (((Boolean) iblockdata1.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.WEST)).booleanValue()) {
2015-05-05 22:43:47 +02:00
- world.setTypeAndData(blockposition1, iblockdata1, 2);
+ // CraftBukkit start - Call BlockSpreadEvent
2015-05-05 22:43:47 +02:00
+ // world.setTypeAndData(blockposition1, iblockdata1, 2);
+ BlockPosition target = blockposition1;
+ org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.bukkit.block.Block block = world.getWorld().getBlockAt(target.getX(), target.getY(), target.getZ());
+ CraftEventFactory.handleBlockSpreadEvent(block, source, this, toLegacyData(iblockdata1));
+ // CraftBukkit end
}
}
2017-05-14 04:00:00 +02:00
@@ -198,17 +206,29 @@
2016-02-29 22:32:46 +01:00
BlockPosition blockposition3 = blockposition2.shift(enumdirection2);
BlockPosition blockposition4 = blockposition2.shift(enumdirection3);
2015-01-07 00:53:53 +01:00
+ // CraftBukkit start - Call BlockSpreadEvent
+ org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ());
2015-01-07 00:53:53 +01:00
+
2017-05-14 04:00:00 +02:00
if (flag2 && this.a(world, blockposition3.shift(enumdirection2), enumdirection2)) {
2015-07-30 08:56:52 +02:00
- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
2016-02-29 22:32:46 +01:00
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2);
2015-07-30 08:56:52 +02:00
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true))));
2017-05-14 04:00:00 +02:00
} else if (flag3 && this.a(world, blockposition4.shift(enumdirection3), enumdirection3)) {
2016-02-29 22:32:46 +01:00
- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
+ // world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true)), 2);
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection3), Boolean.valueOf(true))));
2017-05-14 04:00:00 +02:00
} else if (flag2 && world.isEmpty(blockposition3) && this.a(world, blockposition3, enumdirection)) {
2015-07-30 08:56:52 +02:00
- world.setTypeAndData(blockposition3, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
2016-02-29 22:32:46 +01:00
+ // world.setTypeAndData(blockposition3, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
+ bukkitBlock = world.getWorld().getBlockAt(blockposition3.getX(), blockposition3.getY(), blockposition3.getZ());
2015-07-30 08:56:52 +02:00
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true))));
2017-05-14 04:00:00 +02:00
} else if (flag3 && world.isEmpty(blockposition4) && this.a(world, blockposition4, enumdirection)) {
2015-07-30 08:56:52 +02:00
- world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
2016-02-29 22:32:46 +01:00
+ // world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2);
2015-05-05 22:43:47 +02:00
+ bukkitBlock = world.getWorld().getBlockAt(blockposition4.getX(), blockposition4.getY(), blockposition4.getZ());
2015-07-30 08:56:52 +02:00
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true))));
2017-05-14 04:00:00 +02:00
} else if (this.a(world, blockposition2.up(), EnumDirection.DOWN)) {
2015-05-05 22:43:47 +02:00
- world.setTypeAndData(blockposition2, this.getBlockData(), 2);
+ // world.setTypeAndData(blockposition2, this.getBlockData(), 2);
2015-01-07 00:53:53 +01:00
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData()));
}
+ // CraftBukkit end
2017-05-14 04:00:00 +02:00
} else if (iblockdata2.d(world, blockposition2, enumdirection) == EnumBlockFaceShape.SOLID) {
2015-07-30 08:56:52 +02:00
world.setTypeAndData(blockposition, iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2);
}
2017-05-14 04:00:00 +02:00
@@ -235,7 +255,12 @@
}
if (((Boolean) iblockdata3.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.WEST)).booleanValue()) {
2015-05-05 22:43:47 +02:00
- world.setTypeAndData(blockposition2, iblockdata3, 2);
2015-01-07 00:53:53 +01:00
+ // CraftBukkit start - Call BlockSpreadEvent
2015-05-05 22:43:47 +02:00
+ // world.setTypeAndData(blockposition2, iblockdata3, 2);
+ org.bukkit.block.Block source = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
2015-05-05 22:43:47 +02:00
+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ());
+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(iblockdata3));
+ // CraftBukkit end
}
2016-02-29 22:32:46 +01:00
} else if (block == this) {
iblockdata3 = iblockdata2;