mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Fixes
This commit is contained in:
parent
f97cd10bf6
commit
b87153a445
24
.idea/workspace.xml
generated
24
.idea/workspace.xml
generated
@ -60,10 +60,10 @@
|
||||
<recent name="com.volmit.iris.gen.v2.scaffold.stream.sources" />
|
||||
</key>
|
||||
<key name="CopyClassDialog.RECENTS_KEY">
|
||||
<recent name="com.volmit.iris.v2.generator.actuator" />
|
||||
<recent name="com.volmit.iris.command" />
|
||||
<recent name="com.volmit.iris.v2.scaffold.hunk.view" />
|
||||
<recent name="com.volmit.iris.v2.scaffold.engine" />
|
||||
<recent name="com.volmit.iris.v2.generator.actuator" />
|
||||
<recent name="com.volmit.iris.v2.scaffold.stream.utility" />
|
||||
</key>
|
||||
<key name="CopyFile.RECENT_KEYS">
|
||||
@ -74,7 +74,7 @@
|
||||
<recent name="C:\Users\cyberpwn\Documents\development\workspace\Iris\src\main\java\com\volmit\iris\gen\v2\scaffold\hunk" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager" selected="Maven.Iris Build">
|
||||
<component name="RunManager" selected="Maven.Iris Release">
|
||||
<configuration default="true" type="MavenRunConfiguration" factoryName="Maven">
|
||||
<MavenSettings>
|
||||
<option name="myGeneralSettings" />
|
||||
@ -127,10 +127,10 @@
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</state>
|
||||
<state x="410" y="171" width="1234" height="708" key="#com.intellij.execution.impl.EditConfigurationsDialog/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1603947263834" />
|
||||
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser" timestamp="1604186001966">
|
||||
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser" timestamp="1604238671017">
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</state>
|
||||
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604186001966" />
|
||||
<state x="718" y="163" key="#com.intellij.ide.util.MemberChooser/-1920.0.1920.1050/1920.0.1920.1050/0.0.1920.1050@0.0.1920.1050" timestamp="1604238671017" />
|
||||
<state x="675" y="394" key="#com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesDialog.classes" timestamp="1603943257126">
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</state>
|
||||
@ -147,22 +147,22 @@
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</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 width="1921" height="983" key="GridCell.Tab.0.bottom" timestamp="1604185046457">
|
||||
<state width="1921" height="983" key="GridCell.Tab.0.bottom" timestamp="1604235922783">
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</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="1604185046457" />
|
||||
<state width="1921" height="983" key="GridCell.Tab.0.center" timestamp="1604185046457">
|
||||
<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="1604235922783" />
|
||||
<state width="1921" height="983" key="GridCell.Tab.0.center" timestamp="1604235922783">
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</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="1604185046457" />
|
||||
<state width="1921" height="983" key="GridCell.Tab.0.left" timestamp="1604185046457">
|
||||
<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="1604235922783" />
|
||||
<state width="1921" height="983" key="GridCell.Tab.0.left" timestamp="1604235922783">
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</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="1604185046457" />
|
||||
<state width="1921" height="983" key="GridCell.Tab.0.right" timestamp="1604185046457">
|
||||
<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="1604235922783" />
|
||||
<state width="1921" height="983" key="GridCell.Tab.0.right" timestamp="1604235922783">
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</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="1604185046457" />
|
||||
<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="1604235922783" />
|
||||
<state x="312" y="0" key="SettingsEditor" timestamp="1603947206451">
|
||||
<screen x="0" y="0" width="1920" height="1050" />
|
||||
</state>
|
||||
|
@ -65,9 +65,9 @@ public class CommandIris extends MortarCommand
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(args.length == 1 && args[0].equalsIgnoreCase("test!") && IrisSettings.get().allowExperimentalV2Generator)
|
||||
if(args.length == 2 && args[0].equalsIgnoreCase("test!") && IrisSettings.get().allowExperimentalV2Generator)
|
||||
{
|
||||
TestGen.gen(sender.player());
|
||||
TestGen.gen(sender.player(), args[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -631,7 +631,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
});
|
||||
}
|
||||
|
||||
public KList<String> getAllChildren(ContextualTerrainProvider g, int limit)
|
||||
public KList<String> getAllChildren(DataProvider g, int limit)
|
||||
{
|
||||
KSet<String> m = new KSet<>();
|
||||
m.addAll(getChildren());
|
||||
@ -641,7 +641,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
{
|
||||
for(String i : getChildren())
|
||||
{
|
||||
IrisBiome b = g != null ? g.loadBiome(i) : Iris.globaldata.getBiomeLoader().load(i);
|
||||
IrisBiome b = g != null ? g.getData().getBiomeLoader().load(i) : Iris.globaldata.getBiomeLoader().load(i);
|
||||
int l = limit;
|
||||
m.addAll(b.getAllChildren(g, l));
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.volmit.iris.util.RegistryListBiome;
|
||||
import com.volmit.iris.util.RegistryListObject;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import com.volmit.iris.v2.scaffold.data.DataProvider;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
@ -63,17 +64,17 @@ public class IrisBiomeMutation
|
||||
private final transient AtomicCache<KList<String>> sideACache = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<String>> sideBCache = new AtomicCache<>();
|
||||
|
||||
public KList<String> getRealSideA(ContextualTerrainProvider xg)
|
||||
public KList<String> getRealSideA(DataProvider xg)
|
||||
{
|
||||
return sideACache.aquire(() -> processList(xg, getSideA()));
|
||||
}
|
||||
|
||||
public KList<String> getRealSideB(ContextualTerrainProvider xg)
|
||||
public KList<String> getRealSideB(DataProvider xg)
|
||||
{
|
||||
return sideBCache.aquire(() -> processList(xg, getSideB()));
|
||||
}
|
||||
|
||||
public KList<String> processList(ContextualTerrainProvider xg, KList<String> s)
|
||||
public KList<String> processList(DataProvider xg, KList<String> s)
|
||||
{
|
||||
KSet<String> r = new KSet<>();
|
||||
|
||||
@ -83,14 +84,14 @@ public class IrisBiomeMutation
|
||||
|
||||
if(q.startsWith("^"))
|
||||
{
|
||||
r.addAll(xg.loadRegion(q.substring(1)).getLandBiomes());
|
||||
r.addAll(xg.getData().getRegionLoader().load(q.substring(1)).getLandBiomes());
|
||||
continue;
|
||||
}
|
||||
|
||||
else if(q.startsWith("*"))
|
||||
{
|
||||
String name = q.substring(1);
|
||||
r.addAll(xg.loadBiome(name).getAllChildren(xg, 7));
|
||||
r.addAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
|
||||
}
|
||||
|
||||
else if(q.startsWith("!"))
|
||||
@ -101,7 +102,7 @@ public class IrisBiomeMutation
|
||||
else if(q.startsWith("!*"))
|
||||
{
|
||||
String name = q.substring(2);
|
||||
r.removeAll(xg.loadBiome(name).getAllChildren(xg, 7));
|
||||
r.removeAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -84,7 +84,7 @@ public class IrisCarveLayer
|
||||
{
|
||||
opacity = IrisInterpolation.bezier(1D - M.lerpInverse(maxHeight-innerRange, getMaxHeight(), y));
|
||||
}
|
||||
|
||||
|
||||
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()))).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import com.volmit.iris.v2.scaffold.data.DataProvider;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
@ -10,9 +10,9 @@ import com.volmit.iris.v2.scaffold.engine.EngineCompositeGenerator;
|
||||
|
||||
public class TestGen
|
||||
{
|
||||
public static void gen(Player p)
|
||||
public static void gen(Player p, String arg)
|
||||
{
|
||||
p.teleport(new Location(new WorldCreator("t/" + UUID.randomUUID().toString())
|
||||
.generator(EngineCompositeGenerator.newStudioWorld("iris")).createWorld(), 0, 70, 0));
|
||||
.generator(EngineCompositeGenerator.newStudioWorld(arg)).createWorld(), 0, 70, 0));
|
||||
}
|
||||
}
|
||||
|
@ -46,16 +46,7 @@ public class IrisEngine implements Engine
|
||||
})
|
||||
);
|
||||
|
||||
generateStructureReferences();
|
||||
generateStructures();
|
||||
getFramework().getEngineParallax().insertParallax(x, z, blocks);
|
||||
getParallax().cleanup();
|
||||
}
|
||||
|
||||
private void generateStructureReferences() {
|
||||
|
||||
}
|
||||
|
||||
private void generateStructures() {
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,213 @@
|
||||
package com.volmit.iris.v2.generator.actuator;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicSliver;
|
||||
import com.volmit.iris.noise.FastNoiseDouble;
|
||||
import com.volmit.iris.object.IrisCaveLayer;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
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.EngineAssignedModifier;
|
||||
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class IrisCaveModifier extends EngineAssignedModifier<BlockData>
|
||||
{
|
||||
public static final BlockData CAVE_AIR = B.getBlockData("CAVE_AIR");
|
||||
public static final BlockData AIR = B.getBlockData("AIR");
|
||||
private static final KList<CaveResult> EMPTY = new KList<>();
|
||||
private final FastNoiseDouble gg;
|
||||
private final RNG rng;
|
||||
|
||||
public IrisCaveModifier(Engine engine) {
|
||||
super(engine, "Cave");
|
||||
rng = new RNG(engine.getWorld().getSeed() + 28934555);
|
||||
gg = new FastNoiseDouble(324895 * rng.nextParallelRNG(49678).imax());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onModify(int x, int z, Hunk<BlockData> output) {
|
||||
|
||||
}
|
||||
|
||||
public KList<CaveResult> genCaves(double wxx, double wzz, int x, int z, Hunk<BlockData> data)
|
||||
{
|
||||
if(!getDimension().isCaves())
|
||||
{
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
KList<CaveResult> result = new KList<>();
|
||||
gg.setNoiseType(FastNoiseDouble.NoiseType.Cellular);
|
||||
gg.setCellularReturnType(FastNoiseDouble.CellularReturnType.Distance2Sub);
|
||||
gg.setCellularDistanceFunction(FastNoiseDouble.CellularDistanceFunction.Natural);
|
||||
|
||||
for(int i = 0; i < getDimension().getCaveLayers().size(); i++)
|
||||
{
|
||||
IrisCaveLayer layer = getDimension().getCaveLayers().get(i);
|
||||
generateCave(result, wxx, wzz, x, z, data, layer, i);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public void generateCave(KList<CaveResult> result, double wxx, double wzz, int x, int z, Hunk<BlockData> data, IrisCaveLayer layer, int seed)
|
||||
{
|
||||
double scale = layer.getCaveZoom();
|
||||
Function<Integer, BlockData> fluid = (height) ->
|
||||
{
|
||||
if(!layer.getFluid().hasFluid(getData()))
|
||||
{
|
||||
return CAVE_AIR;
|
||||
}
|
||||
|
||||
if(layer.getFluid().isInverseHeight() && height >= layer.getFluid().getFluidHeight())
|
||||
{
|
||||
return layer.getFluid().getFluid(getData());
|
||||
}
|
||||
|
||||
else if(!layer.getFluid().isInverseHeight() && height <= layer.getFluid().getFluidHeight())
|
||||
{
|
||||
return layer.getFluid().getFluid(getData());
|
||||
}
|
||||
|
||||
return CAVE_AIR;
|
||||
};
|
||||
|
||||
int surface = (int) Math.round(getComplex().getHeightStream().get(wxx, wzz));
|
||||
double wx = wxx + layer.getHorizontalSlope().get(rng, wxx, wzz);
|
||||
double wz = wzz + layer.getHorizontalSlope().get(rng, -wzz, -wxx);
|
||||
double baseWidth = (14 * scale);
|
||||
double distanceCheck = 0.0132 * baseWidth;
|
||||
double distanceTake = 0.0022 * baseWidth;
|
||||
double caveHeightNoise = layer.getVerticalSlope().get(rng, wxx, wzz);
|
||||
|
||||
if(caveHeightNoise > 259 || caveHeightNoise < -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int ceiling = -256;
|
||||
int floor = 512;
|
||||
|
||||
for(double tunnelHeight = 1; tunnelHeight <= baseWidth; tunnelHeight++)
|
||||
{
|
||||
double distance = (gg.GetCellular(((wx + (10000 * seed)) / layer.getCaveZoom()), ((wz - (10000 * seed)) / layer.getCaveZoom())) + 1D) / 2D;
|
||||
if(distance < distanceCheck - (tunnelHeight * distanceTake))
|
||||
{
|
||||
int caveHeight = (int) Math.round(caveHeightNoise);
|
||||
int pu = (int) (caveHeight + tunnelHeight);
|
||||
int pd = (int) (caveHeight - tunnelHeight);
|
||||
|
||||
if(pd > surface + 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!layer.isCanBreakSurface() && pu > surface - 3)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if((pu > 255 && pd > 255) || (pu < 0 && pd < 0))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(data == null)
|
||||
{
|
||||
ceiling = Math.max(pu, ceiling);
|
||||
floor = Math.min(pu, floor);
|
||||
ceiling = Math.max(pd, ceiling);
|
||||
floor = Math.min(pd, floor);
|
||||
|
||||
if(tunnelHeight == 1)
|
||||
{
|
||||
ceiling = Math.max(caveHeight, ceiling);
|
||||
floor = Math.min(caveHeight, floor);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(dig(x, pu, z, data, fluid))
|
||||
{
|
||||
ceiling = Math.max(pu, ceiling);
|
||||
floor = Math.min(pu, floor);
|
||||
}
|
||||
|
||||
if(dig(x, pd, z, data, fluid))
|
||||
{
|
||||
ceiling = Math.max(pd, ceiling);
|
||||
floor = Math.min(pd, floor);
|
||||
}
|
||||
|
||||
if(tunnelHeight == 1)
|
||||
{
|
||||
if(dig(x, caveHeight, z, data, fluid))
|
||||
{
|
||||
ceiling = Math.max(caveHeight, ceiling);
|
||||
floor = Math.min(caveHeight, floor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(floor >= 0 && ceiling <= 255)
|
||||
{
|
||||
result.add(new CaveResult(floor, ceiling));
|
||||
}
|
||||
}
|
||||
|
||||
private Material mat(int x, int y, int z, Hunk<BlockData> data)
|
||||
{
|
||||
BlockData d = data.get(x,y,z);
|
||||
|
||||
if(d != null)
|
||||
{
|
||||
return d.getMaterial();
|
||||
}
|
||||
|
||||
return Material.CAVE_AIR;
|
||||
}
|
||||
|
||||
public boolean dig(int x, int y, int z, Hunk<BlockData> data, Function<Integer, BlockData> caveFluid)
|
||||
{
|
||||
Material a = mat(x,y,z, data);
|
||||
Material c = mat(x, y + 1, z, data);
|
||||
Material d = mat(x, y + 2, z, data);
|
||||
Material e = mat(x, y + 3, z, data);
|
||||
Material f = mat(x, y - 1, z, data);
|
||||
BlockData b = caveFluid.apply(y);
|
||||
BlockData b2 = caveFluid.apply(y + 1);
|
||||
|
||||
if(can(a) && canAir(c, b) && canAir(f, b) && canWater(d) && canWater(e))
|
||||
{
|
||||
data.set(x, y, z, b);
|
||||
data.set(x, y + 1, z, b2);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canAir(Material m, BlockData caveFluid)
|
||||
{
|
||||
return (B.isSolid(m) || (B.isDecorant(m.createBlockData())) || m.equals(Material.AIR) || m.equals(caveFluid.getMaterial()) || m.equals(B.mat("CAVE_AIR").getMaterial())) && !m.equals(Material.BEDROCK);
|
||||
}
|
||||
|
||||
public boolean canWater(Material m)
|
||||
{
|
||||
return !m.equals(Material.WATER);
|
||||
}
|
||||
|
||||
public boolean can(Material m)
|
||||
{
|
||||
return B.isSolid(m) && !m.equals(Material.BEDROCK);
|
||||
}
|
||||
}
|
@ -9,10 +9,10 @@ public abstract class EngineAssignedModifier<T> extends EngineAssignedComponent
|
||||
super(engine, name);
|
||||
}
|
||||
|
||||
public abstract void onModify(Hunk<T> output);
|
||||
public abstract void onModify(int x, int z, Hunk<T> output);
|
||||
|
||||
@Override
|
||||
public void modify(Hunk<T> output) {
|
||||
onModify(output);
|
||||
public void modify(int x, int z, Hunk<T> output) {
|
||||
onModify(x, z, output);
|
||||
}
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ package com.volmit.iris.v2.scaffold.engine;
|
||||
import com.volmit.iris.v2.scaffold.hunk.Hunk;
|
||||
|
||||
public interface EngineModifier<T> extends EngineComponent {
|
||||
public void modify(Hunk<T> t);
|
||||
public void modify(int x, int z, Hunk<T> t);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.lang.reflect.Parameter;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.volmit.iris.object.*;
|
||||
import com.volmit.iris.util.*;
|
||||
import com.volmit.iris.v2.scaffold.parallax.ParallaxChunkMeta;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
@ -11,12 +12,6 @@ import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.manager.IrisDataManager;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisDepositGenerator;
|
||||
import com.volmit.iris.object.IrisObject;
|
||||
import com.volmit.iris.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.object.IrisTextPlacement;
|
||||
import com.volmit.iris.v2.generator.IrisComplex;
|
||||
import com.volmit.iris.v2.scaffold.cache.Cache;
|
||||
import com.volmit.iris.v2.scaffold.data.DataProvider;
|
||||
@ -129,12 +124,13 @@ public interface EngineParallax extends DataProvider, IObjectPlacer
|
||||
|
||||
getParallaxAccess().setParallaxGenerated(x>>4, z>>4);
|
||||
RNG rng = new RNG(Cache.key(x, z)).nextParallelRNG(getEngine().getTarget().getWorld().getSeed());
|
||||
generateParallaxSurface(rng, x, z);
|
||||
IrisRegion region = getComplex().getRegionStream().get(x+8, z+8);
|
||||
IrisBiome biome = getComplex().getTrueBiomeStream().get(x+8, z+8);
|
||||
generateParallaxSurface(rng, x, z, biome);
|
||||
generateParallaxMutations(rng, x, z);
|
||||
}
|
||||
|
||||
default void generateParallaxSurface(RNG rng, int x, int z) {
|
||||
IrisBiome biome = getComplex().getTrueBiomeStream().get(x + 8, z + 8);
|
||||
|
||||
default void generateParallaxSurface(RNG rng, int x, int z, IrisBiome biome) {
|
||||
for (IrisObjectPlacement i : biome.getSurfaceObjects())
|
||||
{
|
||||
if(rng.chance(i.getChance()))
|
||||
@ -144,6 +140,37 @@ public interface EngineParallax extends DataProvider, IObjectPlacer
|
||||
}
|
||||
}
|
||||
|
||||
default void generateParallaxMutations(RNG rng, int x, int z) {
|
||||
if(getEngine().getDimension().getMutations().isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
searching: for(IrisBiomeMutation k : getEngine().getDimension().getMutations())
|
||||
{
|
||||
for(int l = 0; l < k.getChecks(); l++)
|
||||
{
|
||||
IrisBiome sa = getComplex().getTrueBiomeStream().get(((x * 16) + rng.nextInt(16)) + rng.i(-k.getRadius(), k.getRadius()), ((z * 16) + rng.nextInt(16)) + rng.i(-k.getRadius(), k.getRadius()));
|
||||
IrisBiome sb = getComplex().getTrueBiomeStream().get(((x * 16) + rng.nextInt(16)) + rng.i(-k.getRadius(), k.getRadius()), ((z * 16) + rng.nextInt(16)) + rng.i(-k.getRadius(), k.getRadius()));
|
||||
|
||||
if(sa.getLoadKey().equals(sb.getLoadKey()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if(k.getRealSideA(this).contains(sa.getLoadKey()) && k.getRealSideB(this).contains(sb.getLoadKey()))
|
||||
{
|
||||
for(IrisObjectPlacement m : k.getObjects())
|
||||
{
|
||||
place(rng.nextParallelRNG((34 * ((x * 30) + (z * 30)) * x * z) + x - z + 1569962), x, z, m);
|
||||
}
|
||||
|
||||
continue searching;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
default void place(RNG rng, int x, int z, IrisObjectPlacement objectPlacement)
|
||||
{
|
||||
place(rng, x,-1, z, objectPlacement);
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.v2.scaffold.parallel.BurstExecutor;
|
||||
import com.volmit.iris.v2.scaffold.parallel.MultiBurst;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
|
||||
public interface Hunk<T>
|
||||
{
|
||||
@ -604,6 +605,82 @@ public interface Hunk<T>
|
||||
return compute2D(getIdeal2DParallelism(), v);
|
||||
}
|
||||
|
||||
public static <A, B> void compute2D(int parallelism, Hunk<A> a, Hunk<B> b, Consumer5<Integer, Integer, Integer, Hunk<A>, Hunk<B>> v)
|
||||
{
|
||||
if(a.getWidth() != b.getWidth() || a.getHeight() != b.getHeight() || a.getDepth() != b.getDepth())
|
||||
{
|
||||
throw new RuntimeException("Hunk sizes must match!");
|
||||
}
|
||||
|
||||
if(a.get2DDimension(parallelism) == 1)
|
||||
{
|
||||
v.accept(0, 0, 0, a, b);
|
||||
return;
|
||||
}
|
||||
|
||||
BurstExecutor e = MultiBurst.burst.burst(parallelism);
|
||||
KList<Runnable> rq = new KList<Runnable>(parallelism);
|
||||
getDualSections2D(parallelism, a, b, (xx, yy, zz, ha, hr, r) -> e.queue(() ->
|
||||
{
|
||||
v.accept(xx, yy, zz, ha, hr);
|
||||
|
||||
synchronized(rq)
|
||||
{
|
||||
rq.add(r);
|
||||
}
|
||||
}), (x, y, z, hax, hbx) -> {
|
||||
a.insert(x, y, z, hax);
|
||||
b.insert(x, y, z, hbx);
|
||||
});
|
||||
e.complete();
|
||||
rq.forEach(Runnable::run);
|
||||
return;
|
||||
}
|
||||
|
||||
public static <A, B> void getDualSections2D(int sections, Hunk<A> a, Hunk<B> b, Consumer6<Integer, Integer, Integer, Hunk<A>, Hunk<B>, Runnable> v, Consumer5<Integer, Integer, Integer, Hunk<A>, Hunk<B>> inserterAB)
|
||||
{
|
||||
if(a.getWidth() != b.getWidth() || a.getHeight() != b.getHeight() || a.getDepth() != b.getDepth())
|
||||
{
|
||||
throw new RuntimeException("Hunk sizes must match!");
|
||||
}
|
||||
|
||||
int dim = a.get2DDimension(sections);
|
||||
|
||||
if(sections <= 1)
|
||||
{
|
||||
getDualSection(0, 0, 0, a.getWidth(), a.getHeight(), a.getDepth(), a, b, (ha, hr, r) -> v.accept(0, 0, 0, ha, hr, r), inserterAB);
|
||||
return;
|
||||
}
|
||||
|
||||
int w = a.getWidth() / dim;
|
||||
int wr = a.getWidth() - (w * dim);
|
||||
int d = a.getDepth() / dim;
|
||||
int dr = a.getDepth() - (d * dim);
|
||||
int i, j;
|
||||
|
||||
for(i = 0; i < a.getWidth(); i += w)
|
||||
{
|
||||
int ii = i;
|
||||
|
||||
for(j = 0; j < a.getDepth(); j += d)
|
||||
{
|
||||
int jj = j;
|
||||
getDualSection(i, 0, j, i + w + (i == 0 ? wr : 0), a.getHeight(),
|
||||
j + d + (j == 0 ? dr : 0), a, b,
|
||||
(ha, hr, r) -> v.accept(ii, 0, jj, ha, hr, r), inserterAB);
|
||||
i = i == 0 ? i + wr : i;
|
||||
j = j == 0 ? j + dr : j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static <A, B> void getDualSection(int x, int y, int z, int x1, int y1, int z1, Hunk<A> a, Hunk<B> b, Consumer3<Hunk<A>, Hunk<B>, Runnable> v, Consumer5<Integer, Integer, Integer, Hunk<A>, Hunk<B>> inserter)
|
||||
{
|
||||
Hunk<A> copya = a.crop(x, y, z, x1, y1, z1);
|
||||
Hunk<B> copyb = b.crop(x, y, z, x1, y1, z1);
|
||||
v.accept(copya, copyb, () -> inserter.accept(x, y, z, copya, copyb));
|
||||
}
|
||||
|
||||
default Hunk<T> compute2D(int parallelism, Consumer4<Integer, Integer, Integer, Hunk<T>> v)
|
||||
{
|
||||
if(get2DDimension(parallelism) == 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user