package net.minecraft.world.phys.shapes;

import net.minecraft.core.Direction;
import net.minecraft.core.BlockPos;
import net.minecraft.world.item.Items;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.item.Item;

public class EntityCollisionContext implements CollisionContext {
    protected static final CollisionContext EMPTY;
    private final boolean descending;
    private final double entityBottom;
    private final Item heldItem;
    
    protected EntityCollisionContext(final boolean boolean1, final double double2, final Item bei) {
        this.descending = boolean1;
        this.entityBottom = double2;
        this.heldItem = bei;
    }
    
    @Deprecated
    protected EntityCollisionContext(final Entity akq) {
        this(akq.isDescending(), akq.getY(), (akq instanceof LivingEntity) ? ((LivingEntity)akq).getMainHandItem().getItem() : Items.AIR);
    }
    
    @Override
    public boolean isHoldingItem(final Item bei) {
        return this.heldItem == bei;
    }
    
    @Override
    public boolean isDescending() {
        return this.descending;
    }
    
    @Override
    public boolean isAbove(final VoxelShape cwf, final BlockPos fk, final boolean boolean3) {
        return this.entityBottom > fk.getY() + cwf.max(Direction.Axis.Y) - 9.999999747378752E-6;
    }
    
    static {
        EMPTY = new EntityCollisionContext(false, -1.7976931348623157E308, Items.AIR) {
            @Override
            public boolean isAbove(final VoxelShape cwf, final BlockPos fk, final boolean boolean3) {
                return boolean3;
            }
        };
    }
}
