// 
// Decompiled by Procyon v0.6.0
// 

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

import com.hypixel.hytale.component.system.ICancellableEcsEvent;
import com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType;
import com.hypixel.hytale.math.vector.Vector3i;
import com.hypixel.hytale.server.core.entity.InteractionContext;
import javax.annotation.Nonnull;
import com.hypixel.hytale.protocol.InteractionType;
import com.hypixel.hytale.component.system.EcsEvent;

public abstract class UseBlockEvent extends EcsEvent
{
    @Nonnull
    private final InteractionType interactionType;
    @Nonnull
    private final InteractionContext context;
    @Nonnull
    private final Vector3i targetBlock;
    @Nonnull
    private final BlockType blockType;
    
    public UseBlockEvent(@Nonnull final InteractionType interactionType, @Nonnull final InteractionContext context, @Nonnull final Vector3i targetBlock, @Nonnull final BlockType blockType) {
        this.interactionType = interactionType;
        this.context = context;
        this.targetBlock = targetBlock;
        this.blockType = blockType;
    }
    
    @Nonnull
    public InteractionType getInteractionType() {
        return this.interactionType;
    }
    
    @Nonnull
    public InteractionContext getContext() {
        return this.context;
    }
    
    @Nonnull
    public Vector3i getTargetBlock() {
        return this.targetBlock;
    }
    
    @Nonnull
    public BlockType getBlockType() {
        return this.blockType;
    }
    
    public static final class Pre extends UseBlockEvent implements ICancellableEcsEvent
    {
        private boolean cancelled;
        
        public Pre(@Nonnull final InteractionType interactionType, @Nonnull final InteractionContext context, @Nonnull final Vector3i targetBlock, @Nonnull final BlockType blockType) {
            super(interactionType, context, targetBlock, blockType);
            this.cancelled = false;
        }
        
        @Override
        public boolean isCancelled() {
            return this.cancelled;
        }
        
        @Override
        public void setCancelled(final boolean cancelled) {
            this.cancelled = cancelled;
        }
    }
    
    public static final class Post extends UseBlockEvent
    {
        public Post(@Nonnull final InteractionType interactionType, @Nonnull final InteractionContext context, @Nonnull final Vector3i targetBlock, @Nonnull final BlockType blockType) {
            super(interactionType, context, targetBlock, blockType);
        }
    }
}
