mirror of
https://github.com/DieReicheErethons/Brewery.git
synced 2024-11-15 10:25:15 +01:00
Make sure campfire is lit
This commit is contained in:
parent
ee024261bc
commit
86f2cd7546
@ -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) {
|
||||
|
@ -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")
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user