mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Localdata
This commit is contained in:
parent
60324c041c
commit
e5384509cf
@ -54,7 +54,7 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
{
|
||||
public static KList<GroupedExecutor> executors = new KList<>();
|
||||
public static Iris instance;
|
||||
public static IrisDataManager data;
|
||||
public static IrisDataManager globaldata;
|
||||
public static ProjectManager proj;
|
||||
public static IrisHotloadManager hotloader;
|
||||
public static WandController wand;
|
||||
@ -103,7 +103,7 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
lock = new IrisLock("Iris");
|
||||
instance = this;
|
||||
hotloader = new IrisHotloadManager();
|
||||
data = new IrisDataManager(getDataFolder());
|
||||
globaldata = new IrisDataManager(getDataFolder());
|
||||
wand = new WandController();
|
||||
postProcessors = loadPostProcessors();
|
||||
proj = new ProjectManager();
|
||||
@ -188,7 +188,7 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
lines.add(ChatColor.GREEN + "Generators" + ChatColor.GRAY + ": " + Form.f(CNG.creates));
|
||||
lines.add(ChatColor.GREEN + "Noise" + ChatColor.GRAY + ": " + Form.f((int) hits.getAverage()));
|
||||
lines.add(ChatColor.GREEN + "Parallax Chunks" + ChatColor.GRAY + ": " + Form.f((int) g.getParallaxMap().getLoadedChunks().size()));
|
||||
lines.add(ChatColor.GREEN + "Objects" + ChatColor.GRAY + ": " + Form.f(Iris.data.getObjectLoader().count()));
|
||||
lines.add(ChatColor.GREEN + "Objects" + ChatColor.GRAY + ": " + Form.f(g.getData().getObjectLoader().count()));
|
||||
lines.add(ChatColor.GREEN + "Memory" + ChatColor.GRAY + ": " + mem);
|
||||
|
||||
if(er != null && b != null)
|
||||
|
@ -53,7 +53,7 @@ public class IrisHotloadManager
|
||||
{
|
||||
watchers.clear();
|
||||
Iris.success("Hotloading Iris (" + c + " File" + (c == 1 ? "" : "s") + " changed)");
|
||||
Iris.data.hotloaded();
|
||||
Iris.globaldata.hotloaded();
|
||||
ch.onHotloaded();
|
||||
}
|
||||
});
|
||||
|
@ -58,7 +58,7 @@ public class ProjectManager
|
||||
|
||||
public void open(MortarSender sender, String dimm, Runnable onDone)
|
||||
{
|
||||
IrisDimension d = Iris.data.getDimensionLoader().load(dimm);
|
||||
IrisDimension d = Iris.globaldata.getDimensionLoader().load(dimm);
|
||||
J.attemptAsync(() ->
|
||||
{
|
||||
try
|
||||
@ -155,11 +155,11 @@ public class ProjectManager
|
||||
File folder = currentProject.getWorld().getWorldFolder();
|
||||
Bukkit.unloadWorld(currentProject.getWorld(), false);
|
||||
currentProject = null;
|
||||
Iris.data.getObjectLoader().clearCache();
|
||||
Iris.data.getBiomeLoader().clearCache();
|
||||
Iris.data.getRegionLoader().clearCache();
|
||||
Iris.data.getGeneratorLoader().clearCache();
|
||||
Iris.data.getDimensionLoader().clearCache();
|
||||
Iris.globaldata.getObjectLoader().clearCache();
|
||||
Iris.globaldata.getBiomeLoader().clearCache();
|
||||
Iris.globaldata.getRegionLoader().clearCache();
|
||||
Iris.globaldata.getGeneratorLoader().clearCache();
|
||||
Iris.globaldata.getDimensionLoader().clearCache();
|
||||
J.attemptAsync(() -> IO.delete(folder));
|
||||
}
|
||||
}
|
||||
@ -167,7 +167,7 @@ public class ProjectManager
|
||||
public void compilePackage(MortarSender sender, String dim, boolean obfuscate)
|
||||
{
|
||||
String dimm = dim;
|
||||
IrisDimension dimension = Iris.data.getDimensionLoader().load(dimm);
|
||||
IrisDimension dimension = Iris.globaldata.getDimensionLoader().load(dimm);
|
||||
File folder = new File(Iris.instance.getDataFolder(), "exports/" + dimension.getLoadKey());
|
||||
folder.mkdirs();
|
||||
Iris.info("Packaging Dimension " + dimension.getName() + " " + (obfuscate ? "(Obfuscated)" : ""));
|
||||
@ -175,11 +175,11 @@ public class ProjectManager
|
||||
KSet<IrisBiome> biomes = new KSet<>();
|
||||
KSet<IrisStructure> structures = new KSet<>();
|
||||
KSet<IrisGenerator> generators = new KSet<>();
|
||||
dimension.getRegions().forEach((i) -> regions.add(Iris.data.getRegionLoader().load(i)));
|
||||
regions.forEach((i) -> biomes.addAll(i.getAllBiomes()));
|
||||
biomes.forEach((i) -> i.getGenerators().forEach((j) -> generators.add(j.getCachedGenerator())));
|
||||
regions.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure())));
|
||||
biomes.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure())));
|
||||
dimension.getRegions().forEach((i) -> regions.add(Iris.globaldata.getRegionLoader().load(i)));
|
||||
regions.forEach((i) -> biomes.addAll(i.getAllBiomes(null)));
|
||||
biomes.forEach((i) -> i.getGenerators().forEach((j) -> generators.add(j.getCachedGenerator(null))));
|
||||
regions.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure(null))));
|
||||
biomes.forEach((i) -> i.getStructures().forEach((j) -> structures.add(j.getStructure(null))));
|
||||
KMap<String, String> renameObjects = new KMap<>();
|
||||
String a = "";
|
||||
StringBuilder b = new StringBuilder();
|
||||
@ -242,7 +242,7 @@ public class ProjectManager
|
||||
{
|
||||
try
|
||||
{
|
||||
File f = Iris.data.getObjectLoader().findFile(lookupObjects.get(k).get(0));
|
||||
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
|
||||
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
|
||||
gb.append(IO.hash(f));
|
||||
}
|
||||
@ -257,7 +257,7 @@ public class ProjectManager
|
||||
{
|
||||
try
|
||||
{
|
||||
File f = Iris.data.getObjectLoader().findFile(lookupObjects.get(k).get(0));
|
||||
File f = Iris.globaldata.getObjectLoader().findFile(lookupObjects.get(k).get(0));
|
||||
IO.copyFile(f, new File(folder, "objects/" + k + ".iob"));
|
||||
gb.append(IO.hash(f));
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class CommandIrisGoto extends MortarCommand
|
||||
|
||||
else
|
||||
{
|
||||
biome2 = Iris.data.getBiomeLoader().load(args[1]);
|
||||
biome2 = g.loadBiome(args[1]);
|
||||
|
||||
if(biome2 == null)
|
||||
{
|
||||
@ -72,7 +72,7 @@ public class CommandIrisGoto extends MortarCommand
|
||||
}
|
||||
}
|
||||
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(args[0]);
|
||||
IrisBiome biome = g.loadBiome(args[0]);
|
||||
|
||||
if(biome == null)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ public class CommandIrisStudioList extends MortarCommand
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
int m = 0;
|
||||
for(File i : Iris.data.getDimensionLoader().getFolders())
|
||||
for(File i : Iris.globaldata.getDimensionLoader().getFolders())
|
||||
{
|
||||
for(File j : i.listFiles())
|
||||
{
|
||||
@ -30,7 +30,7 @@ public class CommandIrisStudioList extends MortarCommand
|
||||
try
|
||||
{
|
||||
m++;
|
||||
IrisDimension d = Iris.data.getDimensionLoader().load(j.getName().replaceAll("\\Q.json\\E", ""));
|
||||
IrisDimension d = Iris.globaldata.getDimensionLoader().load(j.getName().replaceAll("\\Q.json\\E", ""));
|
||||
sender.sendMessage("- " + d.getLoadKey() + " (" + d.getName() + ")");
|
||||
}
|
||||
catch(Throwable e)
|
||||
|
@ -183,7 +183,7 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
|
||||
|
||||
for(String i : dim.getRegions())
|
||||
{
|
||||
IrisRegion r = Iris.data.getRegionLoader().load(i);
|
||||
IrisRegion r = loadRegion(i);
|
||||
|
||||
if(r != null)
|
||||
{
|
||||
@ -202,8 +202,8 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
|
||||
if(!touch.contains(next))
|
||||
{
|
||||
touch.add(next);
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(next);
|
||||
biome.getGenerators().forEach((i) -> registerGenerator(i.getCachedGenerator(), dim));
|
||||
IrisBiome biome = loadBiome(next);
|
||||
biome.getGenerators().forEach((i) -> registerGenerator(i.getCachedGenerator(this), dim));
|
||||
loadQueue.addAll(biome.getChildren());
|
||||
}
|
||||
}
|
||||
@ -220,11 +220,11 @@ public abstract class BiomeChunkGenerator extends DimensionChunkGenerator
|
||||
{
|
||||
if(!getDimension().getFocus().equals(""))
|
||||
{
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(getDimension().getFocus());
|
||||
IrisBiome biome = loadBiome(getDimension().getFocus());
|
||||
|
||||
for(String i : getDimension().getRegions())
|
||||
{
|
||||
IrisRegion reg = Iris.data.getRegionLoader().load(i);
|
||||
IrisRegion reg = loadRegion(i);
|
||||
|
||||
if(reg.getLandBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ package com.volmit.iris.gen;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.util.InvertedBiomeGrid;
|
||||
import com.volmit.iris.util.RNG;
|
||||
@ -93,7 +92,7 @@ public abstract class CeilingChunkGenerator extends PostBlockChunkGenerator
|
||||
return null;
|
||||
}
|
||||
|
||||
IrisDimension c = Iris.data.getDimensionLoader().load(getFloorDimension().getCeiling());
|
||||
IrisDimension c = loadDimension(getFloorDimension().getCeiling());
|
||||
|
||||
if(c != null)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.volmit.iris.gen;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@ -22,7 +23,14 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisContext;
|
||||
import com.volmit.iris.IrisDataManager;
|
||||
import com.volmit.iris.IrisMetrics;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.object.IrisStructure;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
@ -38,6 +46,7 @@ import net.md_5.bungee.api.ChatColor;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public abstract class ContextualChunkGenerator extends ChunkGenerator implements Listener
|
||||
{
|
||||
private IrisDataManager data;
|
||||
protected boolean failing;
|
||||
protected int task;
|
||||
protected boolean dev;
|
||||
@ -86,6 +95,41 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
|
||||
|
||||
protected abstract void onPlayerLeft(Player p);
|
||||
|
||||
public IrisRegion loadRegion(String i)
|
||||
{
|
||||
return getData().getRegionLoader().load(i);
|
||||
}
|
||||
|
||||
public IrisBiome loadBiome(String i)
|
||||
{
|
||||
return getData().getBiomeLoader().load(i);
|
||||
}
|
||||
|
||||
public IrisStructure loadStructure(String i)
|
||||
{
|
||||
return getData().getStructureLoader().load(i);
|
||||
}
|
||||
|
||||
public IrisObject loadObject(String i)
|
||||
{
|
||||
return getData().getObjectLoader().load(i);
|
||||
}
|
||||
|
||||
public IrisDimension loadDimension(String i)
|
||||
{
|
||||
return getData().getDimensionLoader().load(i);
|
||||
}
|
||||
|
||||
public IrisGenerator loadGenerator(String i)
|
||||
{
|
||||
return getData().getGeneratorLoader().load(i);
|
||||
}
|
||||
|
||||
public IrisDataManager getData()
|
||||
{
|
||||
return isDev() ? Iris.globaldata : data;
|
||||
}
|
||||
|
||||
private void init(World world, RNG rng)
|
||||
{
|
||||
if(initialized)
|
||||
@ -93,6 +137,7 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
|
||||
return;
|
||||
}
|
||||
|
||||
data = new IrisDataManager(new File(getWorld().getWorldFolder(), "iris"));
|
||||
this.world = world;
|
||||
this.masterRandom = new RNG(world.getSeed());
|
||||
metrics = new IrisMetrics(128);
|
||||
|
@ -31,7 +31,7 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
|
||||
|
||||
public IrisDimension getDimension()
|
||||
{
|
||||
IrisDimension d = Iris.data.getDimensionLoader().load(dimensionName);
|
||||
IrisDimension d = loadDimension(dimensionName);
|
||||
|
||||
if(d == null)
|
||||
{
|
||||
@ -43,11 +43,11 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
|
||||
|
||||
protected BiomeResult focus()
|
||||
{
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(getDimension().getFocus());
|
||||
IrisBiome biome = loadBiome(getDimension().getFocus());
|
||||
|
||||
for(String i : getDimension().getRegions())
|
||||
{
|
||||
IrisRegion reg = Iris.data.getRegionLoader().load(i);
|
||||
IrisRegion reg = loadRegion(i);
|
||||
|
||||
if(reg.getLandBiomes().contains(biome.getLoadKey()))
|
||||
{
|
||||
|
@ -35,6 +35,12 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
lock = new IrisLock("IrisChunkGenerator");
|
||||
}
|
||||
|
||||
public IrisChunkGenerator(String dimensionName)
|
||||
{
|
||||
super(dimensionName, 16);
|
||||
lock = new IrisLock("IrisChunkGenerator");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
|
||||
{
|
||||
@ -149,7 +155,7 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
|
||||
public long guessMemoryUsage()
|
||||
{
|
||||
long bytes = 1024 * 1024 * (8 + (getThreads() / 4));
|
||||
long bytes = 1024 * 1024 * (8 + (getThreads() / 3));
|
||||
|
||||
for(AtomicRegionData i : parallaxMap.getLoadedRegions().values())
|
||||
{
|
||||
@ -164,7 +170,7 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
bytes += parallaxMap.getLoadedChunks().size() * 256 * 4 * 460;
|
||||
bytes += ceilingParallaxMap.getLoadedChunks().size() * 256 * 4 * 460;
|
||||
bytes += getSliverBuffer() * 220;
|
||||
bytes += 752 * Iris.data.getObjectLoader().getTotalStorage();
|
||||
bytes += 823 * getData().getObjectLoader().getTotalStorage();
|
||||
|
||||
return bytes;
|
||||
}
|
||||
@ -190,6 +196,6 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
@Override
|
||||
public boolean shouldGenerateStructures()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import java.io.IOException;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.atomics.AtomicSliver;
|
||||
import com.volmit.iris.gen.atomics.AtomicSliverMap;
|
||||
import com.volmit.iris.gen.atomics.AtomicWorldData;
|
||||
@ -194,7 +193,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
getMetrics().getParallax().put(p.getMilliseconds());
|
||||
super.onPostParallaxPostGenerate(random, x, z, data, grid, height, biomeMap);
|
||||
getParallaxMap().clean(ticks);
|
||||
Iris.data.getObjectLoader().clean();
|
||||
getData().getObjectLoader().clean();
|
||||
}
|
||||
|
||||
public IrisStructureResult getStructure(int x, int y, int z)
|
||||
@ -209,13 +208,13 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
{
|
||||
if(i.getHeight() > -1)
|
||||
{
|
||||
if(y >= i.getHeight() && y <= i.getHeight() + (i.getStructure().getGridHeight() * i.getStructure().getMaxLayers()))
|
||||
if(y >= i.getHeight() && y <= i.getHeight() + (i.getStructure(this).getGridHeight() * i.getStructure(this).getMaxLayers()))
|
||||
{
|
||||
p.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
else if(y >= h && y <= i.getStructure().getGridHeight() + h)
|
||||
else if(y >= h && y <= i.getStructure(this).getGridHeight() + h)
|
||||
{
|
||||
p.add(i);
|
||||
}
|
||||
@ -225,13 +224,13 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
{
|
||||
if(i.getHeight() > -1)
|
||||
{
|
||||
if(y >= i.getHeight() && y <= i.getHeight() + (i.getStructure().getGridHeight() * i.getStructure().getMaxLayers()))
|
||||
if(y >= i.getHeight() && y <= i.getHeight() + (i.getStructure(this).getGridHeight() * i.getStructure(this).getMaxLayers()))
|
||||
{
|
||||
p.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
else if(y >= h && y <= i.getStructure().getGridHeight() + h)
|
||||
else if(y >= h && y <= i.getStructure(this).getGridHeight() + h)
|
||||
{
|
||||
p.add(i);
|
||||
}
|
||||
@ -244,12 +243,12 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
continue;
|
||||
}
|
||||
|
||||
int hv = (i.getHeight() == -1 ? 0 : i.getHeight()) + (Math.floorDiv(y, i.getStructure().getGridHeight()) * i.getStructure().getGridHeight());
|
||||
TileResult tile = i.getStructure().getTile(ro, Math.floorDiv(i.gridSize(), x) * i.gridSize(), hv, Math.floorDiv(i.gridSize(), z) * i.gridSize());
|
||||
int hv = (i.getHeight() == -1 ? 0 : i.getHeight()) + (Math.floorDiv(y, i.getStructure(this).getGridHeight()) * i.getStructure(this).getGridHeight());
|
||||
TileResult tile = i.getStructure(this).getTile(ro, Math.floorDiv(i.gridSize(this), x) * i.gridSize(this), hv, Math.floorDiv(i.gridSize(this), z) * i.gridSize(this));
|
||||
|
||||
if(tile != null && tile.getTile() != null)
|
||||
{
|
||||
return new IrisStructureResult(tile.getTile(), i.getStructure());
|
||||
return new IrisStructureResult(tile.getTile(), i.getStructure(this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,7 +258,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
protected void onGenerateParallax(RNG random, int x, int z)
|
||||
{
|
||||
String key = "par." + x + "." + "z";
|
||||
ChunkPosition rad = getDimension().getParallaxSize();
|
||||
ChunkPosition rad = getDimension().getParallaxSize(this);
|
||||
KList<NastyRunnable> q = new KList<>();
|
||||
|
||||
for(int ii = x - (rad.getX() / 2); ii <= x + (rad.getX() / 2); ii++)
|
||||
@ -299,7 +298,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.getRealSideA().contains(sa.getLoadKey()) && k.getRealSideB().contains(sb.getLoadKey()))
|
||||
if(k.getRealSideA(this).contains(sa.getLoadKey()) && k.getRealSideB(this).contains(sb.getLoadKey()))
|
||||
{
|
||||
for(IrisObjectPlacement m : k.getObjects())
|
||||
{
|
||||
@ -321,18 +320,20 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
|
||||
for(IrisStructurePlacement k : r.getStructures())
|
||||
{
|
||||
lockq.lock();
|
||||
q.add(() ->
|
||||
{
|
||||
k.place(this, random, i, j);
|
||||
k.place(this, random.nextParallelRNG(2228), i, j);
|
||||
});
|
||||
lockq.unlock();
|
||||
}
|
||||
|
||||
for(IrisStructurePlacement k : b.getStructures())
|
||||
{
|
||||
lockq.lock();
|
||||
q.add(() ->
|
||||
{
|
||||
k.place(this, random, i, j);
|
||||
k.place(this, random.nextParallelRNG(-22228), i, j);
|
||||
});
|
||||
lockq.unlock();
|
||||
}
|
||||
@ -399,7 +400,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
for(int i = 0; i < o.getTriesForChunk(rng); i++)
|
||||
{
|
||||
rng = rng.nextParallelRNG((i * 3 + 8) - 23040);
|
||||
o.getSchematic(rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng);
|
||||
o.getSchematic(this, rng).place((x * 16) + rng.nextInt(16), (z * 16) + rng.nextInt(16), this, o, rng);
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +418,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
|
||||
continue;
|
||||
}
|
||||
|
||||
o.getSchematic(rng).place(xx, res.get(rng.nextParallelRNG(29345 * (i + 234)).nextInt(res.size())).getFloor() + 2, zz, this, o, rng);
|
||||
o.getSchematic(this, rng).place(xx, res.get(rng.nextParallelRNG(29345 * (i + 234)).nextInt(res.size())).getFloor() + 2, zz, this, o, rng);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.volmit.iris.gen.layer;
|
||||
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.object.InferredType;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.RarityCellGenerator;
|
||||
@ -22,14 +23,14 @@ public class BiomeDataProvider
|
||||
generator = new RarityCellGenerator(rng.nextParallelRNG(4645079 + (type.ordinal() * 23845)));
|
||||
}
|
||||
|
||||
public BiomeResult generatePureData(double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
public BiomeResult generatePureData(ContextualChunkGenerator g, double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
getGenerator().setShuffle(regionData.getBiomeShuffle());
|
||||
return layer.generateBiomeData(bx, bz, regionData, getGenerator(), regionData.getBiomes(getType()), getType());
|
||||
return layer.generateBiomeData(bx, bz, regionData, getGenerator(), regionData.getBiomes(g, getType()), getType());
|
||||
}
|
||||
|
||||
public BiomeResult generateData(double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
public BiomeResult generateData(ContextualChunkGenerator g, double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
return layer.generateImpureData(rawX, rawZ, getType(), regionData, generatePureData(bx, bz, rawX, rawZ, regionData));
|
||||
return layer.generateImpureData(rawX, rawZ, getType(), regionData, generatePureData(g, bx, bz, rawX, rawZ, regionData));
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class GenLayerBiome extends GenLayer
|
||||
double z = bz / iris.getDimension().getBiomeZoom();
|
||||
String regionId = iris.getDimension().getRegions().get(regionGenerator.getIndex(x, z, iris.getDimension().getRegions().size()));
|
||||
|
||||
return Iris.data.getRegionLoader().load(regionId);
|
||||
return iris.loadRegion(regionId);
|
||||
}
|
||||
|
||||
public BiomeResult generateData(double bx, double bz, int rawX, int rawZ)
|
||||
@ -69,7 +69,7 @@ public class GenLayerBiome extends GenLayer
|
||||
|
||||
public BiomeResult generateData(InferredType type, double bx, double bz, int rawX, int rawZ, IrisRegion regionData)
|
||||
{
|
||||
return getProvider(type).generateData(bx, bz, rawX, rawZ, regionData);
|
||||
return getProvider(type).generateData(iris, bx, bz, rawX, rawZ, regionData);
|
||||
}
|
||||
|
||||
public BiomeDataProvider getProvider(InferredType type)
|
||||
@ -147,7 +147,7 @@ public class GenLayerBiome extends GenLayer
|
||||
{
|
||||
if(i.getType().equals(type) && i.isRidge(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()).infer(i.getAs(), type), 0.5);
|
||||
return new BiomeResult(iris.loadBiome(i.getBiome()).infer(i.getAs(), type), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ public class GenLayerBiome extends GenLayer
|
||||
{
|
||||
if(i.getType().equals(type) && i.isSpot(rng, rawX, rawZ))
|
||||
{
|
||||
return new BiomeResult(Iris.data.getBiomeLoader().load(i.getBiome()).infer(i.getAs(), type), 0.5);
|
||||
return new BiomeResult(iris.loadBiome(i.getBiome()).infer(i.getAs(), type), 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
@ -179,10 +179,10 @@ public class GenLayerBiome extends GenLayer
|
||||
|
||||
if(parent.getDistance() > regionData.getBiomeImplosionRatio())
|
||||
{
|
||||
if(!parent.getBiome().getRealChildren().isEmpty())
|
||||
if(!parent.getBiome().getRealChildren(iris).isEmpty())
|
||||
{
|
||||
RarityCellGenerator childCell = parent.getBiome().getChildrenGenerator(rng, 123, parentCell.getCellScale() * parent.getBiome().getChildShrinkFactor());
|
||||
KList<IrisBiome> chx = parent.getBiome().getRealChildren().copy();
|
||||
KList<IrisBiome> chx = parent.getBiome().getRealChildren(iris).copy();
|
||||
chx.add(parent.getBiome());
|
||||
IrisBiome biome = childCell.get(x, z, chx);
|
||||
biome.setInferredType(parent.getBiome().getInferredType());
|
||||
|
@ -4,6 +4,7 @@ import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.RarityCellGenerator;
|
||||
import com.volmit.iris.util.CNG;
|
||||
@ -111,13 +112,13 @@ public class IrisBiome extends IrisRegistrant
|
||||
|
||||
}
|
||||
|
||||
public double getHeight(double x, double z, long seed)
|
||||
public double getHeight(ContextualChunkGenerator xg, double x, double z, long seed)
|
||||
{
|
||||
double height = 0;
|
||||
|
||||
for(IrisBiomeGeneratorLink i : generators)
|
||||
{
|
||||
height += i.getHeight(x, z, seed);
|
||||
height += i.getHeight(xg, x, z, seed);
|
||||
}
|
||||
|
||||
return Math.max(0, Math.min(height, 255));
|
||||
@ -380,7 +381,7 @@ public class IrisBiome extends IrisRegistrant
|
||||
return biomeSkyScatter.get(getBiomeGenerator(rng).fit(0, biomeSkyScatter.size() - 1, x, y, z));
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealChildren()
|
||||
public KList<IrisBiome> getRealChildren(ContextualChunkGenerator g)
|
||||
{
|
||||
return realChildren.aquire(() ->
|
||||
{
|
||||
@ -388,14 +389,14 @@ public class IrisBiome extends IrisRegistrant
|
||||
|
||||
for(String i : getChildren())
|
||||
{
|
||||
realChildren.add(Iris.data.getBiomeLoader().load(i));
|
||||
realChildren.add(g != null ? g.loadBiome(i) : Iris.globaldata.getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realChildren;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<String> getAllChildren(int limit)
|
||||
public KList<String> getAllChildren(ContextualChunkGenerator g, int limit)
|
||||
{
|
||||
KSet<String> m = new KSet<>();
|
||||
m.addAll(getChildren());
|
||||
@ -405,9 +406,9 @@ public class IrisBiome extends IrisRegistrant
|
||||
{
|
||||
for(String i : getChildren())
|
||||
{
|
||||
IrisBiome b = Iris.data.getBiomeLoader().load(i);
|
||||
IrisBiome b = g != null ? g.loadBiome(i) : Iris.globaldata.getBiomeLoader().load(i);
|
||||
int l = limit;
|
||||
m.addAll(b.getAllChildren(l));
|
||||
m.addAll(b.getAllChildren(g, l));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
@ -31,11 +32,11 @@ public class IrisBiomeGeneratorLink
|
||||
|
||||
}
|
||||
|
||||
public IrisGenerator getCachedGenerator()
|
||||
public IrisGenerator getCachedGenerator(ContextualChunkGenerator g)
|
||||
{
|
||||
return gen.aquire(() ->
|
||||
{
|
||||
IrisGenerator gen = Iris.data.getGeneratorLoader().load(getGenerator());
|
||||
IrisGenerator gen = g != null ? g.loadGenerator(getGenerator()) : Iris.globaldata.getGeneratorLoader().load(getGenerator());
|
||||
|
||||
if(gen == null)
|
||||
{
|
||||
@ -46,9 +47,9 @@ public class IrisBiomeGeneratorLink
|
||||
});
|
||||
}
|
||||
|
||||
public double getHeight(double x, double z, long seed)
|
||||
public double getHeight(ContextualChunkGenerator xg, double x, double z, long seed)
|
||||
{
|
||||
double g = getCachedGenerator().getHeight(x, z, seed);
|
||||
double g = getCachedGenerator(xg).getHeight(x, z, seed);
|
||||
g = g < 0 ? 0 : g;
|
||||
g = g > 1 ? 1 : g;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
@ -36,17 +36,17 @@ public class IrisBiomeMutation
|
||||
private transient AtomicCache<KList<String>> sideACache = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<String>> sideBCache = new AtomicCache<>();
|
||||
|
||||
public KList<String> getRealSideA()
|
||||
public KList<String> getRealSideA(ContextualChunkGenerator xg)
|
||||
{
|
||||
return sideACache.aquire(() -> processList(getSideA()));
|
||||
return sideACache.aquire(() -> processList(xg, getSideA()));
|
||||
}
|
||||
|
||||
public KList<String> getRealSideB()
|
||||
public KList<String> getRealSideB(ContextualChunkGenerator xg)
|
||||
{
|
||||
return sideBCache.aquire(() -> processList(getSideB()));
|
||||
return sideBCache.aquire(() -> processList(xg, getSideB()));
|
||||
}
|
||||
|
||||
public KList<String> processList(KList<String> s)
|
||||
public KList<String> processList(ContextualChunkGenerator xg, KList<String> s)
|
||||
{
|
||||
KSet<String> r = new KSet<>();
|
||||
|
||||
@ -56,14 +56,14 @@ public class IrisBiomeMutation
|
||||
|
||||
if(q.startsWith("^"))
|
||||
{
|
||||
r.addAll(Iris.data.getRegionLoader().load(q.substring(1)).getLandBiomes());
|
||||
r.addAll(xg.loadRegion(q.substring(1)).getLandBiomes());
|
||||
continue;
|
||||
}
|
||||
|
||||
else if(q.startsWith("*"))
|
||||
{
|
||||
String name = q.substring(1);
|
||||
r.addAll(Iris.data.getBiomeLoader().load(name).getAllChildren(7));
|
||||
r.addAll(xg.loadBiome(name).getAllChildren(xg, 7));
|
||||
}
|
||||
|
||||
else if(q.startsWith("!"))
|
||||
@ -74,7 +74,7 @@ public class IrisBiomeMutation
|
||||
else if(q.startsWith("!*"))
|
||||
{
|
||||
String name = q.substring(2);
|
||||
r.removeAll(Iris.data.getBiomeLoader().load(name).getAllChildren(7));
|
||||
r.removeAll(xg.loadBiome(name).getAllChildren(xg, 7));
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -6,6 +6,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.B;
|
||||
@ -548,31 +549,31 @@ public class IrisDimension extends IrisRegistrant
|
||||
return cosr.aquire(() -> Math.cos(getDimensionAngle()));
|
||||
}
|
||||
|
||||
public KList<IrisRegion> getAllRegions()
|
||||
public KList<IrisRegion> getAllRegions(ContextualChunkGenerator g)
|
||||
{
|
||||
KList<IrisRegion> r = new KList<>();
|
||||
|
||||
for(String i : getRegions())
|
||||
{
|
||||
r.add(Iris.data.getRegionLoader().load(i));
|
||||
r.add(g != null ? g.loadRegion(i) : Iris.globaldata.getRegionLoader().load(i));
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getAllBiomes()
|
||||
public KList<IrisBiome> getAllBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
KList<IrisBiome> r = new KList<>();
|
||||
|
||||
for(IrisRegion i : getAllRegions())
|
||||
for(IrisRegion i : getAllRegions(g))
|
||||
{
|
||||
r.addAll(i.getAllBiomes());
|
||||
r.addAll(i.getAllBiomes(g));
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public ChunkPosition getParallaxSize()
|
||||
public ChunkPosition getParallaxSize(ContextualChunkGenerator g)
|
||||
{
|
||||
return parallaxSize.aquire(() ->
|
||||
{
|
||||
@ -580,8 +581,8 @@ public class IrisDimension extends IrisRegistrant
|
||||
int z = 0;
|
||||
|
||||
KSet<String> objects = new KSet<>();
|
||||
KList<IrisRegion> r = getAllRegions();
|
||||
KList<IrisBiome> b = getAllBiomes();
|
||||
KList<IrisRegion> r = getAllRegions(g);
|
||||
KList<IrisBiome> b = getAllBiomes(g);
|
||||
|
||||
for(IrisBiome i : b)
|
||||
{
|
||||
@ -595,7 +596,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
{
|
||||
try
|
||||
{
|
||||
BlockVector bv = IrisObject.sampleSize(Iris.data.getObjectLoader().findFile(i));
|
||||
BlockVector bv = IrisObject.sampleSize(g.getData().getObjectLoader().findFile(i));
|
||||
x = bv.getBlockX() > x ? bv.getBlockX() : x;
|
||||
z = bv.getBlockZ() > z ? bv.getBlockZ() : z;
|
||||
}
|
||||
|
@ -150,11 +150,11 @@ public class IrisObject extends IrisRegistrant
|
||||
|
||||
if(config.isBore())
|
||||
{
|
||||
for(int i = x - Math.floorDiv(w, 2); i <= x + Math.floorDiv(w, 2); i++)
|
||||
for(int i = x - Math.floorDiv(w, 2); i <= x + Math.floorDiv(w, 2) - (w % 2 == 0 ? 1 : 0); i++)
|
||||
{
|
||||
for(int j = y - 1; j <= y + h - 2; j++)
|
||||
for(int j = y - Math.floorDiv(h, 2); j <= y + Math.floorDiv(h, 2) - (h % 2 == 0 ? 1 : 0); j++)
|
||||
{
|
||||
for(int k = z - Math.floorDiv(d, 2); k <= z + Math.floorDiv(d, 2); k++)
|
||||
for(int k = z - Math.floorDiv(d, 2); k <= z + Math.floorDiv(d, 2) - (d % 2 == 0 ? 1 : 0); k++)
|
||||
{
|
||||
placer.set(i, j, k, AIR);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
@ -64,14 +65,14 @@ public class IrisObjectPlacement
|
||||
|
||||
}
|
||||
|
||||
public IrisObject getSchematic(RNG random)
|
||||
public IrisObject getSchematic(ContextualChunkGenerator g, RNG random)
|
||||
{
|
||||
if(place.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Iris.data.getObjectLoader().load(place.get(random.nextInt(place.size())));
|
||||
return (g == null ? Iris.globaldata : g.getData()).getObjectLoader().load(place.get(random.nextInt(place.size())));
|
||||
}
|
||||
|
||||
public int getTriesForChunk(RNG random)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.Desc;
|
||||
@ -176,7 +177,7 @@ public class IrisRegion extends IrisRegistrant
|
||||
return getShoreHeightGenerator().fitDoubleD(shoreHeightMin, shoreHeightMax, x / shoreHeightZoom, z / shoreHeightZoom);
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getAllBiomes()
|
||||
public KList<IrisBiome> getAllBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
KMap<String, IrisBiome> b = new KMap<>();
|
||||
KSet<String> names = new KSet<>();
|
||||
@ -196,7 +197,7 @@ public class IrisRegion extends IrisRegistrant
|
||||
continue;
|
||||
}
|
||||
|
||||
IrisBiome biome = Iris.data.getBiomeLoader().load(i);
|
||||
IrisBiome biome = (g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i);
|
||||
b.put(biome.getLoadKey(), biome);
|
||||
names.remove(i);
|
||||
names.addAll(biome.getChildren());
|
||||
@ -206,42 +207,42 @@ public class IrisRegion extends IrisRegistrant
|
||||
return b.v();
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getBiomes(InferredType type)
|
||||
public KList<IrisBiome> getBiomes(ContextualChunkGenerator g, InferredType type)
|
||||
{
|
||||
if(type.equals(InferredType.LAND))
|
||||
{
|
||||
return getRealLandBiomes();
|
||||
return getRealLandBiomes(g);
|
||||
}
|
||||
|
||||
else if(type.equals(InferredType.SEA))
|
||||
{
|
||||
return getRealSeaBiomes();
|
||||
return getRealSeaBiomes(g);
|
||||
}
|
||||
|
||||
else if(type.equals(InferredType.SHORE))
|
||||
{
|
||||
return getRealShoreBiomes();
|
||||
return getRealShoreBiomes(g);
|
||||
}
|
||||
|
||||
else if(type.equals(InferredType.CAVE))
|
||||
{
|
||||
return getRealCaveBiomes();
|
||||
return getRealCaveBiomes(g);
|
||||
}
|
||||
|
||||
else if(type.equals(InferredType.ISLAND))
|
||||
{
|
||||
return getRealIslandBiomes();
|
||||
return getRealIslandBiomes(g);
|
||||
}
|
||||
|
||||
else if(type.equals(InferredType.SKYLAND))
|
||||
{
|
||||
return getRealSkylandBiomes();
|
||||
return getRealSkylandBiomes(g);
|
||||
}
|
||||
|
||||
return new KList<>();
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealCaveBiomes()
|
||||
public KList<IrisBiome> getRealCaveBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realCaveBiomes.aquire(() ->
|
||||
{
|
||||
@ -249,14 +250,14 @@ public class IrisRegion extends IrisRegistrant
|
||||
|
||||
for(String i : getCaveBiomes())
|
||||
{
|
||||
realCaveBiomes.add(Iris.data.getBiomeLoader().load(i));
|
||||
realCaveBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realCaveBiomes;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealSkylandBiomes()
|
||||
public KList<IrisBiome> getRealSkylandBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realSkylandBiomes.aquire(() ->
|
||||
{
|
||||
@ -264,14 +265,14 @@ public class IrisRegion extends IrisRegistrant
|
||||
|
||||
for(String i : getSkylandBiomes())
|
||||
{
|
||||
realSkylandBiomes.add(Iris.data.getBiomeLoader().load(i));
|
||||
realSkylandBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realSkylandBiomes;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealIslandBiomes()
|
||||
public KList<IrisBiome> getRealIslandBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realIslandBiomes.aquire(() ->
|
||||
{
|
||||
@ -279,14 +280,14 @@ public class IrisRegion extends IrisRegistrant
|
||||
|
||||
for(String i : getIslandBiomes())
|
||||
{
|
||||
realIslandBiomes.add(Iris.data.getBiomeLoader().load(i));
|
||||
realIslandBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realIslandBiomes;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealShoreBiomes()
|
||||
public KList<IrisBiome> getRealShoreBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realShoreBiomes.aquire(() ->
|
||||
{
|
||||
@ -294,14 +295,14 @@ public class IrisRegion extends IrisRegistrant
|
||||
|
||||
for(String i : getShoreBiomes())
|
||||
{
|
||||
realShoreBiomes.add(Iris.data.getBiomeLoader().load(i));
|
||||
realShoreBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realShoreBiomes;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealSeaBiomes()
|
||||
public KList<IrisBiome> getRealSeaBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realSeaBiomes.aquire(() ->
|
||||
{
|
||||
@ -309,14 +310,14 @@ public class IrisRegion extends IrisRegistrant
|
||||
|
||||
for(String i : getSeaBiomes())
|
||||
{
|
||||
realSeaBiomes.add(Iris.data.getBiomeLoader().load(i));
|
||||
realSeaBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realSeaBiomes;
|
||||
});
|
||||
}
|
||||
|
||||
public KList<IrisBiome> getRealLandBiomes()
|
||||
public KList<IrisBiome> getRealLandBiomes(ContextualChunkGenerator g)
|
||||
{
|
||||
return realLandBiomes.aquire(() ->
|
||||
{
|
||||
@ -324,7 +325,7 @@ public class IrisRegion extends IrisRegistrant
|
||||
|
||||
for(String i : getLandBiomes())
|
||||
{
|
||||
realLandBiomes.add(Iris.data.getBiomeLoader().load(i));
|
||||
realLandBiomes.add((g == null ? Iris.globaldata : g.getData()).getBiomeLoader().load(i));
|
||||
}
|
||||
|
||||
return realLandBiomes;
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.ParallaxChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.CellGenerator;
|
||||
@ -52,20 +53,20 @@ public class IrisStructurePlacement
|
||||
{
|
||||
RNG rng = g.getMasterRandom().nextParallelRNG(-88738456);
|
||||
RNG rnp = rng.nextParallelRNG(cx - (cz * cz));
|
||||
int s = gridSize() - (getStructure().isMergeEdges() ? 1 : 0);
|
||||
int sh = gridHeight() - (getStructure().isMergeEdges() ? 1 : 0);
|
||||
int s = gridSize(g) - (getStructure(g).isMergeEdges() ? 1 : 0);
|
||||
int sh = gridHeight(g) - (getStructure(g).isMergeEdges() ? 1 : 0);
|
||||
|
||||
for(int i = cx << 4; i < (cx << 4) + 15; i += Math.max(s / 2, 1))
|
||||
for(int i = cx << 4; i < (cx << 4) + 15; i += Math.max(s, 1))
|
||||
{
|
||||
for(int j = cz << 4; j < (cz << 4) + 15; j += Math.max(s / 2, 1))
|
||||
for(int j = cz << 4; j < (cz << 4) + 15; j += Math.max(s, 1))
|
||||
{
|
||||
if(getStructure().getMaxLayers() <= 1)
|
||||
if(getStructure(g).getMaxLayers() <= 1)
|
||||
{
|
||||
placeLayer(g, rng, rnp, i, 0, j, s, sh);
|
||||
continue;
|
||||
}
|
||||
|
||||
for(int k = 0; k < s * getStructure().getMaxLayers(); k += Math.max(sh, 1))
|
||||
for(int k = 0; k < s * getStructure(g).getMaxLayers(); k += Math.max(sh, 1))
|
||||
{
|
||||
placeLayer(g, rng, rnp, i, k, j, s, sh);
|
||||
}
|
||||
@ -87,7 +88,7 @@ public class IrisStructurePlacement
|
||||
}
|
||||
|
||||
int h = (height == -1 ? 0 : height) + (Math.floorDiv(k, sh) * sh);
|
||||
TileResult t = getStructure().getTile(rng, i, h, j);
|
||||
TileResult t = getStructure(g).getTile(rng, i, h, j);
|
||||
|
||||
if(t != null)
|
||||
{
|
||||
@ -96,7 +97,7 @@ public class IrisStructurePlacement
|
||||
t.getPlacement().setBore(true);
|
||||
}
|
||||
|
||||
IrisObject o = load(t.getTile().getObjects().get(rnp.nextInt(t.getTile().getObjects().size())));
|
||||
IrisObject o = load(g, t.getTile().getObjects().get(rnp.nextInt(t.getTile().getObjects().size())));
|
||||
o.place(Math.floorDiv(i, s) * s, height == -1 ? -1 : h, Math.floorDiv(j, s) * s, g, t.getPlacement(), rng);
|
||||
}
|
||||
}
|
||||
@ -106,24 +107,24 @@ public class IrisStructurePlacement
|
||||
return config.aquire(() -> new IrisObjectPlacement());
|
||||
}
|
||||
|
||||
public IrisObject load(String s)
|
||||
public IrisObject load(ContextualChunkGenerator g, String s)
|
||||
{
|
||||
return Iris.data.getObjectLoader().load(s);
|
||||
return g.getData().getObjectLoader().load(s);
|
||||
}
|
||||
|
||||
public int gridSize()
|
||||
public int gridSize(ContextualChunkGenerator g)
|
||||
{
|
||||
return getStructure().getGridSize();
|
||||
return getStructure(g).getGridSize();
|
||||
}
|
||||
|
||||
public int gridHeight()
|
||||
public int gridHeight(ContextualChunkGenerator g)
|
||||
{
|
||||
return getStructure().getGridHeight();
|
||||
return getStructure(g).getGridHeight();
|
||||
}
|
||||
|
||||
public IrisStructure getStructure()
|
||||
public IrisStructure getStructure(ContextualChunkGenerator g)
|
||||
{
|
||||
return structure.aquire(() -> Iris.data.getStructureLoader().load(getTileset()));
|
||||
return structure.aquire(() -> (g == null ? Iris.globaldata : g.getData()).getStructureLoader().load(getTileset()));
|
||||
}
|
||||
|
||||
public boolean hasStructure(RNG random, double x, double y, double z)
|
||||
|
Loading…
x
Reference in New Issue
Block a user