use of net.minecraft.village.PointOfInterest in project Arclight by IzzelAliz.
the class TeleporterMixin_1_15 method findPortal.
public BlockPattern.PortalInfo findPortal(BlockPos p_222272_1_, Vec3d p_222272_2_, Direction directionIn, double p_222272_4_, double p_222272_6_, boolean p_222272_8_, int searchRadius) {
PointOfInterestManager pointofinterestmanager = this.world.getPointOfInterestManager();
pointofinterestmanager.ensureLoadedAndValid(this.world, p_222272_1_, 128);
List<PointOfInterest> list = pointofinterestmanager.getInSquare((p_226705_0_) -> {
return p_226705_0_ == PointOfInterestType.NETHER_PORTAL;
}, p_222272_1_, searchRadius, PointOfInterestManager.Status.ANY).collect(Collectors.toList());
Optional<PointOfInterest> optional = list.stream().min(Comparator.<PointOfInterest>comparingDouble((p_226706_1_) -> {
return p_226706_1_.getPos().distanceSq(p_222272_1_);
}).thenComparingInt((p_226704_0_) -> {
return p_226704_0_.getPos().getY();
}));
return optional.map((p_226707_7_) -> {
BlockPos blockpos = p_226707_7_.getPos();
this.world.getChunkProvider().registerTicket(TicketType.PORTAL, new ChunkPos(blockpos), 3, blockpos);
BlockPattern.PatternHelper blockpattern$patternhelper = NetherPortalBlock.createPatternHelper(this.world, blockpos);
return blockpattern$patternhelper.getPortalInfo(directionIn, blockpos, p_222272_6_, p_222272_2_, p_222272_4_);
}).orElse(null);
}
Aggregations