This commit is contained in:
@ -41,9 +41,9 @@ public class DrillBase implements Drill {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleBlock(Block initialBlock, List<BlockPos> history, BlockPos pos, int brokenBlocks) {
|
private void handleBlock(Block initialBlock, List<BlockPos> history, BlockPos pos, int brokenBlocks) {
|
||||||
if(brokenBlocks < getConfig().maxVeinSize) {
|
if (brokenBlocks < getConfig().maxVeinSize) {
|
||||||
history.add(pos);
|
history.add(pos);
|
||||||
if(tryBreakBlock(pos)) {
|
if (tryBreakBlock(pos)) {
|
||||||
brokenBlocks++;
|
brokenBlocks++;
|
||||||
int finalBrokenBlocks = brokenBlocks;
|
int finalBrokenBlocks = brokenBlocks;
|
||||||
|
|
||||||
@ -58,12 +58,12 @@ public class DrillBase implements Drill {
|
|||||||
});
|
});
|
||||||
|
|
||||||
long delay = getConfig().veinAnimationTicks;
|
long delay = getConfig().veinAnimationTicks;
|
||||||
if(delay <= 0)
|
if (delay <= 0)
|
||||||
for(BlockPos newPos : toBreak)
|
for (BlockPos newPos : toBreak)
|
||||||
handleBlock(initialBlock, history, newPos, finalBrokenBlocks);
|
handleBlock(initialBlock, history, newPos, finalBrokenBlocks);
|
||||||
else {
|
else {
|
||||||
Scheduler.get().scheduleTask(() -> {
|
Scheduler.get().scheduleTask(() -> {
|
||||||
for(BlockPos newPos : toBreak)
|
for (BlockPos newPos : toBreak)
|
||||||
handleBlock(initialBlock, history, newPos, finalBrokenBlocks);
|
handleBlock(initialBlock, history, newPos, finalBrokenBlocks);
|
||||||
}, delay);
|
}, delay);
|
||||||
}
|
}
|
||||||
|
@ -35,14 +35,12 @@ public abstract class BlockMixin {
|
|||||||
Block seedBlock = state.getBlock();
|
Block seedBlock = state.getBlock();
|
||||||
List<ItemStack> drops = Block.getDroppedStacks(state, (ServerWorld) world, pos, null, player, mainHand);
|
List<ItemStack> drops = Block.getDroppedStacks(state, (ServerWorld) world, pos, null, player, mainHand);
|
||||||
if (removeIfAvailable(drops, seedItem)) {
|
if (removeIfAvailable(drops, seedItem)) {
|
||||||
if(player.getGameMode() != GameMode.CREATIVE) {
|
if (player.getGameMode() != GameMode.CREATIVE) {
|
||||||
for (ItemStack drop : drops) {
|
for (ItemStack drop : drops) {
|
||||||
Block.dropStack(world, pos, drop);
|
Block.dropStack(world, pos, drop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
world.getServer().executeSync(() -> {
|
world.getServer().executeSync(() -> world.setBlockState(pos, seedBlock.getDefaultState()));
|
||||||
world.setBlockState(pos, seedBlock.getDefaultState());
|
|
||||||
});
|
|
||||||
player.incrementStat(Stats.USED.getOrCreateStat(seedItem));
|
player.incrementStat(Stats.USED.getOrCreateStat(seedItem));
|
||||||
cir.cancel();
|
cir.cancel();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user