package net.minecraft.world.entity.ai.behavior;

import java.util.Optional;
import java.util.List;
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.phys.Vec3;
import net.minecraft.core.BlockPos;
import net.minecraft.world.entity.Entity;

public class EntityPosWrapper implements PositionWrapper {
    private final Entity entity;
    
    public EntityPosWrapper(final Entity akq) {
        this.entity = akq;
    }
    
    @Override
    public BlockPos getPos() {
        return new BlockPos(this.entity);
    }
    
    @Override
    public Vec3 getLookAtPos() {
        return new Vec3(this.entity.getX(), this.entity.getEyeY(), this.entity.getZ());
    }
    
    @Override
    public boolean isVisible(final LivingEntity akz) {
        final Optional<List<LivingEntity>> optional3 = akz.getBrain().<List<LivingEntity>>getMemory(MemoryModuleType.VISIBLE_LIVING_ENTITIES);
        return this.entity.isAlive() && optional3.isPresent() && optional3.get().contains(this.entity);
    }
    
    @Override
    public String toString() {
        return "EntityPosWrapper for " + this.entity;
    }
}
