2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/BlockFlowing.java
|
|
|
|
+++ b/net/minecraft/server/BlockFlowing.java
|
2014-11-25 22:32:16 +01:00
|
|
|
@@ -5,6 +5,11 @@
|
|
|
|
import java.util.Random;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.block.BlockFace;
|
|
|
|
+import org.bukkit.event.block.BlockFromToEvent;
|
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
|
|
|
public class BlockFlowing extends BlockFluids {
|
|
|
|
|
|
|
|
int a;
|
2015-04-01 18:21:15 +02:00
|
|
|
@@ -18,6 +23,11 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) {
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ org.bukkit.World bworld = world.getWorld();
|
|
|
|
+ org.bukkit.Server server = world.getServer();
|
|
|
|
+ org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
|
|
+ // CraftBukkit end
|
2015-04-01 18:21:15 +02:00
|
|
|
int i = ((Integer) iblockdata.get(BlockFlowing.LEVEL)).intValue();
|
2014-11-25 22:32:16 +01:00
|
|
|
byte b0 = 1;
|
|
|
|
|
2015-02-26 23:41:06 +01:00
|
|
|
@@ -88,6 +98,12 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
IBlockData iblockdata2 = world.getType(blockposition.down());
|
|
|
|
|
|
|
|
if (this.h(world, blockposition.down(), iblockdata2)) {
|
|
|
|
+ // CraftBukkit start - Send "down" to the server
|
|
|
|
+ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
|
|
|
|
+ if (server != null) {
|
|
|
|
+ server.getPluginManager().callEvent(event);
|
|
|
|
+ }
|
|
|
|
+ if (!event.isCancelled()) {
|
2016-02-29 22:32:46 +01:00
|
|
|
if (this.material == Material.LAVA && world.getType(blockposition.down()).getMaterial() == Material.WATER) {
|
2015-02-26 23:41:06 +01:00
|
|
|
world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData());
|
|
|
|
this.fizz(world, blockposition.down());
|
|
|
|
@@ -99,6 +115,8 @@
|
|
|
|
} else {
|
|
|
|
this.flow(world, blockposition.down(), iblockdata2, i + 8);
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
+ }
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
} else if (i >= 0 && (i == 0 || this.g(world, blockposition.down(), iblockdata2))) {
|
2016-02-29 22:32:46 +01:00
|
|
|
Set set = this.c(world, blockposition);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2015-04-01 18:21:15 +02:00
|
|
|
@@ -116,14 +134,23 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
while (iterator1.hasNext()) {
|
|
|
|
EnumDirection enumdirection1 = (EnumDirection) iterator1.next();
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2014-11-25 22:32:16 +01:00
|
|
|
- this.flow(world, blockposition.shift(enumdirection1), world.getType(blockposition.shift(enumdirection1)), k);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection1));
|
|
|
|
+ if (server != null) {
|
|
|
|
+ server.getPluginManager().callEvent(event);
|
|
|
|
+ }
|
2015-02-26 23:41:06 +01:00
|
|
|
+
|
2014-11-25 22:32:16 +01:00
|
|
|
+ if (!event.isCancelled()) {
|
|
|
|
+ this.flow(world, blockposition.shift(enumdirection1), world.getType(blockposition.shift(enumdirection1)), k);
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-01 18:21:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void flow(World world, BlockPosition blockposition, IBlockData iblockdata, int i) {
|
|
|
|
- if (this.h(world, blockposition, iblockdata)) {
|
|
|
|
+ if (world.isLoaded(blockposition) && this.h(world, blockposition, iblockdata)) { // CraftBukkit - add isLoaded check
|
2016-06-09 03:43:49 +02:00
|
|
|
if (iblockdata.getMaterial() != Material.AIR) {
|
2015-04-01 18:21:15 +02:00
|
|
|
if (this.material == Material.LAVA) {
|
|
|
|
this.fizz(world, blockposition);
|