use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class BreakableMirror method readCustomDataFromTag.
@Override
protected void readCustomDataFromTag(CompoundTag tag) {
super.readCustomDataFromTag(tag);
wallArea = new IntegerAABBInclusive(new BlockPos(tag.getInt("boxXL"), tag.getInt("boxYL"), tag.getInt("boxZL")), new BlockPos(tag.getInt("boxXH"), tag.getInt("boxYH"), tag.getInt("boxZH")));
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class BreakableMirror method createMirror.
public static BreakableMirror createMirror(ServerWorld world, BlockPos glassPos, Direction facing) {
if (!isGlass(world, glassPos)) {
return null;
}
IntegerAABBInclusive wallArea = findGlassWallArea(world, glassPos, facing);
BreakableMirror breakableMirror = BreakableMirror.entityType.create(world);
Vec3d pos = new Vec3d((double) (wallArea.l.getX() + wallArea.h.getX()) / 2, (double) (wallArea.l.getY() + wallArea.h.getY()) / 2, (double) (wallArea.l.getZ() + wallArea.h.getZ()) / 2).add(0.5, 0.5, 0.5).add(new Vec3d(facing.getVector()).multiply(0.5));
breakableMirror.setPosition(pos.x, pos.y, pos.z);
breakableMirror.destination = pos;
breakableMirror.dimensionTo = world.dimension.getType();
Pair<Direction.Axis, Direction.Axis> axises = Helper.getPerpendicularAxis(facing);
Direction.Axis wAxis = axises.getLeft();
Direction.Axis hAxis = axises.getRight();
float width = Helper.getCoordinate(wallArea.getSize(), wAxis);
int height = Helper.getCoordinate(wallArea.getSize(), hAxis);
breakableMirror.axisW = new Vec3d(Direction.get(Direction.AxisDirection.POSITIVE, wAxis).getVector());
breakableMirror.axisH = new Vec3d(Direction.get(Direction.AxisDirection.POSITIVE, hAxis).getVector());
breakableMirror.width = width;
breakableMirror.height = height;
breakableMirror.wallArea = wallArea;
world.spawnEntity(breakableMirror);
breakIntersectedMirror(breakableMirror);
return breakableMirror;
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class NetherPortalGenerator method onFireLit.
@Deprecated
public static NetherPortalGeneratedInformation onFireLit(ServerWorld fromWorld, BlockPos firePos) {
DimensionType fromDimension = fromWorld.dimension.getType();
DimensionType toDimension = getDestinationDimension(fromDimension);
if (toDimension == null)
return null;
ObsidianFrame fromObsidianFrame = findTheObsidianFrameThatIsLighted(fromWorld, firePos);
if (fromObsidianFrame == null)
return null;
ServerWorld toWorld = McHelper.getServer().getWorld(toDimension);
assert toWorld != null;
spawnLoadingIndicator(fromWorld, fromObsidianFrame);
BlockPos posInOtherDimension = getPosInOtherDimension(firePos, fromDimension, toDimension);
ObsidianFrame toObsidianFrame = findExistingEmptyObsidianFrameWithSameSizeInDestDimension(fromObsidianFrame, toWorld, posInOtherDimension, NetherPortalMatcher.findingRadius);
IntegerAABBInclusive heightLimitInOtherDimension = NetherPortalMatcher.getHeightLimit(toDimension);
if (toObsidianFrame == null) {
BlockPos randomShift = getRandomShift(fromDimension);
toObsidianFrame = createObsidianFrameInOtherDimension(fromObsidianFrame, toWorld, posInOtherDimension.add(randomShift), heightLimitInOtherDimension);
}
registerPortalAndGenerateContentBlocks(fromWorld, fromObsidianFrame, toWorld, toObsidianFrame);
NetherPortalGeneratedInformation information = new NetherPortalGeneratedInformation(fromDimension, toDimension, fromObsidianFrame, toObsidianFrame);
signalNetherPortalLit.emit(information);
return information;
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class NetherPortalGenerator method spawnLoadingIndicator.
public static void spawnLoadingIndicator(ServerWorld world, ObsidianFrame obsidianFrame) {
IntegerAABBInclusive box = obsidianFrame.boxWithoutObsidian;
Vec3d center = new Vec3d((double) (box.h.getX() + box.l.getX() + 1) / 2, (double) (box.h.getY() + box.l.getY() + 1) / 2 - 1, (double) (box.h.getZ() + box.l.getZ() + 1) / 2);
CustomPayloadS2CPacket packet = MyNetwork.createSpawnLoadingIndicator(world.dimension.getType(), center);
McHelper.getEntitiesNearby(world, center, ServerPlayerEntity.class, 64).forEach(player -> player.networkHandler.sendPacket(packet));
}
use of com.qouteall.immersive_portals.my_util.IntegerAABBInclusive in project ImmersivePortalsMod by qouteall.
the class NetherPortalGenerator method createObsidianFrameInOtherDimension.
// @NotNull
private static ObsidianFrame createObsidianFrameInOtherDimension(ObsidianFrame fromObsidianFrame, ServerWorld toWorld, BlockPos mappedPosInOtherDimension, IntegerAABBInclusive heightLimit) {
Direction.Axis axis = fromObsidianFrame.normalAxis;
BlockPos neededAreaSize = ObsidianFrame.expandToIncludeObsidianBlocks(axis, fromObsidianFrame.boxWithoutObsidian).getSize();
IntegerAABBInclusive foundAirCube = findAirCubePlacement(toWorld, mappedPosInOtherDimension, heightLimit, axis, neededAreaSize);
ObsidianFrame toObsidianFrame = new ObsidianFrame(axis, ObsidianFrame.shrinkToExcludeObsidianBlocks(axis, foundAirCube));
generateObsidianFrame(toWorld, toObsidianFrame);
return toObsidianFrame;
}
Aggregations