Commits
md_5 authored 9dc56581e66
1 1 | --- a/net/minecraft/server/FluidTypeFlowing.java |
2 2 | +++ b/net/minecraft/server/FluidTypeFlowing.java |
3 - | |
3 + | |
4 4 | import java.util.Iterator; |
5 5 | import java.util.Map; |
6 6 | import java.util.Map.Entry; |
7 7 | +// CraftBukkit start |
8 8 | +import org.bukkit.block.BlockFace; |
9 9 | +import org.bukkit.craftbukkit.block.CraftBlock; |
10 + | +import org.bukkit.craftbukkit.block.data.CraftBlockData; |
11 + | +import org.bukkit.craftbukkit.event.CraftEventFactory; |
10 12 | +import org.bukkit.event.block.BlockFromToEvent; |
13 + | +import org.bukkit.event.block.FluidLevelChangeEvent; |
11 14 | +// CraftBukkit end |
12 15 | |
13 16 | public abstract class FluidTypeFlowing extends FluidType { |
14 17 | |
15 - | |
18 + | |
16 19 | Fluid fluid1 = this.a((IWorldReader) generatoraccess, blockposition1, iblockdata1); |
17 20 | |
18 21 | if (this.a(generatoraccess, blockposition, iblockdata, EnumDirection.DOWN, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.c())) { |
19 22 | + // CraftBukkit start |
20 23 | + org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition); |
21 24 | + BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN); |
22 25 | + generatoraccess.getMinecraftWorld().getServer().getPluginManager().callEvent(event); |
23 26 | + |
24 27 | + if (event.isCancelled()) { |
25 28 | + return; |
26 29 | + } |
27 30 | + // CraftBukkit end |
28 31 | this.a(generatoraccess, blockposition1, iblockdata1, EnumDirection.DOWN, fluid1); |
29 32 | if (this.a((IWorldReader) generatoraccess, blockposition) >= 3) { |
30 33 | this.a(generatoraccess, blockposition, fluid, iblockdata); |
31 - | |
34 + | |
32 35 | IBlockData iblockdata1 = generatoraccess.getType(blockposition1); |
33 36 | |
34 37 | if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.c())) { |
35 38 | + // CraftBukkit start |
36 39 | + org.bukkit.block.Block source = CraftBlock.at(generatoraccess, blockposition); |
37 40 | + BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection)); |
38 41 | + generatoraccess.getMinecraftWorld().getServer().getPluginManager().callEvent(event); |
39 42 | + |
40 43 | + if (event.isCancelled()) { |
41 44 | + continue; |
42 45 | + } |
43 46 | + // CraftBukkit end |
44 47 | this.a(generatoraccess, blockposition1, iblockdata1, enumdirection, fluid1); |
45 48 | } |
46 49 | } |
50 + | |
51 + | |
52 + | if (fluid1.e()) { |
53 + | fluid = fluid1; |
54 + | - world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); |
55 + | + // CraftBukkit start |
56 + | + FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(world, blockposition, Blocks.AIR.getBlockData()); |
57 + | + if (event.isCancelled()) { |
58 + | + return; |
59 + | + } |
60 + | + world.setTypeAndData(blockposition, ((CraftBlockData) event.getNewData()).getState(), 3); |
61 + | + // CraftBukkit end |
62 + | } else if (!fluid1.equals(fluid)) { |
63 + | fluid = fluid1; |
64 + | IBlockData iblockdata = fluid1.i(); |
65 + | - |
66 + | - world.setTypeAndData(blockposition, iblockdata, 2); |
67 + | + // CraftBukkit start |
68 + | + FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(world, blockposition, iblockdata); |
69 + | + if (event.isCancelled()) { |
70 + | + return; |
71 + | + } |
72 + | + world.setTypeAndData(blockposition, ((CraftBlockData) event.getNewData()).getState(), 2); |
73 + | + // CraftBukkit end |
74 + | world.getFluidTickList().a(blockposition, fluid1.c(), i); |
75 + | world.applyPhysics(blockposition, iblockdata.getBlock()); |
76 + | } |