This commit is contained in:
cyberpwn 2021-08-21 21:41:37 -04:00
parent b62e542801
commit 33812b3f4a
22 changed files with 113 additions and 355 deletions

View File

@ -699,7 +699,7 @@ public class Iris extends VolmitPlugin implements Listener {
} }
} }
public static synchronized void reportError(Throwable e) { public static void reportError(Throwable e) {
if (IrisSettings.get().getGeneral().isDebug()) { if (IrisSettings.get().getGeneral().isDebug()) {
String n = e.getClass().getCanonicalName() + "-" + e.getStackTrace()[0].getClassName() + "-" + e.getStackTrace()[0].getLineNumber(); String n = e.getClass().getCanonicalName() + "-" + e.getStackTrace()[0].getClassName() + "-" + e.getStackTrace()[0].getLineNumber();

View File

@ -32,6 +32,7 @@ import org.bukkit.enchantments.Enchantment;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import java.awt.*; import java.awt.*;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.List; import java.util.List;
@ -536,8 +537,8 @@ public class SchemaBuilder {
d.add("* Default Value is " + value); d.add("* Default Value is " + value);
} }
} }
} catch (Throwable e) { } catch (Throwable ignored) {
Iris.reportError(e);
} }
description.forEach((g) -> d.add(g.trim())); description.forEach((g) -> d.add(g.trim()));

View File

