mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-06 07:46:08 +00:00
Loads of bugfixes & Seed cohesion
This commit is contained in:
@@ -26,6 +26,7 @@ import com.volmit.iris.IrisMetrics;
|
||||
import com.volmit.iris.util.BlockDataTools;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.PrecisionStopwatch;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
@@ -276,17 +277,31 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
|
||||
|
||||
protected void fail(Throwable e)
|
||||
{
|
||||
failing = true;
|
||||
Iris.error("ERROR! Failed to generate chunk! Iris has entered a failed state!");
|
||||
|
||||
for(Player i : world.getPlayers())
|
||||
if(failing)
|
||||
{
|
||||
Iris.instance.imsg(i, ChatColor.DARK_RED + "Iris Generator has entered a failed state!");
|
||||
Iris.instance.imsg(i, ChatColor.RED + "- Check the console for the error.");
|
||||
Iris.instance.imsg(i, ChatColor.RED + "- Then simply run /iris dev");
|
||||
return;
|
||||
}
|
||||
|
||||
failing = true;
|
||||
|
||||
e.printStackTrace();
|
||||
J.a(() ->
|
||||
{
|
||||
J.sleep(1000);
|
||||
Iris.error("---------------------------------------------------------------------------------------------------------");
|
||||
e.printStackTrace();
|
||||
Iris.error("---------------------------------------------------------------------------------------------------------");
|
||||
Iris.error("ERROR! Failed to generate chunk! Iris has entered a failed state!");
|
||||
Iris.error("---------------------------------------------------------------------------------------------------------");
|
||||
|
||||
for(Player i : world.getPlayers())
|
||||
{
|
||||
Iris.instance.imsg(i, ChatColor.DARK_RED + "Iris Generator has entered a failed state!");
|
||||
Iris.instance.imsg(i, ChatColor.RED + "- Check the console for the error.");
|
||||
Iris.instance.imsg(i, ChatColor.RED + "- Then simply run /iris dev");
|
||||
}
|
||||
});
|
||||
|
||||
onFailure(e);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.volmit.iris.IrisContext;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.BiomeResult;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
@@ -103,6 +104,7 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
@Override
|
||||
public void onHotloaded()
|
||||
{
|
||||
CNG.creates = 0;
|
||||
onHotload();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeMutation;
|
||||
import com.volmit.iris.object.IrisDepositGenerator;
|
||||
import com.volmit.iris.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
@@ -158,7 +159,12 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
protected void onPostGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid, HeightMap height, BiomeMap biomeMap)
|
||||
{
|
||||
setCaching(false);
|
||||
getSliverCache().clear();
|
||||
|
||||
if(getSliverCache().size() > 20000)
|
||||
{
|
||||
getSliverCache().clear();
|
||||
}
|
||||
|
||||
super.onPostGenerate(random, x, z, data, grid, height, biomeMap);
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
getBiomeHitCache().clear();
|
||||
@@ -215,7 +221,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
protected void onGenerateParallax(RNG random, int x, int z)
|
||||
{
|
||||
String key = "par." + x + "." + "z";
|
||||
ChunkPosition rad = Iris.data.getObjectLoader().getParallaxSize();
|
||||
ChunkPosition rad = getDimension().getParallaxSize();
|
||||
KList<NastyRunnable> q = new KList<>();
|
||||
|
||||
for(int ii = x - (rad.getX() / 2); ii <= x + (rad.getX() / 2); ii++)
|
||||
@@ -244,6 +250,36 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
|
||||
int g = 1;
|
||||
|
||||
searching: for(IrisBiomeMutation k : getDimension().getMutations())
|
||||
{
|
||||
for(int l = 0; l < k.getChecks(); l++)
|
||||
{
|
||||
IrisBiome sa = sampleTrueBiome(((i * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius()), ((j * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius())).getBiome();
|
||||
IrisBiome sb = sampleTrueBiome(((i * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius()), ((j * 16) + ro.nextInt(16)) + ro.i(-k.getRadius(), k.getRadius())).getBiome();
|
||||
|
||||
if(sa.getLoadKey().equals(sb.getLoadKey()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.getRealSideA().contains(sa.getLoadKey()) && k.getRealSideB().contains(sb.getLoadKey()))
|
||||
{
|
||||
for(IrisObjectPlacement m : k.getObjects())
|
||||
{
|
||||
int gg = g++;
|
||||
lockq.lock();
|
||||
q.add(() ->
|
||||
{
|
||||
placeObject(m, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + gg) * i * j) + i - j + 1569962));
|
||||
});
|
||||
lockq.unlock();
|
||||
}
|
||||
|
||||
continue searching;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(IrisObjectPlacement k : b.getObjects())
|
||||
{
|
||||
int gg = g++;
|
||||
|
||||
@@ -50,7 +50,12 @@ public abstract class ParallelChunkGenerator extends BiomeChunkGenerator
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap);
|
||||
protected abstract void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap, int onlyY);
|
||||
|
||||
protected void onGenerateColumn(int cx, int cz, int wx, int wz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap)
|
||||
{
|
||||
onGenerateColumn(cx, cz, wx, wz, x, z, sliver, biomeMap, -1);
|
||||
}
|
||||
|
||||
protected abstract int onSampleColumnHeight(int cx, int cz, int wx, int wz, int x, int z);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import org.bukkit.block.data.Bisected;
|
||||
import org.bukkit.block.data.Bisected.Half;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.layer.GenLayerCave;
|
||||
import com.volmit.iris.object.DecorationPart;
|
||||
import com.volmit.iris.object.InferredType;
|
||||
@@ -62,8 +63,19 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onGenerateColumn(int cx, int cz, int rx, int rz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap)
|
||||
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
|
||||
{
|
||||
super.onGenerate(random, x, z, data, grid);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onGenerateColumn(int cx, int cz, int rx, int rz, int x, int z, AtomicSliver sliver, BiomeMap biomeMap, int onlyY)
|
||||
{
|
||||
if(x > 15 || x < 0 || z > 15 || z < 0)
|
||||
{
|
||||
throw new RuntimeException("Invalid OnGenerate call: x:" + x + " z:" + z);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
BlockData block;
|
||||
@@ -77,13 +89,27 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
int height = (int) Math.round(noise) + fluidHeight;
|
||||
IrisRegion region = sampleRegion(rx, rz);
|
||||
IrisBiome biome = sampleTrueBiome(rx, rz).getBiome();
|
||||
|
||||
if(biome == null)
|
||||
{
|
||||
throw new RuntimeException("Null Biome!");
|
||||
}
|
||||
|
||||
if(caching)
|
||||
{
|
||||
cacheLock.lock();
|
||||
cacheTrueBiome[(z << 4) | x] = biome;
|
||||
cacheHeightMap[(z << 4) | x] = height;
|
||||
cacheLock.unlock();
|
||||
try
|
||||
{
|
||||
cacheTrueBiome[(z << 4) | x] = biome;
|
||||
cacheHeightMap[(z << 4) | x] = height;
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
Iris.error("Failed to write cache at " + x + " " + z + " in chunk " + cx + " " + cz);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
KList<BlockData> layers = biome.generateLayers(wx, wz, masterRandom, height, height - getFluidHeight());
|
||||
KList<BlockData> seaLayers = biome.isSea() ? biome.generateSeaLayers(wx, wz, masterRandom, fluidHeight - height) : new KList<>();
|
||||
cacheInternalBiome(x, z, biome);
|
||||
@@ -100,12 +126,11 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
}
|
||||
}
|
||||
|
||||
// Set Biomes & Blocks from HEIGHT/FLUIDHEIGHT to 0
|
||||
for(int k = Math.max(height, fluidHeight); k >= 0; k--)
|
||||
{
|
||||
if(k == 0)
|
||||
{
|
||||
sliver.set(0, BEDROCK);
|
||||
sliver.set(k, BEDROCK);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -225,7 +250,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData d = i.getBlockData(getMasterRandom().nextParallelRNG(biome.hashCode() + j++), wx, wz);
|
||||
BlockData d = i.getBlockData(getMasterRandom().nextParallelRNG((int) (wx + wz + 38888 + biome.getRarity() + biome.getName().length() + j++)), wx, wz);
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -254,7 +279,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
|
||||
else
|
||||
{
|
||||
int stack = i.getHeight(getMasterRandom().nextParallelRNG(39456 + i.hashCode()), wx, wz);
|
||||
int stack = i.getHeight(getMasterRandom().nextParallelRNG((int) (39456 + (10000 * i.getChance()) + i.getStackMax() + i.getStackMin() + i.getZoom())), wx, wz);
|
||||
|
||||
if(stack == 1)
|
||||
{
|
||||
@@ -286,7 +311,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
|
||||
for(IrisBiomeDecorator i : biome.getDecorators())
|
||||
{
|
||||
BlockData d = i.getBlockData(getMasterRandom().nextParallelRNG(biome.hashCode() + j++), wx, wz);
|
||||
BlockData d = i.getBlockData(getMasterRandom().nextParallelRNG(2333877 + biome.getRarity() + biome.getName().length() + +j++), wx, wz);
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
@@ -315,7 +340,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
|
||||
else
|
||||
{
|
||||
int stack = i.getHeight(getMasterRandom().nextParallelRNG(39456 + i.hashCode()), wx, wz);
|
||||
int stack = i.getHeight(getMasterRandom().nextParallelRNG((int) (39456 + (1000 * i.getChance()) + i.getZoom() * 10)), wx, wz);
|
||||
|
||||
if(stack == 1)
|
||||
{
|
||||
@@ -357,11 +382,11 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
continue;
|
||||
}
|
||||
|
||||
BlockData d = i.getBlockData(getMasterRandom().nextParallelRNG(biome.hashCode() + j++), wx, wz);
|
||||
BlockData d = i.getBlockData(getMasterRandom().nextParallelRNG(2555 + biome.getRarity() + biome.getName().length() + j++), wx, wz);
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
int stack = i.getHeight(getMasterRandom().nextParallelRNG(39456 + i.hashCode()), wx, wz);
|
||||
int stack = i.getHeight(getMasterRandom().nextParallelRNG((int) (239456 + i.getStackMax() + i.getStackMin() + i.getVerticalZoom() + i.getZoom() + i.getBlockData().size() + j)), wx, wz);
|
||||
|
||||
if(stack == 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user