mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 06:41:08 +00:00
Improved?
This commit is contained in:
@@ -19,7 +19,6 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.*;
|
||||||
@@ -56,8 +55,7 @@ public class IrisBiomeGeneratorLink {
|
|||||||
private int max = 0;
|
private int max = 0;
|
||||||
|
|
||||||
public IrisGenerator getCachedGenerator(DataProvider g) {
|
public IrisGenerator getCachedGenerator(DataProvider g) {
|
||||||
return gen.aquire(() ->
|
return gen.aquire(() -> {
|
||||||
{
|
|
||||||
IrisGenerator gen = g.getData().getGeneratorLoader().load(getGenerator());
|
IrisGenerator gen = g.getData().getGeneratorLoader().load(getGenerator());
|
||||||
|
|
||||||
if (gen == null) {
|
if (gen == null) {
|
||||||
@@ -68,18 +66,42 @@ public class IrisBiomeGeneratorLink {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int[] getBiomeGeneratorsRaw(Engine engine) {
|
||||||
|
int max = engine.getDimension().getMinHeight();
|
||||||
|
int min = engine.getDimension().getMaxHeight();
|
||||||
|
for (IrisBiome biome : engine.getAllBiomes()) {
|
||||||
|
for (IrisBiomeGeneratorLink i : biome.getGenerators()) {
|
||||||
|
int biomeRawMax = i.getMaxRaw();
|
||||||
|
int biomeRawMin = i.getMinRaw();
|
||||||
|
if (max < biomeRawMax)
|
||||||
|
max = biomeRawMax;
|
||||||
|
if (min > biomeRawMin)
|
||||||
|
min = biomeRawMin;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new int[] { min, max };
|
||||||
|
}
|
||||||
|
|
||||||
private int calculateHeight(Engine engine, int option) {
|
private int calculateHeight(Engine engine, int option) {
|
||||||
int dmx = engine.getDimension().getMaxHeight();
|
int dmx = engine.getDimension().getMaxHeight();
|
||||||
int dmn = engine.getDimension().getMinHeight();
|
int dmn = engine.getDimension().getMinHeight();
|
||||||
int mx = max; // 500
|
int[] heights = getBiomeGeneratorsRaw(engine);
|
||||||
int mn = min; // 160
|
int gmx = heights[1];
|
||||||
|
int gmn = heights[0];
|
||||||
|
|
||||||
|
int mx = max;
|
||||||
|
int mn = min;
|
||||||
if (engine.getDimension().isSmartVanillaHeight()) {
|
if (engine.getDimension().isSmartVanillaHeight()) {
|
||||||
if (mx > 0) mx = Math.min((int)(((float)mx / (float)dmx) * 300.0f), 300);
|
if (mx > 0)
|
||||||
if (mx < 0) mx = Math.min((int)(((float)mx / (float)dmn) * 300.0f), 56);
|
mx = Math.min((int) (((float) mx / (float) gmx) * 300.0f), 300);
|
||||||
|
if (mx < 0)
|
||||||
if (mn > 0) mn = Math.min((int)(((float)mn / (float)dmx) * 300.0f), 300);
|
mx = Math.min((int) (((float) mx / (float) gmn) * 300.0f), 56);
|
||||||
if (mn < 0) mn = Math.min((int)(((float)mn / (float)dmn) * 300.0f), 56);
|
|
||||||
|
|
||||||
|
if (mn > 0)
|
||||||
|
mn = Math.min((int) (((float) mn / (float) gmx) * 300.0f), 300);
|
||||||
|
if (mn < 0)
|
||||||
|
mn = Math.min((int) (((float) mn / (float) gmn) * 300.0f), 56);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (option == 1) {
|
if (option == 1) {
|
||||||
@@ -95,10 +117,19 @@ public class IrisBiomeGeneratorLink {
|
|||||||
public int getMax(Engine engine) {
|
public int getMax(Engine engine) {
|
||||||
return calculateHeight(engine, 1);
|
return calculateHeight(engine, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMin(Engine engine) {
|
public int getMin(Engine engine) {
|
||||||
return calculateHeight(engine, 0);
|
return calculateHeight(engine, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getMaxRaw() {
|
||||||
|
return max;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getMinRaw() {
|
||||||
|
return min;
|
||||||
|
}
|
||||||
|
|
||||||
public double getHeight(DataProvider xg, double x, double z, long seed) {
|
public double getHeight(DataProvider xg, double x, double z, long seed) {
|
||||||
double g = getCachedGenerator(xg).getHeight(x, z, seed);
|
double g = getCachedGenerator(xg).getHeight(x, z, seed);
|
||||||
g = g < 0 ? 0 : g;
|
g = g < 0 ? 0 : g;
|
||||||
|
|||||||
Reference in New Issue
Block a user