@ -30,7 +30,6 @@ import com.volmit.iris.engine.object.biome.IrisBiome;
import com.volmit.iris.engine.object.common.CaveResult; import com.volmit.iris.engine.object.common.CaveResult;
import com.volmit.iris.engine.object.decoration.IrisDecorationPart; import com.volmit.iris.engine.object.decoration.IrisDecorationPart;
import com.volmit.iris.engine.object.decoration.IrisDecorator; import com.volmit.iris.engine.object.decoration.IrisDecorator;
import com.volmit.iris.engine.object.dimensional.IrisTerrainMode;
import com.volmit.iris.engine.object.feature.IrisFeaturePositional; import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
import com.volmit.iris.engine.object.noise.IrisGenerator; import com.volmit.iris.engine.object.noise.IrisGenerator;
import com.volmit.iris.engine.object.noise.IrisInterpolator; import com.volmit.iris.engine.object.noise.IrisInterpolator;
@ -65,9 +64,6 @@ public class IrisComplex implements DataProvider {
private ProceduralStream<Double> regionStyleStream; private ProceduralStream<Double> regionStyleStream;
private ProceduralStream<Double> regionIdentityStream; private ProceduralStream<Double> regionIdentityStream;
private ProceduralStream<UUID> regionIDStream; private ProceduralStream<UUID> regionIDStream;
private ProceduralStream<Boolean> islandStream;
private ProceduralStream<Double> islandHeightStream;
private ProceduralStream<Double> islandDepthStream;
private ProceduralStream<InferredType> bridgeStream; private ProceduralStream<InferredType> bridgeStream;
private ProceduralStream<IrisBiome> landBiomeStream; private ProceduralStream<IrisBiome> landBiomeStream;
private ProceduralStream<IrisBiome> caveBiomeStream; private ProceduralStream<IrisBiome> caveBiomeStream;
@ -86,8 +82,6 @@ public class IrisComplex implements DataProvider {
private ProceduralStream<Double> heightFluidStream; private ProceduralStream<Double> heightFluidStream;
private ProceduralStream<Integer> trueHeightStream; private ProceduralStream<Integer> trueHeightStream;
private ProceduralStream<Double> slopeStream; private ProceduralStream<Double> slopeStream;
private ProceduralStream<Integer> islandTopStream;
private ProceduralStream<Integer> islandBottomStream;
private ProceduralStream<Integer> topSurfaceStream; private ProceduralStream<Integer> topSurfaceStream;
private ProceduralStream<RNG> rngStream; private ProceduralStream<RNG> rngStream;
private ProceduralStream<RNG> chunkRngStream; private ProceduralStream<RNG> chunkRngStream;
@ -167,11 +161,6 @@ public class IrisComplex implements DataProvider {
: regionStyleStream : regionStyleStream
.selectRarity(engine.getDimension().getRegions(), (i) -> data.getRegionLoader().load(i)) .selectRarity(engine.getDimension().getRegions(), (i) -> data.getRegionLoader().load(i))
.convertCached((s) -> data.getRegionLoader().load(s)).cache2D(cacheSize); .convertCached((s) -> data.getRegionLoader().load(s)).cache2D(cacheSize);
islandStream = regionStyleStream
.seededChance(rng.nextParallelRNG(29349), 23968888888L,
1D / engine.getDimension().getIslandMode().getIslandChance());
islandHeightStream = regionIdentityStream.style(rng.nextParallelRNG(330466), engine.getDimension().getIslandMode().getHeight(), data);
islandDepthStream = engine.getDimension().getIslandMode().getIslandDepth().stream(rng.nextParallelRNG(-39578888), data);
regionIDStream = regionIdentityStream.convertCached((i) -> new UUID(Double.doubleToLongBits(i), String.valueOf(i * 38445).hashCode() * 3245556666L)); regionIDStream = regionIdentityStream.convertCached((i) -> new UUID(Double.doubleToLongBits(i), String.valueOf(i * 38445).hashCode() * 3245556666L));
caveBiomeStream = regionStream.convert((r) caveBiomeStream = regionStream.convert((r)
-> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(InferredType.CAVE.ordinal()), getData()).stream() -> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(InferredType.CAVE.ordinal()), getData()).stream()
@ -334,7 +323,6 @@ public class IrisComplex implements DataProvider {
int heightf = (int) Math.round(getHeightStream().get(rx, rz)); int heightf = (int) Math.round(getHeightStream().get(rx, rz));
int m = heightf; int m = heightf;
if (engine.getDimension().isCarving() && engine.getDimension().getTerrainMode().equals(IrisTerrainMode.NORMAL)) {
if (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getTerrainActuator()).getRng(), heightf)) { if (engine.getDimension().isCarved(getData(), rx, m, rz, ((IrisTerrainNormalActuator) engine.getTerrainActuator()).getRng(), heightf)) {
m--; m--;
@ -342,7 +330,6 @@ public class IrisComplex implements DataProvider {
m--; m--;
} }
} }
}
if (engine.getDimension().isCaves()) { if (engine.getDimension().isCaves()) {
KList<CaveResult> caves = ((IrisCaveModifier) engine.getCaveModifier()).genCaves(rx, rz, 0, 0, null); KList<CaveResult> caves = ((IrisCaveModifier) engine.getCaveModifier()).genCaves(rx, rz, 0, 0, null);
@ -367,27 +354,9 @@ public class IrisComplex implements DataProvider {
d.hashCode()); d.hashCode());
}) })
.cache2D(cacheSize); .cache2D(cacheSize);
islandTopStream = islandStream.convertAware2D((i, x, z) ->
i ? heightStream.round()
.subtract(fluidHeight)
.add((xx, zz) -> getIslandHeight(xx.intValue(), zz.intValue(), engine.getDimension()
.getIslandMode().getIslandEdgeInterpolator()))
.get(x, z) : 0);
islandBottomStream = islandStream.convertAware2D((i, x, z) ->
i ? islandHeightStream.subtract(islandDepthStream).round().get(x, z) : 0);
//@done //@done
} }
private double getIslandHeight(int x, int z, IrisInterpolator interp) {
return interp.interpolate(x, z, (xx, zz) -> {
if (getIslandStream().get(xx, zz)) {
return getIslandHeightStream().get(xx, zz);
}
return 0;
});
}
private IrisRegion findRegion(IrisBiome focus, Engine engine) { private IrisRegion findRegion(IrisBiome focus, Engine engine) {
for (IrisRegion i : engine.getDimension().getAllRegions(engine)) { for (IrisRegion i : engine.getDimension().getAllRegions(engine)) {
if (i.getAllBiomeIds().contains(focus.getLoadKey())) { if (i.getAllBiomeIds().contains(focus.getLoadKey())) {

View File

@ -26,7 +26,6 @@ import com.volmit.iris.core.events.IrisEngineHotloadEvent;
import com.volmit.iris.core.service.PreservationSVC; import com.volmit.iris.core.service.PreservationSVC;
import com.volmit.iris.engine.actuator.IrisBiomeActuator; import com.volmit.iris.engine.actuator.IrisBiomeActuator;
import com.volmit.iris.engine.actuator.IrisDecorantActuator; import com.volmit.iris.engine.actuator.IrisDecorantActuator;
import com.volmit.iris.engine.actuator.IrisTerrainIslandActuator;
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator; import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
import com.volmit.iris.engine.data.cache.AtomicCache; import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.*; import com.volmit.iris.engine.framework.*;
@ -96,8 +95,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
private double maxBiomeLayerDensity; private double maxBiomeLayerDensity;
private double maxBiomeDecoratorDensity; private double maxBiomeDecoratorDensity;
private IrisComplex complex; private IrisComplex complex;
private EngineActuator<BlockData> terrainNormalActuator; private EngineActuator<BlockData> terrainActuator;
private EngineActuator<BlockData> terrainIslandActuator;
private EngineActuator<BlockData> decorantActuator; private EngineActuator<BlockData> decorantActuator;
private EngineActuator<Biome> biomeActuator; private EngineActuator<Biome> biomeActuator;
private EngineModifier<BlockData> depositModifier; private EngineModifier<BlockData> depositModifier;
@ -146,8 +144,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
worldManager.close(); worldManager.close();
complex.close(); complex.close();
execution.close(); execution.close();
terrainNormalActuator.close(); terrainActuator.close();
terrainIslandActuator.close();
decorantActuator.close(); decorantActuator.close();
biomeActuator.close(); biomeActuator.close();
depositModifier.close(); depositModifier.close();
@ -166,8 +163,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
worldManager = new IrisWorldManager(this); worldManager = new IrisWorldManager(this);
complex = new IrisComplex(this); complex = new IrisComplex(this);
execution = new IrisExecutionEnvironment(this); execution = new IrisExecutionEnvironment(this);
terrainNormalActuator = new IrisTerrainNormalActuator(this); terrainActuator = new IrisTerrainNormalActuator(this);
terrainIslandActuator = new IrisTerrainIslandActuator(this);
decorantActuator = new IrisDecorantActuator(this); decorantActuator = new IrisDecorantActuator(this);
biomeActuator = new IrisBiomeActuator(this); biomeActuator = new IrisBiomeActuator(this);
depositModifier = new IrisDepositModifier(this); depositModifier = new IrisDepositModifier(this);
@ -387,13 +383,6 @@ public class IrisEngine extends BlockPopulator implements Engine {
}); });
} }
public EngineActuator<BlockData> getTerrainActuator() {
return switch (getDimension().getTerrainMode()) {
case NORMAL -> getTerrainNormalActuator();
case ISLANDS -> getTerrainIslandActuator();
};
}
@BlockCoordinates @BlockCoordinates
@Override @Override
public double modifyX(double x) { public double modifyX(double x) {
@ -420,29 +409,22 @@ public class IrisEngine extends BlockPopulator implements Engine {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t)); Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
switch (getDimension().getTerrainMode()) {
case NORMAL -> {
getMantle().generateMatter(x >> 4, z >> 4, multicore); getMantle().generateMatter(x >> 4, z >> 4, multicore);
burst().burst( burst().burst(multicore,
() ->getTerrainActuator().actuate(x, z, vblocks, multicore), () -> getTerrainActuator().actuate(x, z, vblocks, multicore),
() ->getBiomeActuator().actuate(x, z, vbiomes, multicore) () -> getBiomeActuator().actuate(x, z, vbiomes, multicore)
); );
burst().burst( burst().burst(multicore,
() ->getCaveModifier().modify(x, z, vblocks, multicore), () -> getCaveModifier().modify(x, z, vblocks, multicore),
()->getDecorantActuator().actuate(x, z, blocks, multicore), () -> getDecorantActuator().actuate(x, z, blocks, multicore),
()->getRavineModifier().modify(x, z, vblocks, multicore), () -> getRavineModifier().modify(x, z, vblocks, multicore),
()->getPostModifier().modify(x, z, vblocks, multicore) () -> getPostModifier().modify(x, z, vblocks, multicore)
); );
burst().burst( burst().burst(multicore,
()->getDecorantActuator().actuate(x, z, blocks, multicore), () -> getDecorantActuator().actuate(x, z, blocks, multicore),
()->getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore), () -> getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore),
()->getDepositModifier().modify(x, z, blocks, multicore) () -> getDepositModifier().modify(x, z, blocks, multicore)
); );
}
case ISLANDS -> {
getTerrainActuator().actuate(x, z, vblocks, multicore);
}
}
getMetrics().getTotal().put(p.getMilliseconds()); getMetrics().getTotal().put(p.getMilliseconds());
generated.incrementAndGet(); generated.incrementAndGet();

