forked from jzitnik/twodcraft
fix: Build
This commit is contained in:
parent
15c5e7fea0
commit
369164c767
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user