2015-03-22 17:38:04 +00:00
|
|
|
--- ../src-base/minecraft/net/minecraft/block/BlockFire.java
|
|
|
|
+++ ../src-work/minecraft/net/minecraft/block/BlockFire.java
|
|
|
|
@@ -17,6 +17,11 @@
|
|
|
|
import net.minecraft.world.WorldProviderEnd;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
import static net.minecraftforge.common.util.ForgeDirection.*;
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
|
|
+import org.bukkit.event.block.BlockBurnEvent;
|
|
|
|
+import org.bukkit.event.block.BlockSpreadEvent;
|
|
|
|
+// CraftBukkit end
|
|
|
|
|
|
|
|
public class BlockFire extends Block
|
|
|
|
{
|
|
|
|
@@ -105,12 +110,12 @@
|
|
|
|
|
|
|
|
if (!this.canPlaceBlockAt(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_))
|
|
|
|
{
|
|
|
|
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
|
|
|
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - invalid place location
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!flag && p_149674_1_.isRaining() && (p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ - 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_ + 1, p_149674_3_, p_149674_4_) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ - 1) || p_149674_1_.canLightningStrikeAt(p_149674_2_, p_149674_3_, p_149674_4_ + 1)))
|
|
|
|
{
|
|
|
|
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
|
|
|
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - extinguished by rain
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@@ -127,12 +132,12 @@
|
|
|
|
{
|
|
|
|
if (!World.doesBlockHaveSolidTopSurface(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_) || l > 3)
|
|
|
|
{
|
|
|
|
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
|
|
|
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - burn out of inflammable block
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!flag && !this.canCatchFire(p_149674_1_, p_149674_2_, p_149674_3_ - 1, p_149674_4_, UP) && l == 15 && p_149674_5_.nextInt(4) == 0)
|
|
|
|
{
|
|
|
|
- p_149674_1_.setBlockToAir(p_149674_2_, p_149674_3_, p_149674_4_);
|
|
|
|
+ fireExtinguished(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_); // CraftBukkit - burn out
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@@ -186,7 +191,29 @@
|
|
|
|
k2 = 15;
|
|
|
|
}
|
|
|
|
|
|
|
|
- p_149674_1_.setBlock(i1, k1, j1, this, k2, 3);
|
|
|
|
+ // CraftBukkit start - Call to stop spread of fire
|
|
|
|
+ if (p_149674_1_.getBlock(i1, k1, j1) != Blocks.fire)
|
|
|
|
+ {
|
|
|
|
+ if (CraftEventFactory.callBlockIgniteEvent(p_149674_1_, i1, k1, j1, p_149674_2_, p_149674_3_, p_149674_4_).isCancelled())
|
|
|
|
+ {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ org.bukkit.Server server = p_149674_1_.getServer();
|
|
|
|
+ org.bukkit.World bworld = p_149674_1_.getWorld();
|
|
|
|
+ org.bukkit.block.BlockState blockState = bworld.getBlockAt(i1, k1, j1).getState();
|
|
|
|
+ blockState.setTypeId(Block.getIdFromBlock(this));
|
|
|
|
+ blockState.setData(new org.bukkit.material.MaterialData(Block.getIdFromBlock(this), (byte) k2));
|
|
|
|
+ BlockSpreadEvent spreadEvent = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(p_149674_2_, p_149674_3_, p_149674_4_), blockState);
|
|
|
|
+ server.getPluginManager().callEvent(spreadEvent);
|
|
|
|
+
|
|
|
|
+ if (!spreadEvent.isCancelled())
|
|
|
|
+ {
|
|
|
|
+ blockState.update(true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -216,7 +243,18 @@
|
|
|
|
if (p_149841_6_.nextInt(p_149841_5_) < j1)
|
|
|
|
{
|
|
|
|
boolean flag = p_149841_1_.getBlock(p_149841_2_, p_149841_3_, p_149841_4_) == Blocks.tnt;
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ org.bukkit.block.Block theBlock = p_149841_1_.getWorld().getBlockAt(p_149841_2_, p_149841_3_, p_149841_4_);
|
|
|
|
+ BlockBurnEvent event = new BlockBurnEvent(theBlock);
|
|
|
|
+ p_149841_1_.getServer().getPluginManager().callEvent(event);
|
|
|
|
|
|
|
|
+ if (event.isCancelled())
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
|
|
|
if (p_149841_6_.nextInt(p_149841_7_ + 10) < 5 && !p_149841_1_.canLightningStrikeAt(p_149841_2_, p_149841_3_, p_149841_4_))
|
|
|
|
{
|
|
|
|
int k1 = p_149841_7_ + p_149841_6_.nextInt(5) / 4;
|
2015-06-27 17:29:43 +00:00
|
|
|
@@ -297,17 +335,17 @@
|
2015-03-22 17:38:04 +00:00
|
|
|
{
|
|
|
|
if (!World.doesBlockHaveSolidTopSurface(p_149695_1_, p_149695_2_, p_149695_3_ - 1, p_149695_4_) && !this.canNeighborBurn(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_))
|
|
|
|
{
|
|
|
|
- p_149695_1_.setBlockToAir(p_149695_2_, p_149695_3_, p_149695_4_);
|
|
|
|
+ fireExtinguished(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_); // CraftBukkit - fuel block gone
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-27 17:29:43 +00:00
|
|
|
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
|
|
|
|
{
|
|
|
|
- if (p_149726_1_.provider.dimensionId > 0 || !Blocks.portal.func_150000_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_))
|
|
|
|
+ if (!net.minecraft.server.MinecraftServer.kcauldronConfig.commonAllowNetherPortal.getValue() && p_149726_1_.provider.dimensionId > 0 || !Blocks.portal.func_150000_e(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_))
|
2015-03-22 17:38:04 +00:00
|
|
|
{
|
|
|
|
if (!World.doesBlockHaveSolidTopSurface(p_149726_1_, p_149726_2_, p_149726_3_ - 1, p_149726_4_) && !this.canNeighborBurn(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_))
|
|
|
|
{
|
|
|
|
- p_149726_1_.setBlockToAir(p_149726_2_, p_149726_3_, p_149726_4_);
|
|
|
|
+ fireExtinguished(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); // CraftBukkit - fuel block broke
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
@@ -398,6 +436,16 @@
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ private void fireExtinguished(World world, int x, int y, int z)
|
|
|
|
+ {
|
|
|
|
+ if (!CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), Blocks.air).isCancelled())
|
|
|
|
+ {
|
|
|
|
+ world.setBlockToAir(x, y, z);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public void registerBlockIcons(IIconRegister p_149651_1_)
|
|
|
|
{
|