Clamp vacuum targets to the dimension's own heights instead of Minecraft's range, so terrain can be raised past Y 256 in a dimension that starts at -64

This commit is contained in:
piexel committed 2026-10-08 15:25:58 +02:00
1 parent c19f955fef
commit 162d4d0be8
2 files changed
+12 -5

No files matched your search

@@ -93,6 +93,13 @@ public final class IrisObjectVacuum {
return 0; return 0;
} }
/** The lowest height vacuum may target, one above the dimension's bottom (placer heights start at 0 there). */
public static final int LOWEST_TARGET_Y = 1;
public static int clampTargetY(int targetY, int lowestY, int highestY) {
return Math.max(lowestY, Math.min(highestY, targetY));
}
public static int columnTargetY(int dx, int dz, int lowX, int highX, int lowZ, int highZ, public static int columnTargetY(int dx, int dz, int lowX, int highX, int lowZ, int highZ,
double effectiveRadius, double falloff, int originalY, int meetY) { double effectiveRadius, double falloff, int originalY, int meetY) {
double factor = columnInfluence( double factor = columnInfluence(
@@ -84,8 +84,8 @@ public final class VacuumModule implements IrisModule {
private final double waveAmplitude; private final double waveAmplitude;
private final double waveScale; private final double waveScale;
private final SimplexNoise waves; private final SimplexNoise waves;
private final int worldMin; private final int lowestY;
private final int worldMax; private final int highestY;
private Bend(PlacementStageContext context, PreparedPlacement prepared, Engine engine) { private Bend(PlacementStageContext context, PreparedPlacement prepared, Engine engine) {
ObjectPlaceMode mode = prepared.mode(); ObjectPlaceMode mode = prepared.mode();
@@ -101,8 +101,8 @@ public final class VacuumModule implements IrisModule {
this.waveAmplitude = IrisObjectVacuum.resolveWaveAmplitude(settings); this.waveAmplitude = IrisObjectVacuum.resolveWaveAmplitude(settings);
this.waveScale = IrisObjectVacuum.resolveWaveScale(settings); this.waveScale = IrisObjectVacuum.resolveWaveScale(settings);
this.waves = mode == ObjectPlaceMode.VACUUM_WAVY && waveAmplitude > 0 ? new SimplexNoise(WAVE_SEED) : null; this.waves = mode == ObjectPlaceMode.VACUUM_WAVY && waveAmplitude > 0 ? new SimplexNoise(WAVE_SEED) : null;
this.worldMin = engine.getMinHeight(); this.lowestY = IrisObjectVacuum.LOWEST_TARGET_Y;
this.worldMax = worldMin + engine.getHeight() - 1; this.highestY = engine.getHeight() - 1;
} }
private void apply(int baseY, int topY) { private void apply(int baseY, int topY) {
@@ -124,7 +124,7 @@ public final class VacuumModule implements IrisModule {
if (targetY == originalY) { if (targetY == originalY) {
return; return;
} }
targetY = Math.max(worldMin + 1, Math.min(worldMax, targetY)); targetY = IrisObjectVacuum.clampTargetY(targetY, lowestY, highestY);
if (targetY > originalY) { if (targetY > originalY) {
raise(x, z, originalY, targetY); raise(x, z, originalY, targetY);
} else if (targetY < originalY) { } else if (targetY < originalY) {