mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Fix some of the reported blocks not working (#3848)
This commit is contained in:
parent
b04cfcc169
commit
aebab92e61
@ -475,6 +475,14 @@ public class SlimefunItem implements Placeable {
|
||||
// Now we can be certain this item should be enabled
|
||||
if (state == ItemState.ENABLED) {
|
||||
onEnable();
|
||||
} else {
|
||||
// Clear item handlers if we are disabled so that calling them isn't possible later on
|
||||
for (ItemHandler handler : this.itemhandlers.values()) {
|
||||
if (handler instanceof BlockTicker) {
|
||||
Slimefun.getRegistry().getTickerBlocks().remove(getId());
|
||||
}
|
||||
}
|
||||
this.itemhandlers.clear();
|
||||
}
|
||||
|
||||
// Lock the SlimefunItemStack from any accidental manipulations
|
||||
|
@ -57,7 +57,8 @@ public class AutoCrafterListener implements Listener {
|
||||
|
||||
SlimefunItem block = slimefunBlock.get();
|
||||
|
||||
if (block instanceof AbstractAutoCrafter crafter) {
|
||||
// Fixes #2957
|
||||
if (block instanceof AbstractAutoCrafter crafter && crafter.canUse(e.getPlayer(), true)) {
|
||||
Optional<SlimefunItem> slimefunItem = e.getSlimefunItem();
|
||||
|
||||
if (!e.getPlayer().isSneaking() && slimefunItem.isPresent() && slimefunItem.get() instanceof Multimeter) {
|
||||
|
@ -42,7 +42,8 @@ public class DispenserListener implements Listener {
|
||||
if (b.getType() == Material.DISPENSER && b.getRelative(BlockFace.DOWN).getType() != Material.HOPPER) {
|
||||
SlimefunItem machine = BlockStorage.check(b);
|
||||
|
||||
if (machine != null) {
|
||||
// Fixes #2959
|
||||
if (machine != null && !machine.isDisabledIn(e.getBlock().getWorld())) {
|
||||
machine.callItemHandler(BlockDispenseHandler.class, handler -> {
|
||||
BlockState state = PaperLib.getBlockState(b, false).getState();
|
||||
|
||||
|
@ -47,7 +47,11 @@ public class EnhancedFurnaceListener implements Listener {
|
||||
|
||||
SlimefunItem furnace = BlockStorage.check(e.getBlock());
|
||||
|
||||
if (furnace instanceof EnhancedFurnace enhancedFurnace && enhancedFurnace.getFuelEfficiency() > 0) {
|
||||
// Fixes #2958
|
||||
if (furnace instanceof EnhancedFurnace enhancedFurnace
|
||||
&& !enhancedFurnace.isDisabledIn(e.getBlock().getWorld())
|
||||
&& enhancedFurnace.getFuelEfficiency() > 0
|
||||
) {
|
||||
int burnTime = e.getBurnTime();
|
||||
int newBurnTime = enhancedFurnace.getFuelEfficiency() * burnTime;
|
||||
|
||||
@ -64,7 +68,7 @@ public class EnhancedFurnaceListener implements Listener {
|
||||
|
||||
SlimefunItem sfItem = BlockStorage.check(e.getBlock());
|
||||
|
||||
if (sfItem instanceof EnhancedFurnace enhancedFurnace) {
|
||||
if (sfItem instanceof EnhancedFurnace enhancedFurnace && !enhancedFurnace.isDisabledIn(e.getBlock().getWorld())) {
|
||||
BlockState state = PaperLib.getBlockState(e.getBlock(), false).getState();
|
||||
|
||||
if (state instanceof Furnace furnace) {
|
||||
|
@ -719,7 +719,12 @@ public class BlockStorage {
|
||||
if (updateTicker) {
|
||||
SlimefunItem item = SlimefunItem.getById(key);
|
||||
|
||||
if (item != null && item.isTicking() && value != null) {
|
||||
if (item != null
|
||||
&& value != null
|
||||
&& l.getWorld() != null
|
||||
&& item.isTicking()
|
||||
&& !item.isDisabledIn(l.getWorld())
|
||||
) {
|
||||
Slimefun.getTickerTask().enableTicker(l);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user