Make sure campfire is lit

This commit is contained in:
Sn0wStorm 2019-08-18 20:41:52 +02:00
parent ee024261bc
commit 86f2cd7546
3 changed files with 15 additions and 4 deletions

View File

@ -35,7 +35,7 @@ public class BCauldron {
public void onUpdate() {
// Check if fire still alive
if (!Util.isChunkLoaded(block) || LegacyUtil.isFireForCauldron(block.getRelative(BlockFace.DOWN).getType())) {
if (!Util.isChunkLoaded(block) || LegacyUtil.isFireForCauldron(block.getRelative(BlockFace.DOWN))) {
// add a minute to cooking time
state++;
if (someRemoved) {

View File

@ -105,8 +105,9 @@ public class LegacyUtil {
return type.name().endsWith("SIGN") || (!P.use1_13 && type == SIGN_POST);
}
public static boolean isFireForCauldron(Material type) {
return type != null && (type == Material.FIRE || type == CAMPFIRE || type == MAGMA_BLOCK || isLava(type));
public static boolean isFireForCauldron(Block block) {
Material type = block.getType();
return type != null && (type == Material.FIRE || type == MAGMA_BLOCK || litCampfire(block) || isLava(type));
}
// LAVA and STATIONARY_LAVA are merged as of 1.13
@ -114,6 +115,16 @@ public class LegacyUtil {
return type == Material.LAVA || (!P.use1_13 && type == STATIONARY_LAVA);
}
public static boolean litCampfire(Block block) {
if (block.getType() == CAMPFIRE) {
BlockData data = block.getBlockData();
if (data instanceof org.bukkit.block.data.Lightable) {
return ((org.bukkit.block.data.Lightable) data).isLit();
}
}
return false;
}
public static boolean areStairsInverted(Block block) {
if (!P.use1_13) {
@SuppressWarnings("deprecation")

View File

@ -80,7 +80,7 @@ public class PlayerListener implements Listener {
// Check if fire alive below cauldron when adding ingredients
Block down = clickedBlock.getRelative(BlockFace.DOWN);
if (LegacyUtil.isFireForCauldron(down.getType())) {
if (LegacyUtil.isFireForCauldron(down)) {
event.setCancelled(true);
boolean handSwap = false;