package net.minecraft.world.entity.vehicle;

import net.minecraft.world.entity.Entity;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.EntityType;

public class Minecart extends AbstractMinecart {
    public Minecart(final EntityType<?> aoq, final Level bqb) {
        super(aoq, bqb);
    }
    
    public Minecart(final Level bqb, final double double2, final double double3, final double double4) {
        super(EntityType.MINECART, bqb, double2, double3, double4);
    }
    
    @Override
    public InteractionResult interact(final Player bec, final InteractionHand anf) {
        if (bec.isSecondaryUseActive()) {
            return InteractionResult.PASS;
        }
        if (this.isVehicle()) {
            return InteractionResult.PASS;
        }
        if (!this.level.isClientSide) {
            return bec.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS;
        }
        return InteractionResult.SUCCESS;
    }
    
    @Override
    public void activateMinecart(final int integer1, final int integer2, final int integer3, final boolean boolean4) {
        if (boolean4) {
            if (this.isVehicle()) {
                this.ejectPassengers();
            }
            if (this.getHurtTime() == 0) {
                this.setHurtDir(-this.getHurtDir());
                this.setHurtTime(10);
                this.setDamage(50.0f);
                this.markHurt();
            }
        }
    }
    
    @Override
    public Type getMinecartType() {
        return Type.RIDEABLE;
    }
}
