aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/material/FlowingFluid.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/material/FlowingFluid.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/material/FlowingFluid.java.patch104
1 files changed, 104 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/material/FlowingFluid.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/material/FlowingFluid.java.patch
new file mode 100644
index 0000000000..2ad5f6d0ef
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/material/FlowingFluid.java.patch
@@ -0,0 +1,104 @@
+--- a/net/minecraft/world/level/material/FlowingFluid.java
++++ b/net/minecraft/world/level/material/FlowingFluid.java
+@@ -31,6 +31,14 @@
+ import net.minecraft.world.phys.Vec3;
+ import net.minecraft.world.phys.shapes.Shapes;
+ import net.minecraft.world.phys.shapes.VoxelShape;
++// CraftBukkit start
++import org.bukkit.block.BlockFace;
++import org.bukkit.craftbukkit.block.CraftBlock;
++import org.bukkit.craftbukkit.block.data.CraftBlockData;
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.block.BlockFromToEvent;
++import org.bukkit.event.block.FluidLevelChangeEvent;
++// CraftBukkit end
+
+ public abstract class FlowingFluid extends Fluid {
+
+@@ -134,13 +139,22 @@
+ BlockState blockstate1 = level.getBlockState(blockpos1);
+ FluidState fluidstate1 = this.getNewLiquid(level, blockpos1, blockstate1);
+
+- if (this.canSpreadTo(level, blockpos, blockstate, Direction.DOWN, blockpos1, blockstate1, level.getFluidState(blockpos1), fluidstate1.getType())) {
+- this.spreadTo(level, blockpos1, blockstate1, Direction.DOWN, fluidstate1);
+- if (this.sourceNeighborCount(level, blockpos) >= 3) {
+- this.spreadToSides(level, blockpos, fluidstate, blockstate);
++ if (this.canSpreadTo(level, pos, iblockdata, Direction.DOWN, blockposition1, iblockdata1, level.getFluidState(blockposition1), fluid1.getType())) {
++ // CraftBukkit start
++ org.bukkit.block.Block source = CraftBlock.at(level, pos);
++ BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
++ level.getCraftServer().getPluginManager().callEvent(event);
++
++ if (event.isCancelled()) {
++ return;
+ }
+- } else if (fluidstate.isSource() || !this.isWaterHole(level, fluidstate1.getType(), blockpos, blockstate, blockpos1, blockstate1)) {
+- this.spreadToSides(level, blockpos, fluidstate, blockstate);
++ // CraftBukkit end
++ this.spreadTo(level, blockposition1, iblockdata1, Direction.DOWN, fluid1);
++ if (this.sourceNeighborCount(level, pos) >= 3) {
++ this.spreadToSides(level, pos, state, iblockdata);
++ }
++ } else if (state.isSource() || !this.isWaterHole(level, fluid1.getType(), pos, iblockdata, blockposition1, iblockdata1)) {
++ this.spreadToSides(level, pos, state, iblockdata);
+ }
+
+ }
+@@ -164,8 +178,17 @@
+ BlockPos blockpos1 = blockpos.relative(direction);
+ BlockState blockstate1 = level.getBlockState(blockpos1);
+
+- if (this.canSpreadTo(level, blockpos, blockstate, direction, blockpos1, blockstate1, level.getFluidState(blockpos1), fluidstate1.getType())) {
+- this.spreadTo(level, blockpos1, blockstate1, direction, fluidstate1);
++ if (this.canSpreadTo(level, pos, blockState, enumdirection, blockposition1, iblockdata1, level.getFluidState(blockposition1), fluid1.getType())) {
++ // CraftBukkit start
++ org.bukkit.block.Block source = CraftBlock.at(level, pos);
++ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection));
++ level.getCraftServer().getPluginManager().callEvent(event);
++
++ if (event.isCancelled()) {
++ continue;
++ }
++ // CraftBukkit end
++ this.spreadTo(level, blockposition1, iblockdata1, enumdirection, fluid1);
+ }
+ }
+
+@@ -440,16 +462,27 @@
+ FluidState fluidstate1 = this.getNewLiquid(level, blockpos, level.getBlockState(blockpos));
+ int i = this.getSpreadDelay(level, blockpos, fluidstate, fluidstate1);
+
+- if (fluidstate1.isEmpty()) {
+- fluidstate = fluidstate1;
+- level.setBlock(blockpos, Blocks.AIR.defaultBlockState(), 3);
+- } else if (!fluidstate1.equals(fluidstate)) {
+- fluidstate = fluidstate1;
+- BlockState blockstate = fluidstate1.createLegacyBlock();
+-
+- level.setBlock(blockpos, blockstate, 2);
+- level.scheduleTick(blockpos, fluidstate1.getType(), i);
+- level.updateNeighborsAt(blockpos, blockstate.getBlock());
++ if (fluid1.isEmpty()) {
++ state = fluid1;
++ // CraftBukkit start
++ FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(level, pos, Blocks.AIR.defaultBlockState());
++ if (event.isCancelled()) {
++ return;
++ }
++ level.setBlock(pos, ((CraftBlockData) event.getNewData()).getState(), 3);
++ // CraftBukkit end
++ } else if (!fluid1.equals(state)) {
++ state = fluid1;
++ IBlockData iblockdata = fluid1.createLegacyBlock();
++ // CraftBukkit start
++ FluidLevelChangeEvent event = CraftEventFactory.callFluidLevelChangeEvent(level, pos, iblockdata);
++ if (event.isCancelled()) {
++ return;
++ }
++ level.setBlock(pos, ((CraftBlockData) event.getNewData()).getState(), 2);
++ // CraftBukkit end
++ level.scheduleTick(pos, fluid1.getType(), i);
++ level.updateNeighborsAt(pos, iblockdata.getBlock());
+ }
+ }
+