Fixed phantom fire blocks being logged adjacent to lava

This commit is contained in:
Intelli 2022-02-25 16:14:35 -07:00
parent 900cad643f
commit 42233f1f72

View File

@ -4,6 +4,7 @@ import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.Lightable;
@ -77,6 +78,52 @@ public final class BlockIgniteListener extends ProjectileLaunchListener implemen
}
}
if (blockIgnited == Material.FIRE && event.getCause() == IgniteCause.LAVA && event.getIgnitingBlock() != null) {
boolean burnableBlock = false;
for (BlockFace face : BlockFace.values()) {
Location blockLocation = block.getLocation();
scanLocation.setX(blockLocation.getX());
scanLocation.setY(blockLocation.getY());
scanLocation.setZ(blockLocation.getZ());
switch (face) {
case NORTH:
scanLocation.setZ(scanLocation.getZ() - 1);
break;
case SOUTH:
scanLocation.setZ(scanLocation.getZ() + 1);
break;
case WEST:
scanLocation.setX(scanLocation.getX() - 1);
break;
case EAST:
scanLocation.setX(scanLocation.getX() + 1);
break;
case DOWN:
scanLocation.setY(scanLocation.getY() - 1);
break;
case UP:
scanLocation.setY(scanLocation.getY() + 1);
break;
default:
continue;
}
if (scanLocation.getY() < BukkitAdapter.ADAPTER.getMinHeight(world) || scanLocation.getY() >= world.getMaxHeight()) {
continue;
}
if (scanLocation.getBlock().getType().isBurnable()) {
burnableBlock = true;
break;
}
}
if (!burnableBlock) {
return;
}
}
Queue.queueBlockPlace("#fire", block.getState(), block.getType(), replacedBlock, blockIgnited, -1, 0, forceBlockData.getAsString());
}
else {