Files
CatServer/patches/net/minecraft/block/BlockStaticLiquid.java.patch
2019-02-24 22:29:41 +08:00

61 lines
3.3 KiB
Diff

--- ../src-base/minecraft/net/minecraft/block/BlockStaticLiquid.java
+++ ../src-work/minecraft/net/minecraft/block/BlockStaticLiquid.java
@@ -7,6 +7,7 @@
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
public class BlockStaticLiquid extends BlockLiquid
{
@@ -52,22 +53,27 @@
{
blockpos = blockpos.add(rand.nextInt(3) - 1, 1, rand.nextInt(3) - 1);
- if (blockpos.getY() >= 0 && blockpos.getY() < 256 && !worldIn.isBlockLoaded(blockpos))
+ if (blockpos.getY() >= 0 && blockpos.getY() < worldIn.getHeight() && !worldIn.isBlockLoaded(blockpos))
{
return;
}
- Block block = worldIn.getBlockState(blockpos).getBlock();
+ IBlockState block = worldIn.getBlockState(blockpos);
- if (block.blockMaterial == Material.AIR)
+ if (block.getBlock().isAir(block, worldIn, blockpos))
{
if (this.isSurroundingBlockFlammable(worldIn, blockpos))
{
- worldIn.setBlockState(blockpos, Blocks.FIRE.getDefaultState());
+ if (worldIn.getBlockState(blockpos) != Blocks.FIRE) {
+ if (CraftEventFactory.callBlockIgniteEvent(worldIn, blockpos.getX(), blockpos.getY(), blockpos.getZ(), pos.getX(), pos.getY(), pos.getZ()).isCancelled()) {
+ continue;
+ }
+ }
+ worldIn.setBlockState(blockpos, net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(worldIn, blockpos, pos, Blocks.FIRE.getDefaultState()));
return;
}
}
- else if (block.blockMaterial.blocksMovement())
+ else if (block.getMaterial().blocksMovement())
{
return;
}
@@ -86,7 +92,15 @@
if (worldIn.isAirBlock(blockpos1.up()) && this.getCanBlockBurn(worldIn, blockpos1))
{
- worldIn.setBlockState(blockpos1.up(), Blocks.FIRE.getDefaultState());
+ // CraftBukkit start - Prevent lava putting something on fire
+ BlockPos up = blockpos1.up();
+ if (worldIn.getBlockState(up) != Blocks.FIRE) {
+ if (CraftEventFactory.callBlockIgniteEvent(worldIn, up.getX(), up.getY(), up.getZ(), pos.getX(), pos.getY(), pos.getZ()).isCancelled()) {
+ continue;
+ }
+ }
+ // CraftBukkit end
+ worldIn.setBlockState(blockpos1.up(), net.minecraftforge.event.ForgeEventFactory.fireFluidPlaceBlockEvent(worldIn, blockpos1.up(), pos, Blocks.FIRE.getDefaultState()));
}
}
}