implement generate surface for ores

This commit is contained in:
Julian Krings 2025-06-24 19:43:46 +02:00
parent 3677931114
commit 5d28563b7c
No known key found for this signature in database
GPG Key ID: 208C6E08C3B718D2
4 changed files with 20 additions and 6 deletions

View File

@ -106,6 +106,14 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
} }
} }
BlockData ore = biome.generateOres(realX, i, realZ, rng, getData(), true);
ore = ore == null ? region.generateOres(realX, i, realZ, rng, getData(), true) : ore;
ore = ore == null ? getDimension().generateOres(realX, i, realZ, rng, getData(), true) : ore;
if (ore != null) {
h.set(xf, i, zf, ore);
continue;
}
if (i > he && i <= hf) { if (i > he && i <= hf) {
fdepth = hf - i; fdepth = hf - i;
@ -138,9 +146,9 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
continue; continue;
} }
BlockData ore = biome.generateOres(realX, i, realZ, rng, getData()); ore = biome.generateOres(realX, i, realZ, rng, getData(), false);
ore = ore == null ? region.generateOres(realX, i, realZ, rng, getData()) : ore; ore = ore == null ? region.generateOres(realX, i, realZ, rng, getData(), false) : ore;
ore = ore == null ? getDimension().generateOres(realX, i, realZ, rng, getData()) : ore; ore = ore == null ? getDimension().generateOres(realX, i, realZ, rng, getData(), false) : ore;
if (ore != null) { if (ore != null) {
h.set(xf, i, zf, ore); h.set(xf, i, zf, ore);

View File

@ -171,12 +171,14 @@ public class IrisBiome extends IrisRegistrant implements IRare {
@ArrayType(type = IrisOreGenerator.class, min = 1) @ArrayType(type = IrisOreGenerator.class, min = 1)
private KList<IrisOreGenerator> ores = new KList<>(); private KList<IrisOreGenerator> ores = new KList<>();
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) { public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
if (ores.isEmpty()) { if (ores.isEmpty()) {
return null; return null;
} }
BlockData b = null; BlockData b = null;
for (IrisOreGenerator i : ores) { for (IrisOreGenerator i : ores) {
if (i.isGenerateSurface() != surface)
continue;
b = i.generate(x, y, z, rng, data); b = i.generate(x, y, z, rng, data);
if (b != null) { if (b != null) {

View File

@ -253,12 +253,14 @@ public class IrisDimension extends IrisRegistrant {
return (int) getDimensionHeight().getMin(); return (int) getDimensionHeight().getMin();
} }
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) { public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
if (ores.isEmpty()) { if (ores.isEmpty()) {
return null; return null;
} }
BlockData b = null; BlockData b = null;
for (IrisOreGenerator i : ores) { for (IrisOreGenerator i : ores) {
if (i.isGenerateSurface() != surface)
continue;
b = i.generate(x, y, z, rng, data); b = i.generate(x, y, z, rng, data);
if (b != null) { if (b != null) {

View File

@ -151,12 +151,14 @@ public class IrisRegion extends IrisRegistrant implements IRare {
@ArrayType(type = IrisOreGenerator.class, min = 1) @ArrayType(type = IrisOreGenerator.class, min = 1)
private KList<IrisOreGenerator> ores = new KList<>(); private KList<IrisOreGenerator> ores = new KList<>();
public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data) { public BlockData generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
if (ores.isEmpty()) { if (ores.isEmpty()) {
return null; return null;
} }
BlockData b = null; BlockData b = null;
for (IrisOreGenerator i : ores) { for (IrisOreGenerator i : ores) {
if (i.isGenerateSurface() != surface)
continue;
b = i.generate(x, y, z, rng, data); b = i.generate(x, y, z, rng, data);
if (b != null) { if (b != null) {