use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class NetherPortalMatcher method findHorizontalPortalPlacementWithVerticalSpaceReserved.
private static IntegerAABBInclusive findHorizontalPortalPlacementWithVerticalSpaceReserved(BlockPos areaSize, IWorld world, BlockPos searchingCenter, IntegerAABBInclusive heightLimit, int verticalSpaceReserve) {
BlockPos growVertically = new BlockPos(areaSize.getX(), verticalSpaceReserve, areaSize.getZ());
IntegerAABBInclusive foundCubeArea = findCubeAirAreaAtAnywhere(growVertically, world, searchingCenter, heightLimit, findingRadius);
if (foundCubeArea == null) {
return null;
}
return foundCubeArea.getSubBoxInCenter(areaSize);
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class BorderPortal method setBorderPortal.
public static void setBorderPortal(ServerWorld world, int x1, int y1, int x2, int y2) {
GlobalPortalStorage storage = GlobalPortalStorage.get(world);
storage.data.removeIf(portal -> portal instanceof BorderPortal);
IntegerAABBInclusive box = new IntegerAABBInclusive(new BlockPos(x1, 0, y1), new BlockPos(x2, 256, y2)).getSorted();
Box area = box.toRealNumberBox();
storage.data.add(createWrappingPortal(world, area, Direction.NORTH));
storage.data.add(createWrappingPortal(world, area, Direction.SOUTH));
storage.data.add(createWrappingPortal(world, area, Direction.WEST));
storage.data.add(createWrappingPortal(world, area, Direction.EAST));
storage.onDataChanged();
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class NetherPortalGenerator method generateObsidianFrame.
private static void generateObsidianFrame(ServerWorld world, ObsidianFrame obsidianFrame) {
Direction.Axis axisOfNormal = obsidianFrame.normalAxis;
IntegerAABBInclusive boxIncludingObsidianFrame = ObsidianFrame.expandToIncludeObsidianBlocks(axisOfNormal, obsidianFrame.boxWithoutObsidian);
Arrays.stream(Helper.getAnotherFourDirections(axisOfNormal)).forEach(facing -> boxIncludingObsidianFrame.getSurfaceLayer(facing).stream().forEach(blockPos -> setObsidian(world, blockPos)));
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class NetherPortalGenerator method findAirCubePlacement.
public static IntegerAABBInclusive findAirCubePlacement(ServerWorld toWorld, BlockPos mappedPosInOtherDimension, IntegerAABBInclusive heightLimit, Direction.Axis axis, BlockPos neededAreaSize) {
IntegerAABBInclusive foundAirCube = axis == Direction.Axis.Y ? NetherPortalMatcher.findHorizontalPortalPlacement(neededAreaSize, toWorld, mappedPosInOtherDimension, heightLimit, NetherPortalMatcher.findingRadius) : NetherPortalMatcher.findVerticalPortalPlacement(neededAreaSize, toWorld, mappedPosInOtherDimension, heightLimit, NetherPortalMatcher.findingRadius);
if (foundAirCube == null) {
Helper.log("Cannot find normal portal placement");
foundAirCube = NetherPortalMatcher.findCubeAirAreaAtAnywhere(neededAreaSize, toWorld, mappedPosInOtherDimension, heightLimit, NetherPortalMatcher.findingRadius);
}
if (foundAirCube == null) {
Helper.err("No place to put portal? " + "Force placed portal. It will occupy normal blocks.");
foundAirCube = IntegerAABBInclusive.getBoxByBasePointAndSize(neededAreaSize, mappedPosInOtherDimension);
}
return foundAirCube;
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class NetherPortalMatcher method findVerticalPortalPlacement.
// ------------------------------------------------------------
// detect air cube on ground
static IntegerAABBInclusive findVerticalPortalPlacement(BlockPos areaSize, IWorld world, BlockPos searchingCenter, IntegerAABBInclusive heightLimit, int findingRadius) {
IntegerAABBInclusive aboveLavaLake = getAirCubeOnGround(areaSize.add(20, 20, 20), world, searchingCenter, heightLimit, findingRadius / 4, blockPos -> isLavaLake(world, blockPos));
if (aboveLavaLake != null) {
Helper.log("Generated Portal Above Lava Lake");
return aboveLavaLake.getSubBoxInCenter(areaSize);
}
Helper.log("Generated Portal On Ground");
IntegerAABBInclusive biggerArea = getAirCubeOnSolidGround(areaSize.add(6, 0, 6), world, searchingCenter, heightLimit, findingRadius);
return pushDownBox(world, biggerArea.getSubBoxInCenter(areaSize));
}
Aggregations