Search in sources :

Example 1 with PigtificateVillage

use of nex.village.PigtificateVillage in project NetherEx by LogicTechCorp.

the class EntityAIRestrictFenceGateUse method shouldExecute.

@Override
public boolean shouldExecute() {
    if (entityObj.world.isDaytime()) {
        return false;
    } else {
        BlockPos blockpos = new BlockPos(entityObj);
        PigtificateVillage village = PigtificateVillageManager.getPigtificateVillages(entityObj.getEntityWorld()).getNearestVillage(blockpos, 16);
        if (village == null) {
            return false;
        } else {
            fenceGate = village.getNearestFenceGate(blockpos);
            return fenceGate != null && (double) fenceGate.getDistanceToInsideBlockSq(blockpos) < 2.25D;
        }
    }
}
Also used : PigtificateVillage(nex.village.PigtificateVillage) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)1 PigtificateVillage (nex.village.PigtificateVillage)1