use of com.irtimaled.bbor.client.models.Point in project BoundingBoxOutlineReloaded by irtimaled.
the class SphereCommandBuilder method addSphere.
private static int addSphere(CommandContext<CommandSource> context) throws CommandSyntaxException {
Point pos = Arguments.getPoint(context, ArgumentNames.POS).snapXZ(0.5d);
int radius = Arguments.getInteger(context, RADIUS);
CustomSphereProvider.add(pos, radius);
CommandHelper.feedback(context, "bbor.commands.sphere.added", pos.getX(), pos.getY(), pos.getZ(), radius);
return 0;
}
use of com.irtimaled.bbor.client.models.Point in project BoundingBoxOutlineReloaded by irtimaled.
the class SpawningSphereProvider method calculateSpawnableSpacesCount.
public static void calculateSpawnableSpacesCount(BlockProcessor blockProcessor) {
if (spawningSphere != null) {
Point sphereCenter = spawningSphere.getPoint();
int size = BoundingBoxSpawningSphere.SPAWN_RADIUS + 2;
SpawningSphereHelper.findSpawnableSpaces(sphereCenter, sphereCenter.getCoords(), size, size, blockProcessor);
}
}
use of com.irtimaled.bbor.client.models.Point in project BoundingBoxOutlineReloaded by irtimaled.
the class ConduitRenderer method render.
@Override
public void render(BoundingBoxConduit boundingBox) {
int level = boundingBox.getLevel();
Point point = boundingBox.getPoint();
Color color = BoundingBoxTypeHelper.getColor(boundingBox.getType());
if (level != 0) {
renderSphere(point, boundingBox.getRadius() + 0.5, color);
}
OffsetPoint center = new OffsetPoint(point);
OffsetBox centerBox = new OffsetBox(center, center).grow(0.5, 0.5, 0.5);
renderCuboid(centerBox, color);
if (level == 6 && ConfigManager.renderConduitMobHarmArea.get()) {
renderCuboid(centerBox.grow(8, 8, 8), ColorHelper.getColor(ConfigManager.colorConduitMobHarmArea));
}
}
use of com.irtimaled.bbor.client.models.Point in project BoundingBoxOutlineReloaded by irtimaled.
the class SphereRenderer method render.
@Override
public void render(BoundingBoxSphere boundingBox) {
Point point = boundingBox.getPoint();
double radius = boundingBox.getRadius();
renderSphere(point, radius, BoundingBoxTypeHelper.getColor(boundingBox.getType()));
}
use of com.irtimaled.bbor.client.models.Point in project BoundingBoxOutlineReloaded by irtimaled.
the class SpawningSphereHelper method findSpawnableSpaces.
public static void findSpawnableSpaces(Point center, Coords coords, int width, int height, BlockProcessor blockProcessor) {
int blockX = coords.getX();
int minX = blockX - width;
int maxX = blockX + width + 1;
int blockZ = coords.getZ();
int minZ = blockZ - width;
int maxZ = blockZ + width + 1;
int blockY = coords.getY();
int minY = Math.max(1, blockY - height);
int maxY = Math.min(255, blockY + height);
World world = Minecraft.getInstance().world;
for (int x = minX; x < maxX; x++) {
for (int z = minZ; z < maxZ; z++) {
double closestX = x + 0.5D;
double closestZ = z + 0.5D;
double distance = center.getDistance(new Point(closestX, center.getY(), closestZ));
if (distance > BoundingBoxSpawningSphere.SPAWN_RADIUS)
continue;
if (SpawnableBlocksHelper.isBiomeHostileSpawnProof(world, new BlockPos(x, 1, z)))
continue;
BlockState upperBlockState = world.getBlockState(new BlockPos(x, minY - 1, z));
for (int y = minY; y < maxY; y++) {
BlockState spawnBlockState = upperBlockState;
BlockPos pos = new BlockPos(x, y, z);
upperBlockState = world.getBlockState(pos);
distance = center.getDistance(new Point(closestX, y, closestZ));
if (isWithinSpawnableZone(distance) && SpawnableBlocksHelper.isSpawnable(world, pos, spawnBlockState, upperBlockState)) {
blockProcessor.process(pos);
}
}
}
}
}
Aggregations