mirror of
https://github.com/exituser/Brewery.git
synced 2026-09-17 08:59:01 +00:00
Make sure campfire is lit
This commit is contained in:
@@ -35,7 +35,7 @@ public class BCauldron {
|
|||||||
|
|
||||||
public void onUpdate() {
|
public void onUpdate() {
|
||||||
// Check if fire still alive
|
// 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
|
// add a minute to cooking time
|
||||||
state++;
|
state++;
|
||||||
if (someRemoved) {
|
if (someRemoved) {
|
||||||
|
|||||||
@@ -105,8 +105,9 @@ public class LegacyUtil {
|
|||||||
return type.name().endsWith("SIGN") || (!P.use1_13 && type == SIGN_POST);
|
return type.name().endsWith("SIGN") || (!P.use1_13 && type == SIGN_POST);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFireForCauldron(Material type) {
|
public static boolean isFireForCauldron(Block block) {
|
||||||
return type != null && (type == Material.FIRE || type == CAMPFIRE || type == MAGMA_BLOCK || isLava(type));
|
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
|
// 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);
|
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) {
|
public static boolean areStairsInverted(Block block) {
|
||||||
if (!P.use1_13) {
|
if (!P.use1_13) {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class PlayerListener implements Listener {
|
|||||||
|
|
||||||
// Check if fire alive below cauldron when adding ingredients
|
// Check if fire alive below cauldron when adding ingredients
|
||||||
Block down = clickedBlock.getRelative(BlockFace.DOWN);
|
Block down = clickedBlock.getRelative(BlockFace.DOWN);
|
||||||
if (LegacyUtil.isFireForCauldron(down.getType())) {
|
if (LegacyUtil.isFireForCauldron(down)) {
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
boolean handSwap = false;
|
boolean handSwap = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user