use of net.minecraft.pathfinding.WalkNodeProcessor in project EnderIO by SleepyTrousers.
the class SilverfishAttractorHandler method getPathEntityToEntity.
public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range) {
int targX = MathHelper.floor(targetEntity.posX);
int targY = MathHelper.floor(targetEntity.posY + 1.0D);
int targZ = MathHelper.floor(targetEntity.posZ);
PathFinder pf = new PathFinder(new WalkNodeProcessor());
return pf.findPath(entity.world, (EntityLiving) entity, new BlockPos(targX, targY, targZ), range);
}
use of net.minecraft.pathfinding.WalkNodeProcessor in project BloodMagic by WayofTime.
the class AlchemyArrayEffectAttractor method getPathEntityToEntity.
public Path getPathEntityToEntity(Entity entity, Entity targetEntity, float range) {
int targX = MathHelper.floor(targetEntity.posX);
int targY = MathHelper.floor(targetEntity.posY + 1.0D);
int targZ = MathHelper.floor(targetEntity.posZ);
PathFinder pf = new PathFinder(new WalkNodeProcessor());
return pf.findPath(targetEntity.getEntityWorld(), (EntityLiving) entity, new BlockPos(targX, targY, targZ), range);
}
use of net.minecraft.pathfinding.WalkNodeProcessor in project pnc-repressurized by TeamPneumatic.
the class PneumaticCraftUtils method getPathFinder.
public static PathFinder getPathFinder() {
WalkNodeProcessor processor = new WalkNodeProcessor();
processor.setCanEnterDoors(true);
return new PathFinder(processor);
}
use of net.minecraft.pathfinding.WalkNodeProcessor in project ChocolateQuestRepoured by TeamChocoQuest.
the class PathNavigateGroundCQR method getPathFinder.
@Override
protected PathFinder getPathFinder() {
this.nodeProcessor = new WalkNodeProcessor() {
@Override
public PathNodeType getPathNodeType(IBlockAccess p_193577_1_, int x, int y, int z, int xSize, int ySize, int zSize, boolean canOpenDoorsIn, boolean canEnterDoorsIn, EnumSet<PathNodeType> p_193577_10_, PathNodeType p_193577_11_, BlockPos p_193577_12_) {
for (int i = 0; i < xSize; ++i) {
for (int j = 0; j < ySize; ++j) {
for (int k = 0; k < zSize; ++k) {
int l = i + x;
int i1 = j + y;
int j1 = k + z;
PathNodeType pathnodetype = this.getPathNodeType(p_193577_1_, l, i1, j1);
if (pathnodetype == PathNodeType.DOOR_WOOD_CLOSED && canOpenDoorsIn && canEnterDoorsIn) {
pathnodetype = PathNodeType.WALKABLE;
}
// TODO better method for calculating the facing from which the door will be entered
if (pathnodetype == PathNodeType.DOOR_IRON_CLOSED && canOpenDoorsIn && canEnterDoorsIn && EntityAIOpenCloseDoor.canMoveThroughDoor(p_193577_1_, new BlockPos(l, i1, j1), Direction.getFacingFromVector(l - p_193577_12_.getX(), i1 - p_193577_12_.getY(), j1 - p_193577_12_.getZ()).getOpposite(), true)) {
pathnodetype = PathNodeType.WALKABLE;
}
if (pathnodetype == PathNodeType.DOOR_OPEN && !canEnterDoorsIn) {
pathnodetype = PathNodeType.BLOCKED;
}
if (pathnodetype == PathNodeType.RAIL && !(p_193577_1_.getBlockState(p_193577_12_).getBlock() instanceof AbstractRailBlock) && !(p_193577_1_.getBlockState(p_193577_12_.down()).getBlock() instanceof AbstractRailBlock)) {
pathnodetype = PathNodeType.FENCE;
}
if (i == 0 && j == 0 && k == 0) {
p_193577_11_ = pathnodetype;
}
p_193577_10_.add(pathnodetype);
}
}
}
return p_193577_11_;
}
@Override
protected PathNodeType getPathNodeTypeRaw(IBlockAccess p_189553_1_, int p_189553_2_, int p_189553_3_, int p_189553_4_) {
BlockPos blockpos = new BlockPos(p_189553_2_, p_189553_3_, p_189553_4_);
BlockState iblockstate = p_189553_1_.getBlockState(blockpos);
Block block = iblockstate.getBlock();
Material material = iblockstate.getMaterial();
PathNodeType type = block.getAiPathNodeType(iblockstate, p_189553_1_, blockpos, this.currentEntity);
if (type != null) {
return type;
}
if (material == Material.AIR) {
return PathNodeType.OPEN;
} else if (block != Blocks.TRAPDOOR && block != Blocks.IRON_TRAPDOOR && block != Blocks.WATERLILY) {
if (block == Blocks.FIRE) {
return PathNodeType.DAMAGE_FIRE;
} else if (block == Blocks.CACTUS) {
return PathNodeType.DAMAGE_CACTUS;
} else if (block instanceof DoorBlock && material == Material.WOOD && !iblockstate.getActualState(p_189553_1_, blockpos).getValue(DoorBlock.OPEN)) {
return PathNodeType.DOOR_WOOD_CLOSED;
} else if (block instanceof DoorBlock && material == Material.IRON && !iblockstate.getActualState(p_189553_1_, blockpos).getValue(DoorBlock.OPEN)) {
return PathNodeType.DOOR_IRON_CLOSED;
} else if (block instanceof DoorBlock && iblockstate.getActualState(p_189553_1_, blockpos).getValue(DoorBlock.OPEN)) {
return PathNodeType.DOOR_OPEN;
} else if (block instanceof AbstractRailBlock) {
return PathNodeType.RAIL;
} else if (!(block instanceof FenceBlock) && !(block instanceof WallBlock) && (!(block instanceof FenceGateBlock) || iblockstate.getValue(FenceGateBlock.OPEN).booleanValue())) {
if (material == Material.WATER) {
return PathNodeType.WATER;
} else if (material == Material.LAVA) {
return PathNodeType.LAVA;
} else {
return block.isPassable(p_189553_1_, blockpos) ? PathNodeType.OPEN : PathNodeType.BLOCKED;
}
} else {
return PathNodeType.FENCE;
}
} else {
return PathNodeType.TRAPDOOR;
}
}
};
this.nodeProcessor.setCanEnterDoors(true);
this.pathFinder = new PathFinder(this.nodeProcessor);
return this.pathFinder;
}
Aggregations