package cz.jzitnik.game.mobs.services.cow;

import lombok.Getter;
import lombok.Setter;

import cz.jzitnik.game.Game;
import cz.jzitnik.game.annotations.RightClickLogic;
import cz.jzitnik.game.entities.items.ItemBlockSupplier;
import cz.jzitnik.game.handlers.rightclick.RightClickHandler;
import cz.jzitnik.tui.ScreenRenderer;

@Getter
@Setter
@RightClickLogic
public class CowData implements RightClickHandler {
    private int lastDirection = 1; // 1 = right, -1 = left
    private int movementCooldown = 0;
    private int jumpAttempts = 0;

	@Override
	public void onBlockRightClick(int x, int y, Game game, ScreenRenderer screenRenderer) {
        var inv = game.getInventory();
        var inHand = inv.getItemInHand();

        if (inHand.isEmpty() || !inHand.get().getId().equals("bucket")) {
            return;
        }

        inv.decreaseItemInHand();
        inv.addItem(ItemBlockSupplier.getItem("milk_bucket"));
	}
}
