package com.leisuretimedock.blasttravelreborn.api.events;

import com.leisuretimedock.blasttravelreborn.util.PlayerEntityDuck;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.event.IModBusEvent;

public class PlayerCannonFlightTickEvent extends Event implements IModBusEvent {

    private final Entity player;
    private final Vec3 velocity;
    private final Vec3 pos;
    private final long flightTick;

    public PlayerCannonFlightTickEvent(Entity player, Vec3 velocity, Vec3 pos, long flightTick) {
        this.player = player;
        this.velocity = velocity;
        this.pos = pos;
        this.flightTick = flightTick;
    }
    public void cancelFlightState() {
        if(player instanceof PlayerEntityDuck playerDuck) {
            playerDuck.blasttravel$setCannonFlight(false);
        }
    }

    public Vec3 getVelocity() {
        return velocity;
    }

    public Vec3 getPos() {
        return pos;
    }

    public Entity getPlayer() {
        return player;
    }

    public long getFlightTick() {
        return flightTick;
    }
}
