package com.hypixel.hytale.server.core.event.events.ecs;

import com.hypixel.hytale.component.system.CancellableEcsEvent;
import com.hypixel.hytale.math.vector.Vector3i;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;

import javax.annotation.Nonnull;

/**
 * Event fired when a player attempts to gather (harvest) a block.
 * This event is cancellable - if cancelled, the block will not be gathered.
 */
public class GatherBlockEvent extends CancellableEcsEvent {
    @Nonnull
    private final Vector3i targetBlock;
    @Nonnull
    private final BlockType blockType;

    public GatherBlockEvent(@Nonnull Vector3i targetBlock, @Nonnull BlockType blockType) {
        this.targetBlock = targetBlock;
        this.blockType = blockType;
    }

    @Nonnull
    public Vector3i getTargetBlock() {
        return this.targetBlock;
    }

    @Nonnull
    public BlockType getBlockType() {
        return this.blockType;
    }
}
