Files
CatServer/patches/net/minecraft/block/BlockDynamicLiquid.java.patch

66 lines
2.5 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockDynamicLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockDynamicLiquid.java
@@ -3,6 +3,9 @@
import java.util.EnumSet;
import java.util.Random;
import java.util.Set;
+
+import org.bukkit.event.block.BlockFromToEvent;
+
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
@@ -26,6 +29,11 @@
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
+ // CraftBukkit start
+ org.bukkit.World bworld = worldIn.getWorld();
+ org.bukkit.Server server = worldIn.getServer();
+ org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ());
+ // CraftBukkit end
int i = ((Integer)state.getValue(LEVEL)).intValue();
int j = 1;
@@ -116,6 +124,13 @@
if (this.canFlowInto(worldIn, pos.down(), iblockstate1))
{
+ // CraftBukkit start - Send "down" to the server
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.block.BlockFace.DOWN);
+ if (server != null) {
+ server.getPluginManager().callEvent(event);
+ }
+
+ if (!event.isCancelled()) {
if (this.blockMaterial == Material.LAVA && worldIn.getBlockState(pos.down()).getMaterial() == Material.WATER)
{
worldIn.setBlockState(pos.down(), Blocks.STONE.getDefaultState());
@@ -131,6 +146,8 @@
{
this.tryFlowInto(worldIn, pos.down(), iblockstate1, i + 8);
}
+ }
+ // CraftBukkit end
}
else if (i >= 0 && (i == 0 || this.isBlocked(worldIn, pos.down(), iblockstate1)))
{
@@ -149,7 +166,16 @@
for (EnumFacing enumfacing1 : set)
{
- this.tryFlowInto(worldIn, pos.offset(enumfacing1), worldIn.getBlockState(pos.offset(enumfacing1)), k1);
+ // CraftBukkit start
+ BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumfacing1));
+ if (server != null) {
+ server.getPluginManager().callEvent(event);
+ }
+
+ if (!event.isCancelled()) {
+ this.tryFlowInto(worldIn, pos.offset(enumfacing1), worldIn.getBlockState(pos.offset(enumfacing1)), k1);
+ }
+ // CraftBukkit end
}
}
}