Skip to content

Commit

Permalink
Merge branch 'master' into 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Feb 5, 2025
2 parents cc6acfc + 92a6376 commit da04853
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public boolean place(@NotNull FeaturePlaceContext<FadingDiskCarpetFeatureConfig>
for (int z = bz - radius; z <= bz + radius; z++) {
if (useHeightMapAndNotCircular) {
double distance = Math.pow((double) bx - x, 2) + Math.pow((double) bz - z, 2);
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, level.getHeight(heightmap, x, z), z, distance, true) || success.get());
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, level.getHeight(heightmap, x, z), z, distance) || success.get());
} else {
int maxY = by + radius;
for (int y = by - radius; y <= maxY; y++) {
double distance = Math.pow((double) bx - x, 2) + Math.pow((double) by - y, 2) + Math.pow((double) bz - z, 2);
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, y + 1, z, distance, false) || success.get());
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, y + 1, z, distance) || success.get());
}
}
}
Expand All @@ -82,19 +82,18 @@ private boolean placeAtPos(
int x,
int y,
int z,
double distance,
boolean useHeightMapAndNotCircular
double distance
) {
if (distance < Math.pow(radius, 2)) {
mutableDisk.set(x, y, z);
if (!useHeightMapAndNotCircular && FrozenLibFeatureUtils.isBlockExposed(level, mutableDisk)) {
if (FrozenLibFeatureUtils.isBlockExposed(level, mutableDisk)) {
boolean inner = mutableDisk.closerThan(origin, radius * config.innerChance());
boolean fade = !inner && !mutableDisk.closerThan(origin, radius * config.fadeStartDistancePercent());
if (random.nextFloat() < config.placementChance()) {
if (fade) {
BlockState outerState = config.outerState().getState(random, mutableDisk);
if (random.nextFloat() > 0.5F && outerState.canSurvive(level, mutableDisk)) {
return this.placeBlock(level, config.outerState().getState(random, mutableDisk), mutableDisk);
return this.placeBlock(level, outerState, mutableDisk);
}
} else {
BlockStateProvider innerStateProvider = inner && random.nextFloat() < config.innerChance() ? config.innerState() : config.outerState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ public boolean place(@NotNull FeaturePlaceContext<FadingDiskWithBiomeFeatureConf
for (int z = bz - radius; z <= bz + radius; z++) {
if (useHeightMapAndNotCircular) {
double distance = Math.pow((double) bx - x, 2) + Math.pow((double) bz - z, 2);
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, level.getHeight(heightmap, x, z) - 1, z, distance, true) || success.get());
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, level.getHeight(heightmap, x, z) - 1, z, distance) || success.get());
} else {
int maxY = by + radius;
for (int y = by - radius; y <= maxY; y++) {
double distance = Math.pow((double) bx - x, 2) + Math.pow((double) by - y, 2) + Math.pow((double) bz - z, 2);
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, y, z, distance, false) || success.get());
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, y, z, distance) || success.get());
}
}
}
Expand All @@ -84,13 +84,12 @@ private boolean placeAtPos(
int x,
int y,
int z,
double distance,
boolean useHeightMapAndNotCircular
double distance
) {
if (distance < Math.pow(radius, 2)) {
mutableDisk.set(x, y, z);
BlockState state = level.getBlockState(mutableDisk);
if (!useHeightMapAndNotCircular && FrozenLibFeatureUtils.isBlockExposed(level, mutableDisk)) {
if (FrozenLibFeatureUtils.isBlockExposed(level, mutableDisk)) {
boolean inner = mutableDisk.closerThan(origin, radius * config.innerChance());
boolean fade = !inner && !mutableDisk.closerThan(origin, radius * config.fadeStartDistancePercent());
if (random.nextFloat() < config.placementChance()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public boolean place(@NotNull FeaturePlaceContext<FadingDiskFeatureConfig> conte
for (int z = bz - radius; z <= bz + radius; z++) {
if (useHeightMapAndNotCircular) {
double distance = Math.pow((double) bx - x, 2) + Math.pow((double) bz - z, 2);
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, level.getHeight(heightmap, x, z) - 1, z, distance, true) || success.get());
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, level.getHeight(heightmap, x, z) - 1, z, distance) || success.get());
} else {
int maxY = by + radius;
for (int y = by - radius; y <= maxY; y++) {
double distance = Math.pow((double) bx - x, 2) + Math.pow((double) by - y, 2) + Math.pow((double) bz - z, 2);
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, y, z, distance, false) || success.get());
success.set(placeAtPos(level, config, origin, random, radius, mutableDisk, x, y, z, distance) || success.get());
}
}
}
Expand All @@ -82,13 +82,12 @@ private boolean placeAtPos(
int x,
int y,
int z,
double distance,
boolean useHeightMapAndNotCircular
double distance
) {
if (distance < Math.pow(radius, 2)) {
mutableDisk.set(x, y, z);
BlockState state = level.getBlockState(mutableDisk);
if (!useHeightMapAndNotCircular && FrozenLibFeatureUtils.isBlockExposed(level, mutableDisk)) {
if (FrozenLibFeatureUtils.isBlockExposed(level, mutableDisk)) {
boolean inner = mutableDisk.closerThan(origin, radius * config.innerChance());
boolean fade = !inner && !mutableDisk.closerThan(origin, radius * config.fadeStartDistancePercent());
if (random.nextFloat() < config.placementChance()) {
Expand Down

0 comments on commit da04853

Please sign in to comment.