package cz.jzitnik.game.handlers.events.handlers.mine;

import cz.jzitnik.game.Game;
import cz.jzitnik.game.annotations.MineEventHandler;
import cz.jzitnik.tui.ScreenRenderer;

public class PlaceOnSolidMineHandler {
    @MineEventHandler
    public void placeOnSolidMineHandler(ScreenRenderer screenRenderer, Game game, int x, int y) {
        var world = game.getWorld();

        if (world[y-1][x].stream().anyMatch(block -> game.getGameStates().dependencies.placeHandler.isPlaceOnSolid(block.getBlockId()))) {
            game.mineInstant(screenRenderer, x, y-1, false);
        }
    }
}
