mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-15 04:05:50 -07:00
Port to new mc-dev format.
This commit is contained in:
@@ -1,64 +1,66 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
// CraftBukkit start
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
|
||||
import org.bukkit.craftbukkit.CraftWorld;
|
||||
import java.util.Random;
|
||||
// CraftBukkit end
|
||||
|
||||
public class BlockStationary extends BlockFluids {
|
||||
|
||||
protected BlockStationary(int k, Material material) {
|
||||
super(k, material);
|
||||
a(false);
|
||||
if (material == Material.g) {
|
||||
a(true);
|
||||
protected BlockStationary(int i, Material material) {
|
||||
super(i, material);
|
||||
this.a(false);
|
||||
if (material == Material.LAVA) {
|
||||
this.a(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void b(World world, int k, int l, int i1, int j1) {
|
||||
super.b(world, k, l, i1, j1);
|
||||
if (world.a(k, l, i1) == bi) {
|
||||
i(world, k, l, i1);
|
||||
public void b(World world, int i, int j, int k, int l) {
|
||||
super.b(world, i, j, k, l);
|
||||
if (world.getTypeId(i, j, k) == this.id) {
|
||||
this.i(world, i, j, k);
|
||||
}
|
||||
}
|
||||
|
||||
private void i(World world, int k, int l, int i1) {
|
||||
int j1 = world.b(k, l, i1);
|
||||
private void i(World world, int i, int j, int k) {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
world.i = true;
|
||||
world.a(k, l, i1, bi - 1, j1);
|
||||
world.b(k, l, i1, k, l, i1);
|
||||
world.i(k, l, i1, bi - 1);
|
||||
world.setTypeIdAndData(i, j, k, this.id - 1, l);
|
||||
world.b(i, j, k, i, j, k);
|
||||
world.i(i, j, k, this.id - 1);
|
||||
world.i = false;
|
||||
}
|
||||
|
||||
public void a(World world, int k, int l, int i1, Random random) {
|
||||
if (bt == Material.g) {
|
||||
int j1 = random.nextInt(3);
|
||||
public void a(World world, int i, int j, int k, Random random) {
|
||||
if (this.material == Material.LAVA) {
|
||||
int l = random.nextInt(3);
|
||||
|
||||
for (int k1 = 0; k1 < j1; k1++) {
|
||||
// CraftBukkit start: prevent lava putting something on fire.
|
||||
Server server = ((WorldServer)world).getServer();
|
||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||
Player thePlayer = null;
|
||||
// CraftBukkit end
|
||||
|
||||
for (int i1 = 0; i1 < l; ++i1) {
|
||||
i += random.nextInt(3) - 1;
|
||||
++j;
|
||||
k += random.nextInt(3) - 1;
|
||||
l++;
|
||||
i1 += random.nextInt(3) - 1;
|
||||
int l1 = world.a(k, l, i1);
|
||||
int j1 = world.getTypeId(i, j, k);
|
||||
|
||||
if (l1 == 0) {
|
||||
// this checks if an adjacent block is flammable before lighting this block.
|
||||
// perhaps we can reduce spam by checking this earlier.
|
||||
if (j(world, k - 1, l, i1) || j(world, k + 1, l, i1) || j(world, k, l, i1 - 1) || j(world, k, l, i1 + 1) || j(world, k, l - 1, i1) || j(world, k, l + 1, i1)) {
|
||||
if (j1 == 0) {
|
||||
if (this.j(world, i - 1, j, k) || this.j(world, i + 1, j, k) || this.j(world, i, j, k - 1) || this.j(world, i, j, k + 1) || this.j(world, i, j - 1, k) || this.j(world, i, j + 1, k)) {
|
||||
// CraftBukkit start: prevent lava putting something on fire.
|
||||
Server server = ((WorldServer)world).getServer();
|
||||
CraftWorld cworld = ((WorldServer)world).getWorld();
|
||||
|
||||
org.bukkit.block.Block theBlock = cworld.getBlockAt(k, l, i1);
|
||||
IgniteCause igniteCause = BlockIgniteEvent.IgniteCause.LAVA;
|
||||
Player thePlayer = null;
|
||||
|
||||
if (theBlock.getTypeId() != Block.ar.bi){
|
||||
|
||||
if (theBlock.getTypeId() != Block.FIRE.id){
|
||||
BlockIgniteEvent event = new BlockIgniteEvent(theBlock, igniteCause, thePlayer);
|
||||
server.getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
@@ -66,19 +68,18 @@ public class BlockStationary extends BlockFluids {
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
world.e(k, l, i1, Block.ar.bi);
|
||||
|
||||
world.e(i, j, k, Block.FIRE.id);
|
||||
return;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (Block.m[l1].bt.c()) {
|
||||
} else if (Block.byId[j1].material.isSolid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean j(World world, int k, int l, int i1) {
|
||||
return world.c(k, l, i1).e();
|
||||
private boolean j(World world, int i, int j, int k) {
|
||||
return world.getMaterial(i, j, k).isBurnable();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user