fix ore generation height limit

This commit is contained in:
Sen 2025-05-25 20:55:53 +02:00
parent 1d0dfddf25
commit c0369d14b8

View file

@ -5,6 +5,7 @@ import common.rng.Random;
import common.util.BlockPos; import common.util.BlockPos;
import common.util.ExtMath; import common.util.ExtMath;
import common.world.State; import common.world.State;
import common.world.World;
import server.world.WorldServer; import server.world.WorldServer;
public class FeatureOres public class FeatureOres
@ -41,18 +42,18 @@ public class FeatureOres
this.oreBlock = state; this.oreBlock = state;
this.distributed = dist; this.distributed = dist;
if(this.distributed) { if(this.distributed) {
min = min < 0 ? 0 : (min > 511 ? 511 : min); min = min < -World.MAX_SIZE_Y ? -World.MAX_SIZE_Y : (min > World.MAX_SIZE_Y - 1 ? World.MAX_SIZE_Y - 1 : min);
max = max < 0 ? 0 : (max > 512 ? 512 : max); max = max < -World.MAX_SIZE_Y ? -World.MAX_SIZE_Y : (max > World.MAX_SIZE_Y ? World.MAX_SIZE_Y : max);
if(min + max > 511) { if(min + max > World.MAX_SIZE_Y - 1) {
max = 512 - min; max = World.MAX_SIZE_Y - min;
} }
if(min - max < 0) { if(min - max < 0) {
max = min; max = min;
} }
} }
else { else {
min = min < 0 ? 0 : (min > 512 ? 512 : min); min = min < -World.MAX_SIZE_Y ? -World.MAX_SIZE_Y : (min > World.MAX_SIZE_Y ? World.MAX_SIZE_Y : min);
max = max < 0 ? 0 : (max > 512 ? 512 : max); max = max < -World.MAX_SIZE_Y ? -World.MAX_SIZE_Y : (max > World.MAX_SIZE_Y ? World.MAX_SIZE_Y : max);
if (max < min) if (max < min)
{ {
int i = min; int i = min;
@ -61,7 +62,7 @@ public class FeatureOres
} }
else if (max == min) else if (max == min)
{ {
if (min < 511) if (min < World.MAX_SIZE_Y - 1)
{ {
++max; ++max;
} }