mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-25 10:27:55 +01:00
Fix to slow fire spread hook, to check if a block is on fire before
trying to set it on fire.
This commit is contained in:
parent
e99980983d
commit
3143e503fe
@ -1,6 +1,9 @@
|
|||||||
package net.minecraft.server;
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
import org.bukkit.event.block.BlockIgniteEvent;
|
||||||
|
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -83,15 +86,22 @@ public class BlockFire extends Block {
|
|||||||
}
|
}
|
||||||
int i2 = h(world, i1, k1, j1);
|
int i2 = h(world, i1, k1, j1);
|
||||||
|
|
||||||
// CraftBukkit: Call to stop spead of fire.
|
//CraftBukkit start: Call to stop spead of fire.
|
||||||
CraftServer server = ((WorldServer)world).getServer();
|
Server server = ((WorldServer)world).getServer();
|
||||||
CraftWorld cworld = ((WorldServer) world).getWorld();
|
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||||
org.bukkit.block.Block bblock = (cworld.getBlockAt(i1, k1, j1));
|
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent((org.bukkit.block.Block) bblock, BlockIgniteEvent.IgniteCause.SPREAD, null);
|
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k));
|
||||||
server.getPluginManager().callEvent(event);
|
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||||
if (event.isCancelled()) {
|
Player thePlayer = null;
|
||||||
return;
|
|
||||||
|
if (theBlock.getTypeId() != Block.ar.bi){
|
||||||
|
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//CraftBukkit end
|
||||||
if (i2 > 0 && random.nextInt(l1) <= i2) {
|
if (i2 > 0 && random.nextInt(l1) <= i2) {
|
||||||
world.e(i1, k1, j1, bi);
|
world.e(i1, k1, j1, bi);
|
||||||
}
|
}
|
||||||
@ -108,15 +118,22 @@ public class BlockFire extends Block {
|
|||||||
boolean flag = world.a(i, j, k) == Block.am.bi;
|
boolean flag = world.a(i, j, k) == Block.am.bi;
|
||||||
|
|
||||||
if (random.nextInt(2) == 0) {
|
if (random.nextInt(2) == 0) {
|
||||||
// CraftBukkit: Call to stop very slow spread of fire.
|
// CraftBukkit start: Call to stop very slow spread of fire.
|
||||||
CraftServer server = ((WorldServer)world).getServer();
|
Server server = ((WorldServer)world).getServer();
|
||||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||||
org.bukkit.block.Block sbblock = (cworld.getBlockAt(i, j, k));
|
|
||||||
BlockIgniteEvent event = new BlockIgniteEvent((org.bukkit.block.Block) sbblock, BlockIgniteEvent.IgniteCause.SLOW_SPREAD, null);
|
org.bukkit.block.Block theBlock = (cworld.getBlockAt(i, j, k));
|
||||||
server.getPluginManager().callEvent(event);
|
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SLOW_SPREAD;
|
||||||
if (event.isCancelled()) {
|
Player thePlayer = null;
|
||||||
return;
|
|
||||||
|
if (theBlock.getTypeId() != Block.ar.bi){
|
||||||
|
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||||
|
server.getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//CraftBukkit end
|
||||||
world.e(i, j, k, bi);
|
world.e(i, j, k, bi);
|
||||||
} else {
|
} else {
|
||||||
world.e(i, j, k, 0);
|
world.e(i, j, k, 0);
|
||||||
@ -194,6 +211,7 @@ public class BlockFire extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void e(World world, int i, int j, int k) {
|
public void e(World world, int i, int j, int k) {
|
||||||
|
//TODO this section deals with lighting a block on fire too
|
||||||
if (world.a(i, j - 1, k) == Block.ap.bi && Block.be.b_(world, i, j, k)) {
|
if (world.a(i, j - 1, k) == Block.ap.bi && Block.be.b_(world, i, j, k)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user