mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-02 04:56:50 +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 changed files with 33 additions and 15 deletions
|
@ -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));
|
||||||
|
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SPREAD;
|
||||||
|
Player thePlayer = null;
|
||||||
|
|
||||||
|
if (theBlock.getTypeId() != Block.ar.bi){
|
||||||
|
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
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));
|
||||||
|
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.SLOW_SPREAD;
|
||||||
|
Player thePlayer = null;
|
||||||
|
|
||||||
|
if (theBlock.getTypeId() != Block.ar.bi){
|
||||||
|
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||||
server.getPluginManager().callEvent(event);
|
server.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
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 a new issue