1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

Update MiningTask.java

This commit is contained in:
FN-FAL113 2022-08-05 09:07:40 +08:00 committed by GitHub
parent 25ced40d33
commit 36c7fc7726
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -143,6 +143,7 @@ class MiningTask implements Runnable {
if (fuelLevel <= 0) { if (fuelLevel <= 0) {
// This Miner has not enough fuel. // This Miner has not enough fuel.
stop(MinerStoppingReason.NO_FUEL); stop(MinerStoppingReason.NO_FUEL);
return;
} }
}); });
@ -197,7 +198,7 @@ class MiningTask implements Runnable {
return; return;
} }
if (miner.canMine(b.getType()) && push(miner.getOutcome(b.getType()))) { if (miner.canMine(b) && push(miner.getOutcome(b.getType()))) {
furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, b.getType()); furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, b.getType());
furnace.getWorld().playSound(furnace.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.2F, 1F); furnace.getWorld().playSound(furnace.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.2F, 1F);
@ -267,8 +268,8 @@ class MiningTask implements Runnable {
if (chest.getType() == Material.CHEST) { if (chest.getType() == Material.CHEST) {
BlockState state = PaperLib.getBlockState(chest, false).getState(); BlockState state = PaperLib.getBlockState(chest, false).getState();
if (state instanceof Chest chestState) { if (state instanceof Chest) {
Inventory inv = chestState.getBlockInventory(); Inventory inv = ((Chest) state).getBlockInventory();
if (InvUtils.fits(inv, item)) { if (InvUtils.fits(inv, item)) {
inv.addItem(item); inv.addItem(item);
@ -298,8 +299,8 @@ class MiningTask implements Runnable {
if (chest.getType() == Material.CHEST) { if (chest.getType() == Material.CHEST) {
BlockState state = PaperLib.getBlockState(chest, false).getState(); BlockState state = PaperLib.getBlockState(chest, false).getState();
if (state instanceof Chest chestState) { if (state instanceof Chest) {
Inventory inv = chestState.getBlockInventory(); Inventory inv = ((Chest) state).getBlockInventory();
this.fuelLevel = grabFuelFrom(inv); this.fuelLevel = grabFuelFrom(inv);
} }
} }