mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 18:55:18 +00:00
Proper dimensional stacking
This commit is contained in:
parent
13805edba9
commit
c5bd594798
24
.idea/workspace.xml
generated
24
.idea/workspace.xml
generated
@ -16,8 +16,8 @@
|
|||||||
<option name="RECENT_TEMPLATES">
|
<option name="RECENT_TEMPLATES">
|
||||||
<list>
|
<list>
|
||||||
<option value="Enum" />
|
<option value="Enum" />
|
||||||
<option value="Interface" />
|
|
||||||
<option value="Class" />
|
<option value="Class" />
|
||||||
|
<option value="Interface" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
@ -60,11 +60,11 @@
|
|||||||
<recent name="com.volmit.iris.gen.v2.scaffold.stream.sources" />
|
<recent name="com.volmit.iris.gen.v2.scaffold.stream.sources" />
|
||||||
</key>
|
</key>
|
||||||
<key name="CopyClassDialog.RECENTS_KEY">
|
<key name="CopyClassDialog.RECENTS_KEY">
|
||||||
|
<recent name="com.volmit.iris.v2.scaffold.stream.utility" />
|
||||||
<recent name="com.volmit.iris.object" />
|
<recent name="com.volmit.iris.object" />
|
||||||
<recent name="com.volmit.iris.gen.v2.generator.actuator" />
|
<recent name="com.volmit.iris.gen.v2.generator.actuator" />
|
||||||
<recent name="com.volmit.iris.gen.v2.scaffold.stream.utility" />
|
<recent name="com.volmit.iris.gen.v2.scaffold.stream.utility" />
|
||||||
<recent name="com.volmit.iris.gen.v2.scaffold.stream.arithmetic" />
|
<recent name="com.volmit.iris.gen.v2.scaffold.stream.arithmetic" />
|
||||||
<recent name="com.volmit.iris.gen.v2.scaffold.stream.convert" />
|
|
||||||
</key>
|
</key>
|
||||||
<key name="CopyFile.RECENT_KEYS">
|
<key name="CopyFile.RECENT_KEYS">
|
||||||
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\gen\v2\scaffold\hunk" />
|
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\gen\v2\scaffold\hunk" />
|
||||||
@ -143,22 +143,22 @@
|
|||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
<state x="485" y="234" key="#com.intellij.structuralsearch.plugin.ui.StructuralSearchDialog/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603860057506" />
|
<state x="485" y="234" key="#com.intellij.structuralsearch.plugin.ui.StructuralSearchDialog/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603860057506" />
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.bottom" timestamp="1603976975935">
|
<state width="1921" height="983" key="GridCell.Tab.0.bottom" timestamp="1604048198954">
|
||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.bottom/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603976975935" />
|
<state width="1921" height="983" key="GridCell.Tab.0.bottom/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604048198954" />
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.center" timestamp="1603976975935">
|
<state width="1921" height="983" key="GridCell.Tab.0.center" timestamp="1604048198953">
|
||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.center/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603976975935" />
|
<state width="1921" height="983" key="GridCell.Tab.0.center/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604048198953" />
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.left" timestamp="1603976975934">
|
<state width="1921" height="983" key="GridCell.Tab.0.left" timestamp="1604048198953">
|
||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.left/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603976975934" />
|
<state width="1921" height="983" key="GridCell.Tab.0.left/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604048198953" />
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.right" timestamp="1603976975935">
|
<state width="1921" height="983" key="GridCell.Tab.0.right" timestamp="1604048198954">
|
||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
<state width="1921" height="983" key="GridCell.Tab.0.right/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603976975935" />
|
<state width="1921" height="983" key="GridCell.Tab.0.right/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604048198954" />
|
||||||
<state x="312" y="0" key="SettingsEditor" timestamp="1603947206451">
|
<state x="312" y="0" key="SettingsEditor" timestamp="1603947206451">
|
||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
@ -171,9 +171,9 @@
|
|||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
<state x="532" y="239" key="run.anything.popup/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603859771295" />
|
<state x="532" y="239" key="run.anything.popup/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603859771295" />
|
||||||
<state x="539" y="15" width="840" height="1034" key="search.everywhere.popup" timestamp="1603972322783">
|
<state x="539" y="15" width="840" height="1034" key="search.everywhere.popup" timestamp="1604046453193">
|
||||||
<screen x="0" y="0" width="1920" height="1050" />
|
<screen x="0" y="0" width="1920" height="1050" />
|
||||||
</state>
|
</state>
|
||||||
<state x="539" y="15" width="840" height="1034" key="search.everywhere.popup/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603972322783" />
|
<state x="539" y="15" width="840" height="1034" key="search.everywhere.popup/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604046453193" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -7,6 +7,7 @@ import com.volmit.iris.util.Command;
|
|||||||
import com.volmit.iris.util.KList;
|
import com.volmit.iris.util.KList;
|
||||||
import com.volmit.iris.util.MortarCommand;
|
import com.volmit.iris.util.MortarCommand;
|
||||||
import com.volmit.iris.util.MortarSender;
|
import com.volmit.iris.util.MortarSender;
|
||||||
|
import com.volmit.iris.v2.scaffold.engine.Hotloadable;
|
||||||
|
|
||||||
public class CommandIris extends MortarCommand
|
public class CommandIris extends MortarCommand
|
||||||
{
|
{
|
||||||
@ -70,6 +71,13 @@ public class CommandIris extends MortarCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(args.length == 1 && args[0].equalsIgnoreCase("hl!") && IrisSettings.get().allowExperimentalV2Generator)
|
||||||
|
{
|
||||||
|
((Hotloadable)sender.player().getWorld().getGenerator()).hotload();
|
||||||
|
sender.sendMessage("Done!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
sender.sendMessage("Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
sender.sendMessage("Iris v" + Iris.instance.getDescription().getVersion() + " by Volmit Software");
|
||||||
printHelp(sender);
|
printHelp(sender);
|
||||||
return true;
|
return true;
|
||||||
|
@ -184,7 +184,7 @@ public class IrisDataManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preferFolder(String name)
|
public IrisDataManager preferFolder(String name)
|
||||||
{
|
{
|
||||||
biomeLoader.preferFolder(name);
|
biomeLoader.preferFolder(name);
|
||||||
blockLoader.preferFolder(name);
|
blockLoader.preferFolder(name);
|
||||||
@ -194,6 +194,7 @@ public class IrisDataManager
|
|||||||
dimensionLoader.preferFolder(name);
|
dimensionLoader.preferFolder(name);
|
||||||
generatorLoader.preferFolder(name);
|
generatorLoader.preferFolder(name);
|
||||||
structureLoader.preferFolder(name);
|
structureLoader.preferFolder(name);
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearLists()
|
public void clearLists()
|
||||||
|
@ -25,6 +25,6 @@ public class TestGen
|
|||||||
public static void gen(Player p)
|
public static void gen(Player p)
|
||||||
{
|
{
|
||||||
p.teleport(new Location(new WorldCreator("t/" + UUID.randomUUID().toString())
|
p.teleport(new Location(new WorldCreator("t/" + UUID.randomUUID().toString())
|
||||||
.generator(EngineCompositeGenerator.newStudioWorld("flat")).createWorld(), 0, 70, 0));
|
.generator(EngineCompositeGenerator.newStudioWorld("test")).createWorld(), 0, 70, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@ public class IrisComplex implements DataProvider
|
|||||||
private ProceduralStream<IrisDecorator> terrainCeilingDecoration;
|
private ProceduralStream<IrisDecorator> terrainCeilingDecoration;
|
||||||
private ProceduralStream<IrisDecorator> seaSurfaceDecoration;
|
private ProceduralStream<IrisDecorator> seaSurfaceDecoration;
|
||||||
private ProceduralStream<IrisDecorator> shoreSurfaceDecoration;
|
private ProceduralStream<IrisDecorator> shoreSurfaceDecoration;
|
||||||
private ProceduralStream<BlockData> terrainStream;
|
|
||||||
private ProceduralStream<BlockData> rockStream;
|
private ProceduralStream<BlockData> rockStream;
|
||||||
private ProceduralStream<BlockData> fluidStream;
|
private ProceduralStream<BlockData> fluidStream;
|
||||||
private ProceduralStream<BlockData> glassStream;
|
private ProceduralStream<BlockData> glassStream;
|
||||||
@ -102,8 +101,7 @@ public class IrisComplex implements DataProvider
|
|||||||
overlayStream = ProceduralStream.ofDouble((x, z) -> 0D);
|
overlayStream = ProceduralStream.ofDouble((x, z) -> 0D);
|
||||||
engine.getDimension().getOverlayNoise().forEach((i) -> overlayStream.add((x, z) -> i.get(rng, x, z)));
|
engine.getDimension().getOverlayNoise().forEach((i) -> overlayStream.add((x, z) -> i.get(rng, x, z)));
|
||||||
rngStream = ProceduralStream.of((x, z) -> new RNG(((x.longValue()) << 32) | (z.longValue() & 0xffffffffL))
|
rngStream = ProceduralStream.of((x, z) -> new RNG(((x.longValue()) << 32) | (z.longValue() & 0xffffffffL))
|
||||||
.nextParallelRNG(engine.getWorld().getSeed()), Interpolated.RNG)
|
.nextParallelRNG(engine.getWorld().getSeed()), Interpolated.RNG);
|
||||||
.cache2D(64);
|
|
||||||
chunkRngStream = rngStream.blockToChunkCoords();
|
chunkRngStream = rngStream.blockToChunkCoords();
|
||||||
rockStream = engine.getDimension().getRockPalette().getLayerGenerator(rng.nextRNG(), data).stream()
|
rockStream = engine.getDimension().getRockPalette().getLayerGenerator(rng.nextRNG(), data).stream()
|
||||||
.select(engine.getDimension().getRockPalette().getBlockData(data));
|
.select(engine.getDimension().getRockPalette().getBlockData(data));
|
||||||
@ -112,17 +110,15 @@ public class IrisComplex implements DataProvider
|
|||||||
regionStream = engine.getDimension().getRegionStyle().create(rng.nextRNG()).stream()
|
regionStream = engine.getDimension().getRegionStyle().create(rng.nextRNG()).stream()
|
||||||
.zoom(engine.getDimension().getRegionZoom())
|
.zoom(engine.getDimension().getRegionZoom())
|
||||||
.selectRarity(engine.getDimension().getRegions())
|
.selectRarity(engine.getDimension().getRegions())
|
||||||
.convertCached((s) -> data.getRegionLoader().load(s))
|
.convertCached((s) -> data.getRegionLoader().load(s)).cache2D(cacheSize);
|
||||||
.cache2D(cacheSize);
|
caveBiomeStream = regionStream.convert((r)
|
||||||
caveBiomeStream = regionStream.convertCached((r)
|
|
||||||
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextRNG()).stream()
|
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextRNG()).stream()
|
||||||
.zoom(r.getCaveBiomeZoom())
|
.zoom(r.getCaveBiomeZoom())
|
||||||
.selectRarity(r.getCaveBiomes())
|
.selectRarity(r.getCaveBiomes())
|
||||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||||
.setInferredType(InferredType.CAVE))
|
.setInferredType(InferredType.CAVE))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get).cache2D(cacheSize);
|
||||||
.cache2D(cacheSize);
|
landBiomeStream = regionStream.convert((r)
|
||||||
landBiomeStream = regionStream.convertCached((r)
|
|
||||||
-> engine.getDimension().getLandBiomeStyle().create(rng.nextRNG()).stream()
|
-> engine.getDimension().getLandBiomeStyle().create(rng.nextRNG()).stream()
|
||||||
.zoom(r.getLandBiomeZoom())
|
.zoom(r.getLandBiomeZoom())
|
||||||
.selectRarity(r.getLandBiomes())
|
.selectRarity(r.getLandBiomes())
|
||||||
@ -130,7 +126,7 @@ public class IrisComplex implements DataProvider
|
|||||||
.setInferredType(InferredType.LAND))
|
.setInferredType(InferredType.LAND))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get)
|
||||||
.cache2D(cacheSize);
|
.cache2D(cacheSize);
|
||||||
seaBiomeStream = regionStream.convertCached((r)
|
seaBiomeStream = regionStream.convert((r)
|
||||||
-> engine.getDimension().getSeaBiomeStyle().create(rng.nextRNG()).stream()
|
-> engine.getDimension().getSeaBiomeStyle().create(rng.nextRNG()).stream()
|
||||||
.zoom(r.getSeaBiomeZoom())
|
.zoom(r.getSeaBiomeZoom())
|
||||||
.selectRarity(r.getSeaBiomes())
|
.selectRarity(r.getSeaBiomes())
|
||||||
@ -138,29 +134,27 @@ public class IrisComplex implements DataProvider
|
|||||||
.setInferredType(InferredType.SEA))
|
.setInferredType(InferredType.SEA))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get)
|
||||||
.cache2D(cacheSize);
|
.cache2D(cacheSize);
|
||||||
shoreBiomeStream = regionStream.convertCached((r)
|
shoreBiomeStream = regionStream.convert((r)
|
||||||
-> engine.getDimension().getShoreBiomeStyle().create(rng.nextRNG()).stream()
|
-> engine.getDimension().getShoreBiomeStyle().create(rng.nextRNG()).stream()
|
||||||
.zoom(r.getShoreBiomeZoom())
|
.zoom(r.getShoreBiomeZoom())
|
||||||
.selectRarity(r.getShoreBiomes())
|
.selectRarity(r.getShoreBiomes())
|
||||||
.convertCached((s) -> data.getBiomeLoader().load(s)
|
.convertCached((s) -> data.getBiomeLoader().load(s)
|
||||||
.setInferredType(InferredType.SHORE))
|
.setInferredType(InferredType.SHORE))
|
||||||
).convertAware2D(ProceduralStream::get)
|
).convertAware2D(ProceduralStream::get).cache2D(cacheSize);
|
||||||
.cache2D(cacheSize);
|
|
||||||
bridgeStream = engine.getDimension().getContinentalStyle().create(rng.nextRNG()).stream()
|
bridgeStream = engine.getDimension().getContinentalStyle().create(rng.nextRNG()).stream()
|
||||||
.convert((v) -> v >= engine.getDimension().getLandChance() ? InferredType.SEA : InferredType.LAND);
|
.convert((v) -> v >= engine.getDimension().getLandChance() ? InferredType.SEA : InferredType.LAND);
|
||||||
baseBiomeStream = bridgeStream.convertAware2D((t, x, z) -> t.equals(InferredType.SEA)
|
baseBiomeStream = bridgeStream.convertAware2D((t, x, z) -> t.equals(InferredType.SEA)
|
||||||
? seaBiomeStream.get(x, z) : landBiomeStream.get(x, z))
|
? seaBiomeStream.get(x, z) : landBiomeStream.get(x, z))
|
||||||
.convertAware2D(this::implode).cache2D(cacheSize);
|
.convertAware2D(this::implode).cache2D(cacheSize);
|
||||||
heightStream = baseBiomeStream.convertAware2D((b, x, z) -> getHeight(b, x, z, engine.getWorld().getSeed()))
|
heightStream = baseBiomeStream.convertAware2D((b, x, z) -> getHeight(b, x, z, engine.getWorld().getSeed()))
|
||||||
.roundDouble()
|
.roundDouble().cache2D(cacheSize);
|
||||||
.cache2D(cacheSize);
|
slopeStream = heightStream.slope().cache2D(cacheSize);
|
||||||
slopeStream = heightStream.slope();
|
|
||||||
trueBiomeStream = heightStream
|
trueBiomeStream = heightStream
|
||||||
.convertAware2D((h, x, z) ->
|
.convertAware2D((h, x, z) ->
|
||||||
fixBiomeType(h, baseBiomeStream.get(x, z),
|
fixBiomeType(h, baseBiomeStream.get(x, z),
|
||||||
regionStream.get(x, z), x, z, fluidHeight));
|
regionStream.get(x, z), x, z, fluidHeight)).cache2D(cacheSize);
|
||||||
trueBiomeDerivativeStream = trueBiomeStream.convert(IrisBiome::getDerivative);
|
trueBiomeDerivativeStream = trueBiomeStream.convert(IrisBiome::getDerivative).cache2D(cacheSize);
|
||||||
heightFluidStream = heightStream.max(fluidHeight);
|
heightFluidStream = heightStream.max(fluidHeight).cache2D(cacheSize);
|
||||||
maxHeightStream = ProceduralStream.ofDouble((x, z) -> height);
|
maxHeightStream = ProceduralStream.ofDouble((x, z) -> height);
|
||||||
terrainSurfaceDecoration = trueBiomeStream
|
terrainSurfaceDecoration = trueBiomeStream
|
||||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.NONE));
|
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.NONE));
|
||||||
@ -170,42 +164,9 @@ public class IrisComplex implements DataProvider
|
|||||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SHORE_LINE));
|
||||||
seaSurfaceDecoration = trueBiomeStream
|
seaSurfaceDecoration = trueBiomeStream
|
||||||
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SEA_SURFACE));
|
.convertAware2D((b, xx,zz) -> decorateFor(b, xx, zz, DecorationPart.SEA_SURFACE));
|
||||||
terrainStream = ProceduralStream.of(this::fillTerrain, Interpolated.BLOCK_DATA);
|
|
||||||
//@done
|
//@done
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockData fillTerrain(Double x, Double y, Double z)
|
|
||||||
{
|
|
||||||
double height = heightStream.get(x, z);
|
|
||||||
IrisBiome biome = trueBiomeStream.get(x, z);
|
|
||||||
int depth = (int) (Math.round(height) - y);
|
|
||||||
int atDepth = 0;
|
|
||||||
|
|
||||||
if(y > height && y <= fluidHeight)
|
|
||||||
{
|
|
||||||
return fluidStream.get(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(depth < -1)
|
|
||||||
{
|
|
||||||
return AIR;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(IrisBiomePaletteLayer i : biome.getLayers())
|
|
||||||
{
|
|
||||||
int th = i.getHeightGenerator(rng, data).fit(i.getMinHeight(), i.getMaxHeight(), x, z);
|
|
||||||
|
|
||||||
if(atDepth + th >= depth)
|
|
||||||
{
|
|
||||||
return i.get(rng, x, y, z, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
atDepth += th;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rockStream.get(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IrisDecorator decorateFor(IrisBiome b, double x, double z, DecorationPart part)
|
private IrisDecorator decorateFor(IrisBiome b, double x, double z, DecorationPart part)
|
||||||
{
|
{
|
||||||
RNG rngc = chunkRngStream.get(x, z);
|
RNG rngc = chunkRngStream.get(x, z);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.volmit.iris.v2.generator;
|
package com.volmit.iris.v2.generator;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.v2.scaffold.engine.Engine;
|
import com.volmit.iris.v2.scaffold.engine.Engine;
|
||||||
import com.volmit.iris.v2.scaffold.engine.EngineFramework;
|
import com.volmit.iris.v2.scaffold.engine.EngineFramework;
|
||||||
import com.volmit.iris.v2.scaffold.engine.EngineTarget;
|
import com.volmit.iris.v2.scaffold.engine.EngineTarget;
|
||||||
@ -23,6 +24,7 @@ public class IrisEngine implements Engine
|
|||||||
|
|
||||||
public IrisEngine(EngineTarget target)
|
public IrisEngine(EngineTarget target)
|
||||||
{
|
{
|
||||||
|
Iris.info("Initializing Engine: " + target.getWorld().getName() + "/" + target.getDimension().getLoadKey() + " (" + target.getHeight() + " height)");
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.framework = new IrisEngineFramework(this);
|
this.framework = new IrisEngineFramework(this);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.manager.IrisDataManager;
|
import com.volmit.iris.manager.IrisDataManager;
|
||||||
import com.volmit.iris.object.IrisDimension;
|
import com.volmit.iris.object.IrisDimension;
|
||||||
import com.volmit.iris.object.IrisDimensionIndex;
|
import com.volmit.iris.object.IrisDimensionIndex;
|
||||||
|
import com.volmit.iris.util.J;
|
||||||
import com.volmit.iris.util.KList;
|
import com.volmit.iris.util.KList;
|
||||||
import com.volmit.iris.v2.scaffold.engine.Engine;
|
import com.volmit.iris.v2.scaffold.engine.Engine;
|
||||||
import com.volmit.iris.v2.scaffold.engine.EngineCompound;
|
import com.volmit.iris.v2.scaffold.engine.EngineCompound;
|
||||||
@ -16,6 +17,7 @@ import lombok.Getter;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
import org.bukkit.craftbukkit.v1_16_R2.generator.CraftChunkData;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
@ -35,6 +37,7 @@ public class IrisEngineCompound implements EngineCompound {
|
|||||||
|
|
||||||
public IrisEngineCompound(World world, IrisDimension rootDimension, IrisDataManager data, int maximumThreads)
|
public IrisEngineCompound(World world, IrisDimension rootDimension, IrisDataManager data, int maximumThreads)
|
||||||
{
|
{
|
||||||
|
Iris.info("Initializing Engine Composite for " + world.getName());
|
||||||
this.world = world;
|
this.world = world;
|
||||||
engineMetadata = EngineData.load(getEngineMetadataFile());
|
engineMetadata = EngineData.load(getEngineMetadataFile());
|
||||||
saveEngineMetadata();
|
saveEngineMetadata();
|
||||||
@ -66,7 +69,7 @@ public class IrisEngineCompound implements EngineCompound {
|
|||||||
{
|
{
|
||||||
IrisDimensionIndex index = rootDimension.getDimensionalComposite().get(i);
|
IrisDimensionIndex index = rootDimension.getDimensionalComposite().get(i);
|
||||||
IrisDimension dimension = data.getDimensionLoader().load(index.getDimension());
|
IrisDimension dimension = data.getDimensionLoader().load(index.getDimension());
|
||||||
engines[i] = new IrisEngine(new EngineTarget(world, dimension, data.copy(), (int)Math.floor(256D * (index.getWeight() / totalWeight)), index.isInverted(), threadDist));
|
engines[i] = new IrisEngine(new EngineTarget(world, dimension, data.copy().preferFolder(rootDimension.getLoadKey()), (int)Math.floor(256D * (index.getWeight() / totalWeight)), index.isInverted(), threadDist));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -94,18 +97,19 @@ public class IrisEngineCompound implements EngineCompound {
|
|||||||
{
|
{
|
||||||
AtomicInteger index = new AtomicInteger(i);
|
AtomicInteger index = new AtomicInteger(i);
|
||||||
Engine engine = engines[i];
|
Engine engine = engines[i];
|
||||||
|
int doffset = offset;
|
||||||
int height = engine.getTarget().getHeight();
|
int height = engine.getTarget().getHeight();
|
||||||
AtomicReference<Hunk<BlockData>> cblock = new AtomicReference<>(blocks.croppedView(0, offset, 0, 16, offset+height, 16));
|
AtomicReference<Hunk<BlockData>> cblock = new AtomicReference<>(Hunk.newArrayHunk(16, height, 16));
|
||||||
AtomicReference<Hunk<Biome>> cbiome = new AtomicReference<>(biomes.croppedView(0, offset, 0, 16, offset+height, 16));
|
AtomicReference<Hunk<Biome>> cbiome = new AtomicReference<>(Hunk.newArrayHunk(16, height, 16));
|
||||||
cblock.set(engine.getTarget().isInverted() ? cblock.get().invertY() : cblock.get());
|
cblock.set(engine.getTarget().isInverted() ? cblock.get().invertY() : cblock.get());
|
||||||
cbiome.set(engine.getTarget().isInverted() ? cbiome.get().invertY() : cbiome.get());
|
cbiome.set(engine.getTarget().isInverted() ? cbiome.get().invertY() : cbiome.get());
|
||||||
e.queue(() -> {
|
e.queue(() -> {
|
||||||
generate(x, z, cblock.get(), cbiome.get());
|
engine.generate(x, z, cblock.get(), cbiome.get());
|
||||||
synchronized (insert)
|
synchronized (insert)
|
||||||
{
|
{
|
||||||
insert[index.get()] = () -> {
|
insert[index.get()] = () -> {
|
||||||
blocks.insert(cblock.get());
|
blocks.insert(0, doffset, 0, cblock.get());
|
||||||
biomes.insert(cbiome.get());
|
biomes.insert(0, doffset, 0, cbiome.get());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -8,11 +8,11 @@ import org.bukkit.block.Biome;
|
|||||||
public class IrisBiomeActuator extends EngineAssignedActuator<Biome>
|
public class IrisBiomeActuator extends EngineAssignedActuator<Biome>
|
||||||
{
|
{
|
||||||
public IrisBiomeActuator(Engine engine) {
|
public IrisBiomeActuator(Engine engine) {
|
||||||
super(engine);
|
super(engine, "Biome");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actuate(int x, int z, Hunk<Biome> output) {
|
public void onActuate(int x, int z, Hunk<Biome> output) {
|
||||||
output.compute2D(getParallelism(), (xx, yy, zz, h) -> {
|
output.compute2D(getParallelism(), (xx, yy, zz, h) -> {
|
||||||
int i,zf;
|
int i,zf;
|
||||||
Biome v;
|
Biome v;
|
||||||
|
@ -7,6 +7,7 @@ import com.volmit.iris.object.IrisBiome;
|
|||||||
import com.volmit.iris.object.IrisDecorator;
|
import com.volmit.iris.object.IrisDecorator;
|
||||||
import com.volmit.iris.util.RNG;
|
import com.volmit.iris.util.RNG;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@ -17,21 +18,63 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData>
|
|||||||
private final RNG rng;
|
private final RNG rng;
|
||||||
|
|
||||||
public IrisDecorantActuator(Engine engine) {
|
public IrisDecorantActuator(Engine engine) {
|
||||||
super(engine);
|
super(engine, "Decorant");
|
||||||
this.rng = new RNG(engine.getTarget().getWorld().getSeed());
|
this.rng = new RNG(engine.getTarget().getWorld().getSeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean shouldDecorate()
|
||||||
|
{
|
||||||
|
return getEngine().getDimension().isDecorate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean shouldRayDecorate()
|
||||||
|
{
|
||||||
|
return getEngine().getDimension().isCarving() || getEngine().getDimension().isCaves() || getEngine().getDimension().isVanillaCaves() || getEngine().getDimension().isRavines();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actuate(int x, int z, Hunk<BlockData> output) {
|
public void onActuate(int x, int z, Hunk<BlockData> output) {
|
||||||
output.iterateSurfaces2D(getParallelism(), PREDICATE_SOLID, (hunkRelativeX, hunkRelativeZ, hunkOffsetX, hunkOffsetZ, top, bottom, lastBottom, h) ->
|
if(!shouldDecorate())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(shouldRayDecorate())
|
||||||
|
{
|
||||||
|
output.iterateSurfaces2D(getParallelism(), PREDICATE_SOLID, (hunkRelativeX, hunkRelativeZ, hunkOffsetX, hunkOffsetZ, top, bottom, lastBottom, h) -> decorateLayer(x, z, hunkRelativeX, hunkRelativeZ, hunkOffsetX, hunkOffsetZ,top,bottom,lastBottom,h));
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output.compute2D(getParallelism(), (xx, yy, zz, h) -> {
|
||||||
|
int he;
|
||||||
|
for(int i = 0; i < h.getWidth(); i++)
|
||||||
|
{
|
||||||
|
for(int j = 0; j < h.getDepth(); j++)
|
||||||
|
{
|
||||||
|
he = getComplex().getHeightFluidStream().get(x + xx+i, z + zz+j).intValue();
|
||||||
|
decorateLayer(x, z, i, j, xx, zz, he, 0, getEngine().getHeight(), h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void decorateLayer(int x, int z, int hunkRelativeX, int hunkRelativeZ, int hunkOffsetX, int hunkOffsetZ, int top, int bottom,int lastBottom, Hunk<BlockData> h)
|
||||||
{
|
{
|
||||||
int realX = x + hunkOffsetX + hunkRelativeX;
|
int realX = x + hunkOffsetX + hunkRelativeX;
|
||||||
int realZ = z + hunkOffsetZ + hunkRelativeZ;
|
int realZ = z + hunkOffsetZ + hunkRelativeZ;
|
||||||
RNG g = rng.nextParallelRNG(realX).nextParallelRNG(realZ); //TODO: Technically incorrect! Use chunkX & chunkZ
|
|
||||||
IrisBiome b = getComplex().getTrueBiomeStream().get(realX, realZ);
|
IrisBiome b = getComplex().getTrueBiomeStream().get(realX, realZ);
|
||||||
|
|
||||||
|
if(b.getDecorators().isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
RNG g = rng.nextParallelRNG(realX >> 4).nextParallelRNG(realZ >> 4);
|
||||||
boolean surface = lastBottom == -1;
|
boolean surface = lastBottom == -1;
|
||||||
int floor = top + 1;
|
int floor = top + 1;
|
||||||
int ceiling = lastBottom == -1 ? floor < getDimension().getFluidHeight() ? getDimension().getFluidHeight() : output.getHeight() : lastBottom - 1;
|
int ceiling = lastBottom == -1 ? floor < getDimension().getFluidHeight() ? getDimension().getFluidHeight() : getEngine().getHeight() : lastBottom - 1;
|
||||||
int height = ceiling - floor;
|
int height = ceiling - floor;
|
||||||
|
|
||||||
if(height < 2)
|
if(height < 2)
|
||||||
@ -91,6 +134,5 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,65 @@
|
|||||||
package com.volmit.iris.v2.generator.actuator;
|
package com.volmit.iris.v2.generator.actuator;
|
||||||
|
|
||||||
|
import com.volmit.iris.object.IrisBiome;
|
||||||
|
import com.volmit.iris.object.IrisBiomePaletteLayer;
|
||||||
|
import com.volmit.iris.util.KList;
|
||||||
|
import com.volmit.iris.util.RNG;
|
||||||
import com.volmit.iris.v2.scaffold.engine.Engine;
|
import com.volmit.iris.v2.scaffold.engine.Engine;
|
||||||
import com.volmit.iris.v2.scaffold.engine.EngineAssignedActuator;
|
import com.volmit.iris.v2.scaffold.engine.EngineAssignedActuator;
|
||||||
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
public class IrisTerrainActuator extends EngineAssignedActuator<BlockData>
|
||||||
{
|
{
|
||||||
|
private static final BlockData AIR = Material.AIR.createBlockData();
|
||||||
|
private final RNG rng;
|
||||||
|
|
||||||
public IrisTerrainActuator(Engine engine) {
|
public IrisTerrainActuator(Engine engine) {
|
||||||
super(engine);
|
super(engine, "Terrain");
|
||||||
|
rng = new RNG(engine.getWorld().getSeed());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actuate(int x, int z, Hunk<BlockData> output) {
|
public void onActuate(int x, int z, Hunk<BlockData> output) {
|
||||||
output.compute2D(getParallelism(), (xx, yy, zz, h) -> {
|
output.compute2D(getParallelism(), (xx, yy, zz, h) -> {
|
||||||
int i,zf;
|
int i,zf, depth, atDepth;
|
||||||
double he;
|
double he;
|
||||||
|
BlockData block;
|
||||||
|
IrisBiome biome;
|
||||||
|
|
||||||
for(int xf = 0; xf < h.getWidth(); xf++)
|
for(int xf = 0; xf < h.getWidth(); xf++)
|
||||||
{
|
{
|
||||||
for(zf = 0; zf < h.getDepth(); zf++)
|
for(zf = 0; zf < h.getDepth(); zf++)
|
||||||
{
|
{
|
||||||
he = Math.min(h.getHeight(), getComplex().getHeightFluidStream().get(xx+xf+x, zz+zf+z));
|
he = Math.min(h.getHeight(), getComplex().getHeightFluidStream().get(xx+xf+x, zz+zf+z));
|
||||||
|
biome = getComplex().getTrueBiomeStream().get(xx+xf+x, zz+zf+z);
|
||||||
|
KList<BlockData> blocks = biome.generateLayers(xx+xf+x, zz+zf+z, rng, (int)he, (int)he, getData());
|
||||||
|
|
||||||
for(i = 0; i < he; i++)
|
for(i = 0; i < he; i++)
|
||||||
{
|
{
|
||||||
h.set(xx+xf, i, zz+zf, getComplex().getTerrainStream().get(xx+xf+x, i, zz+zf+z));
|
depth = ((int)he) - i;
|
||||||
|
|
||||||
|
if(i > he && i <= he)
|
||||||
|
{
|
||||||
|
h.set(xx+xf, i, zz+zf, getComplex().getFluidStream().get(xx+xf+x, zz+zf+z));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(depth < -1)
|
||||||
|
{
|
||||||
|
h.set(xx+xf, i, zz+zf, AIR);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(blocks.hasIndex(blocks.last() - ((int)he - depth)))
|
||||||
|
{
|
||||||
|
h.set(xx+xf, i, zz+zf, blocks.get(blocks.last() - ((int)he - depth)));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
h.set(xx+xf, i, zz+zf, getComplex().getRockStream().get(xx+xf+x, zz+zf+z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.volmit.iris.v2.scaffold.engine;
|
package com.volmit.iris.v2.scaffold.engine;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.RollingSequence;
|
||||||
import com.volmit.iris.v2.generator.IrisComplex;
|
import com.volmit.iris.v2.generator.IrisComplex;
|
||||||
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||||
import com.volmit.iris.v2.scaffold.parallax.ParallaxAccess;
|
import com.volmit.iris.v2.scaffold.parallax.ParallaxAccess;
|
||||||
@ -10,6 +11,10 @@ public interface EngineActuator<O>
|
|||||||
{
|
{
|
||||||
public Engine getEngine();
|
public Engine getEngine();
|
||||||
|
|
||||||
|
public RollingSequence getMetrics();
|
||||||
|
|
||||||
|
public String getName();
|
||||||
|
|
||||||
public default IrisDataManager getData()
|
public default IrisDataManager getData()
|
||||||
{
|
{
|
||||||
return getEngine().getData();
|
return getEngine().getData();
|
||||||
|
@ -1,11 +1,38 @@
|
|||||||
package com.volmit.iris.v2.scaffold.engine;
|
package com.volmit.iris.v2.scaffold.engine;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.PrecisionStopwatch;
|
||||||
|
import com.volmit.iris.util.RollingSequence;
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
public abstract class EngineAssignedActuator<T> implements EngineActuator<T>
|
public abstract class EngineAssignedActuator<T> implements EngineActuator<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Engine engine;
|
private final Engine engine;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final RollingSequence metrics;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public EngineAssignedActuator(Engine engine, String name)
|
||||||
|
{
|
||||||
|
this.engine = engine;
|
||||||
|
this.name = name;
|
||||||
|
metrics = new RollingSequence(16);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void onActuate(int x, int z, Hunk<T> output);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actuate(int x, int z, Hunk<T> output) {
|
||||||
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
onActuate(x, z, output);
|
||||||
|
p.end();
|
||||||
|
getMetrics().put(p.getMilliseconds());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
public class EngineCompositeGenerator extends ChunkGenerator {
|
public class EngineCompositeGenerator extends ChunkGenerator implements Hotloadable {
|
||||||
private EngineCompound compound;
|
private EngineCompound compound;
|
||||||
private final AtomicBoolean initialized;
|
private final AtomicBoolean initialized;
|
||||||
private final String dimensionHint;
|
private final String dimensionHint;
|
||||||
@ -39,6 +39,11 @@ public class EngineCompositeGenerator extends ChunkGenerator {
|
|||||||
initialized = new AtomicBoolean(false);
|
initialized = new AtomicBoolean(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void hotload()
|
||||||
|
{
|
||||||
|
initialized.lazySet(false);
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized IrisDimension getDimension(World world) {
|
private synchronized IrisDimension getDimension(World world) {
|
||||||
String hint = dimensionHint;
|
String hint = dimensionHint;
|
||||||
IrisDimension dim = null;
|
IrisDimension dim = null;
|
||||||
@ -71,14 +76,14 @@ public class EngineCompositeGenerator extends ChunkGenerator {
|
|||||||
throw new RuntimeException("Cannot find iris dimension data for world: " + world.getName() + "! FAILED");
|
throw new RuntimeException("Cannot find iris dimension data for world: " + world.getName() + "! FAILED");
|
||||||
}
|
}
|
||||||
|
|
||||||
dim = Iris.globaldata.getDimensionLoader().load(hint);
|
dim = Iris.globaldata.preferFolder(hint).getDimensionLoader().load(hint);
|
||||||
|
|
||||||
if (dim == null) {
|
if (dim == null) {
|
||||||
throw new RuntimeException("Cannot find dimension: " + hint);
|
throw new RuntimeException("Cannot find dimension: " + hint);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (production) {
|
if (production) {
|
||||||
dim = new IrisDataManager(getDataFolder(world), true).getDimensionLoader().load(dim.getLoadKey());
|
dim = new IrisDataManager(getDataFolder(world), true).preferFolder(dim.getLoadKey()).getDimensionLoader().load(dim.getLoadKey());
|
||||||
|
|
||||||
if (dim == null) {
|
if (dim == null) {
|
||||||
throw new RuntimeException("Cannot find dimension: " + hint);
|
throw new RuntimeException("Cannot find dimension: " + hint);
|
||||||
@ -94,7 +99,9 @@ public class EngineCompositeGenerator extends ChunkGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IrisDataManager data = production ? new IrisDataManager(getDataFolder(world)) : Iris.globaldata.copy();
|
IrisDataManager data = production ? new IrisDataManager(getDataFolder(world)) : Iris.globaldata.copy();
|
||||||
compound = new IrisEngineCompound(world, getDimension(world), data, Iris.getThreadCount());
|
IrisDimension dim = getDimension(world);
|
||||||
|
data.preferFolder(dim.getLoadKey());
|
||||||
|
compound = new IrisEngineCompound(world, dim, data, Iris.getThreadCount());
|
||||||
initialized.set(true);
|
initialized.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +118,7 @@ public class EngineCompositeGenerator extends ChunkGenerator {
|
|||||||
Hunk<Biome> biomes = Hunk.view(biome);
|
Hunk<Biome> biomes = Hunk.view(biome);
|
||||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
compound.generate(x * 16, z * 16, blocks, biomes);
|
compound.generate(x * 16, z * 16, blocks, biomes);
|
||||||
System.out.println("Generated " + x + "," + z + " in " + Form.duration(p.getMilliseconds(), 0));
|
System.out.println("Generated " + x + "," + z + " in " + Form.duration(p.getMilliseconds(), 0) + " (Terrain: " + Form.duration(compound.getEngine(0).getFramework().getTerrainActuator().getMetrics().getAverage(), 2) + ", Biome: " + Form.duration(compound.getEngine(0).getFramework().getBiomeActuator().getMetrics().getAverage(), 2) + ", Decorant: " + Form.duration(compound.getEngine(0).getFramework().getDecorantActuator().getMetrics().getAverage(), 2) + ")");
|
||||||
return chunk;
|
return chunk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
package com.volmit.iris.v2.scaffold.engine;
|
||||||
|
|
||||||
|
public interface Hotloadable {
|
||||||
|
public void hotload();
|
||||||
|
}
|
@ -36,6 +36,11 @@ public class ChunkBiomeHunkView implements Hunk<Biome>
|
|||||||
@Override
|
@Override
|
||||||
public void setRaw(int x, int y, int z, Biome t)
|
public void setRaw(int x, int y, int z, Biome t)
|
||||||
{
|
{
|
||||||
|
if(t == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Iris.edit.setBiome(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
Iris.edit.setBiome(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,6 +34,11 @@ public class ChunkDataHunkView implements Hunk<BlockData>
|
|||||||
@Override
|
@Override
|
||||||
public void set(int x1, int y1, int z1, int x2, int y2, int z2, BlockData t)
|
public void set(int x1, int y1, int z1, int x2, int y2, int z2, BlockData t)
|
||||||
{
|
{
|
||||||
|
if(t == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
enforceBounds(x1, y1, z1, x2 - x1, y2 - y1, z2 - z1);
|
enforceBounds(x1, y1, z1, x2 - x1, y2 - y1, z2 - z1);
|
||||||
chunk.setRegion(x1, y1, z1, x2, y2, z2, t);
|
chunk.setRegion(x1, y1, z1, x2, y2, z2, t);
|
||||||
}
|
}
|
||||||
@ -41,6 +46,11 @@ public class ChunkDataHunkView implements Hunk<BlockData>
|
|||||||
@Override
|
@Override
|
||||||
public void setRaw(int x, int y, int z, BlockData t)
|
public void setRaw(int x, int y, int z, BlockData t)
|
||||||
{
|
{
|
||||||
|
if(t == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
chunk.setBlock(x, y, z, t);
|
chunk.setBlock(x, y, z, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,6 +36,11 @@ public class ChunkHunkView implements Hunk<BlockData>
|
|||||||
@Override
|
@Override
|
||||||
public void setRaw(int x, int y, int z, BlockData t)
|
public void setRaw(int x, int y, int z, BlockData t)
|
||||||
{
|
{
|
||||||
|
if(t == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Iris.edit.set(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
Iris.edit.set(chunk.getWorld(), x + (chunk.getX() * 16), y, z + (chunk.getZ() * 16), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
package com.volmit.iris.v2.scaffold.hunk;
|
package com.volmit.iris.v2.scaffold.hunk.view;
|
||||||
|
|
||||||
|
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||||
|
|
||||||
public class HunkView<T> implements Hunk<T>
|
public class HunkView<T> implements Hunk<T>
|
||||||
{
|
{
|
@ -14,13 +14,13 @@ public class InvertedHunkView<T> implements Hunk<T>
|
|||||||
@Override
|
@Override
|
||||||
public void setRaw(int x, int y, int z, T t)
|
public void setRaw(int x, int y, int z, T t)
|
||||||
{
|
{
|
||||||
src.setRaw(x, getHeight() - y, z, t);
|
src.setRaw(x, (getHeight() -1) - y, z, t);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T getRaw(int x, int y, int z)
|
public T getRaw(int x, int y, int z)
|
||||||
{
|
{
|
||||||
return src.getRaw(x, getHeight() - y, z);
|
return src.getRaw(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user