All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.nukkit.entity.ai.evaluator.BlockCheckEvaluator Maven / Gradle / Ivy

There is a newer version: 1.20.40-r1
Show newest version
package cn.nukkit.entity.ai.evaluator;

import cn.nukkit.api.PowerNukkitXOnly;
import cn.nukkit.api.Since;
import cn.nukkit.entity.EntityIntelligent;
import cn.nukkit.math.Vector3;

@PowerNukkitXOnly
@Since("1.6.0.0-PNX")
public class BlockCheckEvaluator implements IBehaviorEvaluator {

    protected int blockId;
    protected Vector3 offsetVec;

    public BlockCheckEvaluator(int blockId, Vector3 offsetVec) {
        this.blockId = blockId;
        this.offsetVec = offsetVec;
    }

    @Override
    public boolean evaluate(EntityIntelligent entity) {
        return entity.level.getTickCachedBlock(entity.add(offsetVec)).getId() == blockId;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy