fix: Build

This commit is contained in:
Jakub Žitník 2025-02-24 21:05:32 +01:00
parent 15c5e7fea0
commit 369164c767
Signed by: jzitnik
GPG Key ID: C577A802A6AF4EF3
2 changed files with 7 additions and 7 deletions

View File

@ -48,13 +48,13 @@ public class Block {
this.spriteState = Optional.of(spriteState);
}
public int calculateHardness(Inventory inventory) {
int holdingDecrease = 0;
public double calculateHardness(Inventory inventory) {
double holdingDecrease = 0;
if (inventory.getItemInHand().isPresent() && tool.isPresent() && inventory.getItemInHand().get().getType().equals(tool.get())) {
holdingDecrease = inventory.getItemInHand().get().getMiningDecrease();
}
int decrease = hardness - holdingDecrease;
double decrease = hardness - holdingDecrease;
if (decrease < 0) {
decrease = 0;

View File

@ -118,13 +118,13 @@ public class Game {
world[y][x].add(breakingBlock);
screenRenderer.render(this);
int hardness = world[y][x].stream().filter(block -> !block.isGhost()).toList().get(0).calculateHardness(inventory);
double hardness = world[y][x].stream().filter(block -> !block.isGhost()).toList().get(0).calculateHardness(inventory);
this.mining = true;
new Thread(() -> {
try {
Thread.sleep(hardness * 166L);
Thread.sleep((long) (hardness * 166));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@ -132,7 +132,7 @@ public class Game {
screenRenderer.render(this);
try {
Thread.sleep(hardness * 166L);
Thread.sleep((long) (hardness * 166));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
@ -140,7 +140,7 @@ public class Game {
screenRenderer.render(this);
try {
Thread.sleep(hardness * 166L);
Thread.sleep((long) (hardness * 166));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}