View File

@ -68,7 +68,7 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
@Override @Override
public void onActuate(int x, int z, Hunk<Biome> h, boolean multicore) { public void onActuate(int x, int z, Hunk<Biome> h, boolean multicore) {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
BurstExecutor burst = burst().burst(); BurstExecutor burst = burst().burst(multicore);
for (int xf = 0; xf < h.getWidth(); xf++) { for (int xf = 0; xf < h.getWidth(); xf++) {
int finalXf = xf; int finalXf = xf;

View File

@ -90,7 +90,7 @@ public class IrisDecorantActuator extends EngineAssignedActuator<BlockData> {
} }
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
BurstExecutor burst = burst().burst(); BurstExecutor burst = burst().burst(multicore);
for (int i = 0; i < output.getWidth(); i++) { for (int i = 0; i < output.getWidth(); i++) {
int finalI = i; int finalI = i;

View File

@ -1,95 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.actuator;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineAssignedActuator;
import com.volmit.iris.engine.object.biome.IrisBiome;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.hunk.Hunk;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import lombok.Getter;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
public class IrisTerrainIslandActuator extends EngineAssignedActuator<BlockData> {
private static final BlockData AIR = Material.AIR.createBlockData();
private static final BlockData BEDROCK = Material.BEDROCK.createBlockData();
private static final BlockData WEB = Material.COBWEB.createBlockData();
private static final BlockData BLACK_GLASS = Material.BLACK_STAINED_GLASS.createBlockData();
private static final BlockData WHITE_GLASS = Material.WHITE_STAINED_GLASS.createBlockData();
private static final BlockData CAVE_AIR = Material.CAVE_AIR.createBlockData();
@Getter
private final RNG rng;
private final boolean carving;
@Getter
private final int lastBedrock = -1;
public IrisTerrainIslandActuator(Engine engine) {
super(engine, "TerrainIsland");
rng = new RNG(engine.getWorld().seed());
carving = getDimension().isCarving() && getDimension().getCarveLayers().isNotEmpty();
}
@BlockCoordinates
@Override
public void onActuate(int x, int z, Hunk<BlockData> h, boolean multicore) {
PrecisionStopwatch p = PrecisionStopwatch.start();
int i, zf, depth, surface, realX, realZ;
IrisBiome biome;
KList<BlockData> blocks, fblocks;
int hi, lo;
double hh;
for (int xf = 0; xf < h.getWidth(); xf++) {
for (zf = 0; zf < h.getDepth(); zf++) {
realX = (int) modX(xf + x);
realZ = (int) modZ(zf + z);
if (getComplex().getIslandStream().get(realX, realZ)) {
biome = getComplex().getTrueBiomeStream().get(realX, realZ);
hh = getComplex().getTrueHeightStream().get(realX, realZ) - getComplex().getFluidHeight();
depth = (int) (getComplex().getIslandDepthStream().get(realX, realZ).intValue() + hh);
blocks = biome.generateLayers(realX, realZ, rng, depth, depth, getData(), getComplex());
hi = getComplex().getIslandTopStream().get(realX, realZ);
lo = getComplex().getIslandBottomStream().get(realX, realZ);
// 10
// 6
// hf = 4
for (i = hi; i >= lo; i--) {
int hf = (i - hi);
if (blocks.hasIndex(hf)) {
h.set(xf, i, zf, blocks.get(hf));
continue;
}
h.set(xf, i, zf, getComplex().getRockStream().get(realX, realZ));
}
}
}
}
getEngine().getMetrics().getTerrain().put(p.getMilliseconds());
}
}

View File

@ -55,7 +55,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
public void onActuate(int x, int z, Hunk<BlockData> h, boolean multicore) { public void onActuate(int x, int z, Hunk<BlockData> h, boolean multicore) {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
BurstExecutor e = getEngine().burst().burst(h.getWidth()); BurstExecutor e = burst().burst(multicore);
for (int xf = 0; xf < h.getWidth(); xf++) { for (int xf = 0; xf < h.getWidth(); xf++) {
int finalXf = xf; int finalXf = xf;
e.queue(() -> terrainSliver(x, z, finalXf, h)); e.queue(() -> terrainSliver(x, z, finalXf, h));

View File

@ -434,13 +434,6 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
IrisDimension dim = getDimension(); IrisDimension dim = getDimension();
dim.getAllBiomes(this).forEach((i) -> v.put(i.getLoadKey(), i)); dim.getAllBiomes(this).forEach((i) -> v.put(i.getLoadKey(), i));
try {
dim.getDimensionalComposite().forEach((m) -> getData().getDimensionLoader().load(m.getDimension()).getAllBiomes(this).forEach((i) -> v.put(i.getLoadKey(), i)));
} catch (Throwable ignored) {
Iris.reportError(ignored);
}
return v.v(); return v.v();
} }

View File

@ -186,7 +186,7 @@ public interface EngineMantle extends IObjectPlacer {
} }
}; };
int s = getRealRadius(); int s = getRealRadius();
BurstExecutor burst = burst().burst(); BurstExecutor burst = burst().burst(multicore);
for (int i = -s; i <= s; i++) { for (int i = -s; i <= s; i++) {
for (int j = -s; j <= s; j++) { for (int j = -s; j <= s; j++) {
@ -204,7 +204,7 @@ public interface EngineMantle extends IObjectPlacer {
{ {
KList<Runnable> px = post.copy(); KList<Runnable> px = post.copy();
post.clear(); post.clear();
burst().burst(px); burst().burst(multicore, px);
} }
} }

View File

@ -55,20 +55,13 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData> {
} }
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
if (multicore) { BurstExecutor e = burst().burst(multicore);
BurstExecutor e = getEngine().burst().burst(a.getWidth());
for (int i = 0; i < a.getWidth(); i++) { for (int i = 0; i < a.getWidth(); i++) {
int finalI = i; int finalI = i;
e.queue(() -> modifySliver(x, z, finalI, a)); e.queue(() -> modifySliver(x, z, finalI, a));
} }
e.complete(); e.complete();
} else {
for (int i = 0; i < a.getWidth(); i++) {
modifySliver(x, z, i, a);
}
}
getEngine().getMetrics().getCave().put(p.getMilliseconds()); getEngine().getMetrics().getCave().put(p.getMilliseconds());
} }

View File

@ -54,7 +54,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
RNG ro = rx.nextParallelRNG(x * x).nextParallelRNG(z * z); RNG ro = rx.nextParallelRNG(x * x).nextParallelRNG(z * z);
IrisRegion region = getComplex().getRegionStream().get((x * 16) + 7, (z * 16) + 7); IrisRegion region = getComplex().getRegionStream().get((x * 16) + 7, (z * 16) + 7);
IrisBiome biome = getComplex().getTrueBiomeStream().get((x * 16) + 7, (z * 16) + 7); IrisBiome biome = getComplex().getTrueBiomeStream().get((x * 16) + 7, (z * 16) + 7);
BurstExecutor burst = burst().burst(); BurstExecutor burst = burst().burst(multicore);
for (IrisDepositGenerator k : getDimension().getDeposits()) { for (IrisDepositGenerator k : getDimension().getDeposits()) {
burst.queue(() -> generate(k, terrain, ro, x, z, false)); burst.queue(() -> generate(k, terrain, ro, x, z, false));

View File

@ -64,7 +64,7 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
AtomicInteger i = new AtomicInteger(); AtomicInteger i = new AtomicInteger();
AtomicInteger j = new AtomicInteger(); AtomicInteger j = new AtomicInteger();
BurstExecutor burst = burst().burst(); BurstExecutor burst = burst().burst(multicore);
Hunk<BlockData> sync = output.synchronize(); Hunk<BlockData> sync = output.synchronize();
for (i.set(0); i.get() < output.getWidth(); i.getAndIncrement()) { for (i.set(0); i.get() < output.getWidth(); i.getAndIncrement()) {
burst.queue(() -> { burst.queue(() -> {

View File

@ -193,17 +193,15 @@ public class IrisBlockData extends IrisRegistrant {
} }
try { try {
return Integer.valueOf(string); return Integer.parseInt(string);
} catch (Throwable e) { } catch (Throwable ignored) {
Iris.reportError(e); // Checks
} }
try { try {
return Double.valueOf(string).intValue(); return Double.valueOf(string).intValue();
} catch (Throwable e) { } catch (Throwable ignored) {
Iris.reportError(e); // Checks
} }
return string; return string;

View File

@ -81,13 +81,6 @@ public class IrisDimension extends IrisRegistrant {
@Desc("The human readable name of this dimension") @Desc("The human readable name of this dimension")
private String name = "A Dimension"; private String name = "A Dimension";
@Desc("You can create mutliple dimensions on top of each other taking up less height of the same world. Such as the nether with a floor + ceiling.")
@ArrayType(min = 1, type = IrisDimensionIndex.class)
private KList<IrisDimensionIndex> dimensionalComposite = new KList<>();
@Desc("Create an inverted dimension in the sky (like the nether)")
private IrisDimension sky = null;
@RegistryListResource(IrisJigsawStructure.class) @RegistryListResource(IrisJigsawStructure.class)
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.") @Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
private String stronghold; private String stronghold;
@ -285,12 +278,6 @@ public class IrisDimension extends IrisRegistrant {
@Desc("Change the size of regions") @Desc("Change the size of regions")
private double regionZoom = 1; private double regionZoom = 1;
@Desc("The terrain mode. NORMAL is normal... ISLANDS creates floating islands at varied heights")
private IrisTerrainMode terrainMode = IrisTerrainMode.NORMAL;
@Desc("The configuration for island mode dimensions")
private IrisTerrainIsland islandMode = new IrisTerrainIsland();
@Desc("Disable this to stop placing objects, entities, features & updates") @Desc("Disable this to stop placing objects, entities, features & updates")
private boolean useMantle = true; private boolean useMantle = true;
@ -358,10 +345,6 @@ public class IrisDimension extends IrisRegistrant {
}); });
} }
public boolean hasSky() {
return getSky() != null;
}
public CNG getCoordFracture(RNG rng, int signature) { public CNG getCoordFracture(RNG rng, int signature) {
return coordFracture.aquire(() -> return coordFracture.aquire(() ->
{ {

View File

@ -1,54 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object.dimensional;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.RegistryListResource;
import com.volmit.iris.engine.object.annotations.Required;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@SuppressWarnings("DefaultAnnotationParam")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents an index for dimensions to take up vertical slots in the same world")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisDimensionIndex {
@Required
@Desc("The weight of this dimension. If there are 2 dimensions, if the weight is the same on both, both dimensions will take up 128 blocks of height.")
private double weight = 1D;
@Desc("If inverted is set to true, the dimension will be updide down in the world")
private boolean inverted = false;
@Desc("Only one dimension layer should be set to primary. The primary dimension layer is where players spawn, and the biomes that the vanilla structure system uses to figure out what structures to place.")
private boolean primary = false;
@Required
@RegistryListResource(IrisDimension.class)
@MinNumber(1)
@Desc("Name of dimension")
private String dimension = "";
}

View File

@ -1,50 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object.dimensional;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.noise.IrisInterpolator;
import com.volmit.iris.engine.object.noise.IrisStyledRange;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisTerrainIsland {
@Desc("The height range")
private IrisStyledRange height = new IrisStyledRange().setMin(60).setMax(160);
@Desc("How deep the island can get")
private IrisStyledRange islandDepth = new IrisStyledRange().setMin(60).setMax(160);
@MinNumber(1)
@MaxNumber(10000)
@Desc("How often are regions islands instead of nothing?")
private double islandChance = 0.5;
@Desc("Interpolate the edges of islands")
private IrisInterpolator islandEdgeInterpolator = new IrisInterpolator();
}

View File

@ -1,29 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object.dimensional;
import com.volmit.iris.engine.object.annotations.Desc;
@Desc("Terrain modes are used to decide the generator type currently used")
public enum IrisTerrainMode {
@Desc("Normal terrain, similar to the vanilla overworld")
NORMAL,
@Desc("Island terrain, more similar to the end, but endless possibilities!")
ISLANDS
}

View File

@ -281,7 +281,7 @@ public class IrisObject extends IrisRegistrant {
this.h = din.readInt(); this.h = din.readInt();
this.d = din.readInt(); this.d = din.readInt();
if (!din.readUTF().equals("Iris V2 IOB;")) { if (!din.readUTF().equals("Iris V2 IOB;")) {
throw new IOException("Not V2 Format"); return;
} }
center = new BlockVector(w / 2, h / 2, d / 2); center = new BlockVector(w / 2, h / 2, d / 2);
int s = din.readShort(); int s = din.readShort();

View File

@ -29,6 +29,8 @@ import java.util.concurrent.*;
public class BurstExecutor { public class BurstExecutor {
private final ExecutorService executor; private final ExecutorService executor;
private final KList<Future<?>> futures; private final KList<Future<?>> futures;
@Setter
private boolean multicore = true;
public BurstExecutor(ExecutorService executor, int burstSizeEstimate) { public BurstExecutor(ExecutorService executor, int burstSizeEstimate) {
this.executor = executor; this.executor = executor;
@ -46,6 +48,16 @@ public class BurstExecutor {
} }
public BurstExecutor queue(List<Runnable> r) { public BurstExecutor queue(List<Runnable> r) {
if(!multicore)
{
for(Runnable i : new KList<>(r))
{
i.run();
}
return this;
}
synchronized (futures) { synchronized (futures) {
for (Runnable i : new KList<>(r)) { for (Runnable i : new KList<>(r)) {
queue(i); queue(i);
@ -56,6 +68,16 @@ public class BurstExecutor {
} }
public BurstExecutor queue(Runnable[] r) { public BurstExecutor queue(Runnable[] r) {
if(!multicore)
{
for(Runnable i : new KList<>(r))
{
i.run();
}
return this;
}
synchronized (futures) { synchronized (futures) {
for (Runnable i : r) { for (Runnable i : r) {
queue(i); queue(i);
@ -66,6 +88,11 @@ public class BurstExecutor {
} }
public void complete() { public void complete() {
if(!multicore)
{
return;
}
synchronized (futures) { synchronized (futures) {
if (futures.isEmpty()) { if (futures.isEmpty()) {
return; return;
@ -85,6 +112,11 @@ public class BurstExecutor {
} }
public boolean complete(long maxDur) { public boolean complete(long maxDur) {
if(!multicore)
{
return true;
}
synchronized (futures) { synchronized (futures) {
if (futures.isEmpty()) { if (futures.isEmpty()) {
return true; return true;

View File

@ -72,10 +72,40 @@ public class MultiBurst {
burst(r.length).queue(r).complete(); burst(r.length).queue(r).complete();
} }
public void burst(boolean multicore, Runnable... r) {
if(multicore)
{
burst(r);
}
else
{
sync(r);
}
}
public void burst(List<Runnable> r) { public void burst(List<Runnable> r) {
burst(r.size()).queue(r).complete(); burst(r.size()).queue(r).complete();
} }
public void burst(boolean multicore, List<Runnable> r) {
if(multicore)
{
burst(r);
}
else {
sync(r);
}
}
private void sync(List<Runnable> r) {
for(Runnable i : new KList<>(r))
{
i.run();
}
}
public void sync(Runnable... r) { public void sync(Runnable... r) {
for (Runnable i : r) { for (Runnable i : r) {
i.run(); i.run();
@ -96,6 +126,12 @@ public class MultiBurst {
return burst(16); return burst(16);
} }
public BurstExecutor burst(boolean multicore) {
BurstExecutor b = burst();
b.setMulticore(multicore);
return b;
}
public <T> Future<T> lazySubmit(Callable<T> o) { public <T> Future<T> lazySubmit(Callable<T> o) {
return getService().submit(o); return getService().submit(o);
} }

View File

@ -129,7 +129,6 @@ public class J {
try { try {
r.run(); r.run();
} catch (Throwable e) { } catch (Throwable e) {
Iris.reportError(e);
return e; return e;
} }