mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-20 15:26:51 +00:00
[VERY VERY VERY BAD IDEA]
This commit is contained in:
1 parent
f0e7fea13b
commit
2fa0853e42
892 files changed
+13482
-53554
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ import art.arcane.iris.platform.bukkit.BukkitBlockResolution;
|
||||
import art.arcane.iris.spi.IrisServices;
|
||||
import art.arcane.iris.testsupport.BukkitTestServer;
|
||||
import art.arcane.iris.generation.block.IrisCustomData;
|
||||
import art.arcane.iris.platform.bukkit.registry.RegistryUtil;
|
||||
import art.arcane.iris.platform.registry.RegistryUtil;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import net.momirealms.craftengine.bukkit.api.CraftEngineBlocks;
|
||||
import net.momirealms.craftengine.bukkit.api.CraftEngineFurniture;
|
||||
|
||||
@@ -26,7 +26,7 @@ import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.Required;
|
||||
import art.arcane.iris.pack.schema.annotation.Snippet;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformWorld;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeWorld;
|
||||
import art.arcane.iris.world.task.J;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import lombok.Data;
|
||||
@@ -60,11 +60,11 @@ public class IrisCommand {
|
||||
@Description("The weather that is required for the command to execute.")
|
||||
private IrisWeather weather = IrisWeather.ANY;
|
||||
|
||||
public boolean isValid(PlatformWorld world) {
|
||||
public boolean isValid(NativeWorld world) {
|
||||
return timeBlock.isWithin(world) && weather.is(world);
|
||||
}
|
||||
|
||||
public void run(PlatformWorld world, int x, int y, int z) {
|
||||
public void run(NativeWorld world, int x, int y, int z) {
|
||||
if (!isValid(world)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.Required;
|
||||
import art.arcane.iris.pack.schema.annotation.Snippet;
|
||||
import art.arcane.iris.platform.bukkit.BukkitWorld;
|
||||
import art.arcane.iris.spi.PlatformWorld;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeWorld;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import lombok.Data;
|
||||
@@ -75,7 +75,7 @@ public class IrisCommandRegistry {
|
||||
|
||||
public void run(Player p) {
|
||||
if (rawCommands.isNotEmpty()) {
|
||||
PlatformWorld world = new BukkitWorld(p.getWorld());
|
||||
NativeWorld world = new BukkitWorld(p.getWorld());
|
||||
Location part = p.getLocation().clone().add(
|
||||
commandRandomAltX ? RNG.r.d(-commandOffsetX, commandOffsetX) : commandOffsetX,
|
||||
commandRandomAltY ? RNG.r.d(-commandOffsetY, commandOffsetY) : commandOffsetY,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package art.arcane.iris.command.handlers;
|
||||
|
||||
import art.arcane.iris.platform.bukkit.nms.datapack.DataVersion;
|
||||
import art.arcane.iris.pack.datapack.DataVersion;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.director.DirectorParameterHandler;
|
||||
import art.arcane.volmlib.util.director.exceptions.DirectorParsingException;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package art.arcane.iris.diagnostics;
|
||||
|
||||
import art.arcane.volmlib.nativelib.NativeAdapters;
|
||||
import art.arcane.volmlib.nativelib.server.NativeServerDiagnostics;
|
||||
import art.arcane.iris.platform.bukkit.plugin.IrisService;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -15,19 +17,20 @@ import java.util.List;
|
||||
public class LogFilterSVC implements IrisService, Filter {
|
||||
|
||||
private static final String HEIGHTMAP_MISMATCH = "Ignoring heightmap data for chunk";
|
||||
private static final String RAID_PERSISTENCE = "Could not save data net.minecraft.world.entity.raid.PersistentRaid";
|
||||
private static final String DUPLICATE_ENTITY_UUID = "UUID of added entity already exists";
|
||||
|
||||
// Immutable: check() runs on arbitrary logger threads, and the root logger is JVM-global,
|
||||
// so a mutable static here was both a CME hazard and grew by three entries per enable.
|
||||
private static final List<String> FILTERS = List.of(HEIGHTMAP_MISMATCH, RAID_PERSISTENCE, DUPLICATE_ENTITY_UUID);
|
||||
private static final List<String> FILTERS = List.of(HEIGHTMAP_MISMATCH, DUPLICATE_ENTITY_UUID);
|
||||
|
||||
private volatile NativeServerDiagnostics diagnostics;
|
||||
private LoggerConfig installedLogger;
|
||||
|
||||
public void onEnable() {
|
||||
if (installedLogger != null) {
|
||||
return;
|
||||
}
|
||||
diagnostics = NativeAdapters.find(NativeServerDiagnostics.class).orElse(null);
|
||||
LoggerConfig logger = ((Logger) LogManager.getRootLogger()).get();
|
||||
logger.addFilter(this);
|
||||
installedLogger = logger;
|
||||
@@ -135,6 +138,9 @@ public class LogFilterSVC implements IrisService, Filter {
|
||||
if (string == null) {
|
||||
return Result.NEUTRAL;
|
||||
}
|
||||
if (diagnostics != null && diagnostics.isRaidPersistenceMessage(string)) {
|
||||
return Result.DENY;
|
||||
}
|
||||
for (String filter : FILTERS) {
|
||||
if (string.contains(filter)) {
|
||||
return Result.DENY;
|
||||
|
||||
@@ -46,7 +46,7 @@ import art.arcane.iris.studio.render.RenderType;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.pack.loading.IrisRegistrant;
|
||||
import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.cache.LazyBoundedCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
@@ -72,7 +72,7 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.awt.Color;
|
||||
@@ -265,19 +265,19 @@ public class IrisBiome extends IrisRegistrant implements Rarity {
|
||||
return IrisBiomeOres.hasSurfaceOreReplaceableBlocks(this);
|
||||
}
|
||||
|
||||
public boolean canReplaceSurfaceOre(PlatformBlockState state) {
|
||||
public boolean canReplaceSurfaceOre(NativeBlockState state) {
|
||||
return IrisBiomeOres.canReplaceSurfaceOre(this, state);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
public NativeBlockState generateOres(int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
return IrisBiomeOres.generateOres(this, x, y, z, rng, data, surface);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateSurfaceOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
public NativeBlockState generateSurfaceOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return IrisBiomeOres.generateSurfaceOres(this, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generateUndergroundOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
public NativeBlockState generateUndergroundOres(int x, int y, int z, RNG rng, IrisData data) {
|
||||
return IrisBiomeOres.generateUndergroundOres(this, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
@@ -522,23 +522,23 @@ public class IrisBiome extends IrisRegistrant implements Rarity {
|
||||
return childrenCell.aquire(() -> getChildStyle().create(random.nextParallelRNG(sig * 2137), getLoader()).bake().scale(scale).bake());
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> generateLayers(IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
public KList<NativeBlockState> generateLayers(IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
return IrisBiomeLayerGenerator.generateLayers(this, dim, wx, wz, random, maxDepth, height, rdata, complex);
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> generateLayersWithSlope(IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, ProceduralStream<Double> slopeStream) {
|
||||
public KList<NativeBlockState> generateLayersWithSlope(IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, ProceduralStream<Double> slopeStream) {
|
||||
return IrisBiomeLayerGenerator.generateLayers(this, dim, wx, wz, random, maxDepth, height, rdata, slopeStream);
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> generateCeilingLayers(IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
public KList<NativeBlockState> generateCeilingLayers(IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
return IrisBiomeLayerGenerator.generateCeilingLayers(this, dim, wx, wz, random, maxDepth, height, rdata, complex);
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisData rdata, IrisComplex complex) {
|
||||
public KList<NativeBlockState> generateLockedLayers(double wx, double wz, RNG random, int maxDepthf, int height, IrisData rdata, IrisComplex complex) {
|
||||
return IrisBiomeLayerGenerator.generateLockedLayers(this, wx, wz, random, maxDepthf, height, rdata, complex);
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
||||
public KList<NativeBlockState> generateSeaLayers(double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
||||
return IrisBiomeLayerGenerator.generateSeaLayers(this, wx, wz, random, maxDepth, rdata);
|
||||
}
|
||||
|
||||
@@ -562,7 +562,7 @@ public class IrisBiome extends IrisRegistrant implements Rarity {
|
||||
return IrisBiomeLayerGenerator.getLayerSeaHeightGenerators(this, rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState getSurfaceBlock(int x, int z, RNG rng, IrisData idm) {
|
||||
public NativeBlockState getSurfaceBlock(int x, int z, RNG rng, IrisData idm) {
|
||||
return IrisBiomeLayerGenerator.getSurfaceBlock(this, x, z, rng, idm);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ package art.arcane.iris.generation.biome;
|
||||
|
||||
import art.arcane.iris.pack.validation.ContentGate;
|
||||
import art.arcane.iris.pack.validation.KeyStatus;
|
||||
import art.arcane.iris.platform.bukkit.nms.datapack.IDataFixer;
|
||||
import art.arcane.iris.pack.datapack.IDataFixer;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.iris.pack.schema.annotation.DependsOn;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
|
||||
@@ -18,13 +18,13 @@
|
||||
|
||||
package art.arcane.iris.generation.biome;
|
||||
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.Required;
|
||||
import art.arcane.iris.pack.schema.annotation.Snippet;
|
||||
import art.arcane.iris.platform.bukkit.registry.RegistryUtil;
|
||||
import art.arcane.iris.platform.registry.RegistryUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -18,14 +18,14 @@
|
||||
|
||||
package art.arcane.iris.generation.biome;
|
||||
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.RegistryListEntityType;
|
||||
import art.arcane.iris.pack.schema.annotation.Required;
|
||||
import art.arcane.iris.pack.schema.annotation.Snippet;
|
||||
import art.arcane.iris.platform.bukkit.registry.RegistryUtil;
|
||||
import art.arcane.iris.platform.registry.RegistryUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.biome;
|
||||
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.platform.bukkit.registry.RegistryUtil;
|
||||
import art.arcane.iris.platform.registry.RegistryUtil;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import org.bukkit.NamespacedKey;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package art.arcane.iris.generation.biome;
|
||||
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ package art.arcane.iris.generation.biome;
|
||||
|
||||
import art.arcane.iris.generation.noise.IrisGenerator;
|
||||
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.pack.schema.annotation.DependsOn;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
|
||||
@@ -25,10 +25,10 @@ import art.arcane.iris.structure.object.IrisObjectPlacement;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.block.BoundBlockState;
|
||||
import art.arcane.volmlib.util.noise.CNG;
|
||||
@@ -46,22 +46,22 @@ final class IrisBiomeLayerGenerator {
|
||||
private IrisBiomeLayerGenerator() {
|
||||
}
|
||||
|
||||
static KList<PlatformBlockState> generateLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
static KList<NativeBlockState> generateLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
return generateLayers(biome, dim, wx, wz, random, maxDepth, height, rdata, complex, null);
|
||||
}
|
||||
|
||||
static KList<PlatformBlockState> generateLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, ProceduralStream<Double> slopeStream) {
|
||||
static KList<NativeBlockState> generateLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, ProceduralStream<Double> slopeStream) {
|
||||
return generateLayers(biome, dim, wx, wz, random, maxDepth, height, rdata, null, slopeStream);
|
||||
}
|
||||
|
||||
private static KList<PlatformBlockState> generateLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex, ProceduralStream<Double> slopeStream) {
|
||||
private static KList<NativeBlockState> generateLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex, ProceduralStream<Double> slopeStream) {
|
||||
if (biome.isLockLayers()) {
|
||||
KList<PlatformBlockState> data = generateLockedLayers(biome, wx, wz, random, maxDepth, height, rdata, complex, slopeStream);
|
||||
KList<NativeBlockState> data = generateLockedLayers(biome, wx, wz, random, maxDepth, height, rdata, complex, slopeStream);
|
||||
appendSurfaceFallback(data, biome, dim, wx, wz, random, Math.min(maxDepth, biome.getLockLayersMax()), rdata);
|
||||
return data;
|
||||
}
|
||||
|
||||
KList<PlatformBlockState> data = new KList<>();
|
||||
KList<NativeBlockState> data = new KList<>();
|
||||
|
||||
if (maxDepth <= 0) {
|
||||
return data;
|
||||
@@ -120,7 +120,7 @@ final class IrisBiomeLayerGenerator {
|
||||
return data;
|
||||
}
|
||||
|
||||
private static void appendSurfaceFallback(KList<PlatformBlockState> data, IrisBiome biome, IrisDimension dim,
|
||||
private static void appendSurfaceFallback(KList<NativeBlockState> data, IrisBiome biome, IrisDimension dim,
|
||||
double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
||||
if (!data.isEmpty() || maxDepth <= 0 || biome.getLayers().isEmpty()) {
|
||||
return;
|
||||
@@ -134,8 +134,8 @@ final class IrisBiomeLayerGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
static KList<PlatformBlockState> generateCeilingLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
KList<PlatformBlockState> data = new KList<>();
|
||||
static KList<NativeBlockState> generateCeilingLayers(IrisBiome biome, IrisDimension dim, double wx, double wz, RNG random, int maxDepth, int height, IrisData rdata, IrisComplex complex) {
|
||||
KList<NativeBlockState> data = new KList<>();
|
||||
|
||||
if (maxDepth <= 0) {
|
||||
return data;
|
||||
@@ -181,12 +181,12 @@ final class IrisBiomeLayerGenerator {
|
||||
return data;
|
||||
}
|
||||
|
||||
static KList<PlatformBlockState> generateLockedLayers(IrisBiome biome, double wx, double wz, RNG random, int maxDepthf, int height, IrisData rdata, IrisComplex complex) {
|
||||
static KList<NativeBlockState> generateLockedLayers(IrisBiome biome, double wx, double wz, RNG random, int maxDepthf, int height, IrisData rdata, IrisComplex complex) {
|
||||
return generateLockedLayers(biome, wx, wz, random, maxDepthf, height, rdata, complex, null);
|
||||
}
|
||||
|
||||
private static KList<PlatformBlockState> generateLockedLayers(IrisBiome biome, double wx, double wz, RNG random, int maxDepthf, int height, IrisData rdata, IrisComplex complex, ProceduralStream<Double> slopeStream) {
|
||||
KList<PlatformBlockState> data = new KList<>();
|
||||
private static KList<NativeBlockState> generateLockedLayers(IrisBiome biome, double wx, double wz, RNG random, int maxDepthf, int height, IrisData rdata, IrisComplex complex, ProceduralStream<Double> slopeStream) {
|
||||
KList<NativeBlockState> data = new KList<>();
|
||||
int maxDepth = Math.min(maxDepthf, biome.getLockLayersMax());
|
||||
KList<IrisBiomePaletteLayer> layers = biome.getLayers();
|
||||
int layerCount = layers.size();
|
||||
@@ -276,8 +276,8 @@ final class IrisBiomeLayerGenerator {
|
||||
: complex.getSlopeStream().getDouble(x, z);
|
||||
}
|
||||
|
||||
static KList<PlatformBlockState> generateSeaLayers(IrisBiome biome, double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
||||
KList<PlatformBlockState> data = new KList<>();
|
||||
static KList<NativeBlockState> generateSeaLayers(IrisBiome biome, double wx, double wz, RNG random, int maxDepth, IrisData rdata) {
|
||||
KList<NativeBlockState> data = new KList<>();
|
||||
|
||||
KList<IrisBiomePaletteLayer> seaLayers = biome.getSeaLayers();
|
||||
int layerCount = seaLayers.size();
|
||||
@@ -339,7 +339,7 @@ final class IrisBiomeLayerGenerator {
|
||||
});
|
||||
}
|
||||
|
||||
private static void appendLayer(KList<PlatformBlockState> blocks, IrisBiomePaletteLayer layer,
|
||||
private static void appendLayer(KList<NativeBlockState> blocks, IrisBiomePaletteLayer layer,
|
||||
int layerIndex, int thickness, double x, double z,
|
||||
RNG random, int maxDepth, IrisData data) {
|
||||
double zoom = layer.getZoom();
|
||||
@@ -353,7 +353,7 @@ final class IrisBiomeLayerGenerator {
|
||||
}
|
||||
}
|
||||
|
||||
static PlatformBlockState getSurfaceBlock(IrisBiome biome, int x, int z, RNG rng, IrisData idm) {
|
||||
static NativeBlockState getSurfaceBlock(IrisBiome biome, int x, int z, RNG rng, IrisData idm) {
|
||||
KList<IrisBiomePaletteLayer> layers = biome.getLayers();
|
||||
|
||||
if (layers.isEmpty()) {
|
||||
|
||||
@@ -23,8 +23,8 @@ import art.arcane.iris.generation.decoration.IrisOreGeneratorBounds;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.collection.KSet;
|
||||
@@ -39,16 +39,16 @@ final class IrisBiomeOres {
|
||||
private IrisBiomeOres() {
|
||||
}
|
||||
|
||||
static PlatformBlockState generateOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
static NativeBlockState generateOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data, boolean surface) {
|
||||
KList<IrisOreGenerator> localOres = surface ? getSurfaceOres(biome) : getUndergroundOres(biome);
|
||||
return generateOres(localOres, x, y, z, rng, data);
|
||||
}
|
||||
|
||||
static PlatformBlockState generateSurfaceOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data) {
|
||||
static NativeBlockState generateSurfaceOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getSurfaceOres(biome), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
static PlatformBlockState generateUndergroundOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data) {
|
||||
static NativeBlockState generateUndergroundOres(IrisBiome biome, int x, int y, int z, RNG rng, IrisData data) {
|
||||
return generateOres(getUndergroundOres(biome), x, y, z, rng, data);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ final class IrisBiomeOres {
|
||||
return biome.getSurfaceOreReplaceableBlocks() != null;
|
||||
}
|
||||
|
||||
static boolean canReplaceSurfaceOre(IrisBiome biome, PlatformBlockState state) {
|
||||
static boolean canReplaceSurfaceOre(IrisBiome biome, NativeBlockState state) {
|
||||
if (!hasSurfaceOreReplaceableBlocks(biome)) {
|
||||
return true;
|
||||
}
|
||||
@@ -130,7 +130,7 @@ final class IrisBiomeOres {
|
||||
});
|
||||
}
|
||||
|
||||
private static PlatformBlockState generateOres(KList<IrisOreGenerator> localOres, int x, int y, int z, RNG rng, IrisData data) {
|
||||
private static NativeBlockState generateOres(KList<IrisOreGenerator> localOres, int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (localOres.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ final class IrisBiomeOres {
|
||||
int oreCount = localOres.size();
|
||||
for (int oreIndex = 0; oreIndex < oreCount; oreIndex++) {
|
||||
IrisOreGenerator oreGenerator = localOres.get(oreIndex);
|
||||
PlatformBlockState ore = oreGenerator.generate(x, y, z, rng, data);
|
||||
NativeBlockState ore = oreGenerator.generate(x, y, z, rng, data);
|
||||
if (ore != null) {
|
||||
return ore;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ final class IrisBiomeOres {
|
||||
private static KSet<String> resolveSurfaceOreReplaceableBlocks(IrisBiome biome) {
|
||||
KSet<String> resolved = new KSet<>();
|
||||
for (String key : biome.getSurfaceOreReplaceableBlocks()) {
|
||||
PlatformBlockState state = B.getStateOrNull(key, false);
|
||||
NativeBlockState state = B.getStateOrNull(key, false);
|
||||
if (state != null) {
|
||||
resolved.add(IrisProceduralBlocks.materialKey(state));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import art.arcane.iris.generation.noise.NoiseStyle;
|
||||
import art.arcane.iris.generation.terrain.IrisSlopeClip;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.cache.LazyBoundedCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
@@ -42,7 +42,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -57,7 +57,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
public class IrisBiomePaletteLayer {
|
||||
private static final int LAYER_GENERATOR_CACHE_SIZE = 32;
|
||||
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<NativeBlockState>> blockData = new AtomicCache<>();
|
||||
@Getter(AccessLevel.NONE)
|
||||
@Setter(AccessLevel.NONE)
|
||||
private final transient LazyBoundedCache<LayerGeneratorKey, CNG> layerGenerators =
|
||||
@@ -100,7 +100,7 @@ public class IrisBiomePaletteLayer {
|
||||
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
|
||||
}
|
||||
|
||||
public PlatformBlockState get(RNG rng, double x, double y, double z, IrisData data) {
|
||||
public NativeBlockState get(RNG rng, double x, double y, double z, IrisData data) {
|
||||
return get(rng, 0, x, y, z, data);
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ public class IrisBiomePaletteLayer {
|
||||
* only built inside the lazy layer generator initializer, using the exact same seed derivation
|
||||
* as {@code parent.nextParallelRNG(signature)} followed by the generator signature.
|
||||
*/
|
||||
public PlatformBlockState get(RNG parent, int signature, double x, double y, double z, IrisData data) {
|
||||
KList<PlatformBlockState> localBlockData = getBlockData(data);
|
||||
public NativeBlockState get(RNG parent, int signature, double x, double y, double z, IrisData data) {
|
||||
KList<NativeBlockState> localBlockData = getBlockData(data);
|
||||
|
||||
if (localBlockData.isEmpty()) {
|
||||
return null;
|
||||
@@ -154,8 +154,8 @@ public class IrisBiomePaletteLayer {
|
||||
return palette;
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> getBlockData(IrisData data) {
|
||||
KList<PlatformBlockState> cached = blockData.getIfPresent();
|
||||
public KList<NativeBlockState> getBlockData(IrisData data) {
|
||||
KList<NativeBlockState> cached = blockData.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -163,9 +163,9 @@ public class IrisBiomePaletteLayer {
|
||||
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<PlatformBlockState> blockData = new KList<>();
|
||||
KList<NativeBlockState> blockData = new KList<>();
|
||||
for (IrisBlockData ix : palette) {
|
||||
PlatformBlockState bx = ix.getBlockData(data);
|
||||
NativeBlockState bx = ix.getBlockData(data);
|
||||
if (bx != null) {
|
||||
for (int i = 0; i < ix.getWeight(); i++) {
|
||||
blockData.add(bx);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.biome;
|
||||
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
|
||||
import art.arcane.iris.platform.bukkit.nms.datapack.IDataFixer;
|
||||
import art.arcane.iris.pack.datapack.IDataFixer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -32,7 +32,7 @@ import art.arcane.iris.structure.object.IrisObjectScale;
|
||||
import art.arcane.volmlib.util.math.Rarity;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
|
||||
@@ -2,7 +2,7 @@ package art.arcane.iris.generation.block;
|
||||
|
||||
import art.arcane.iris.spi.IrisPlatform;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.spi.PlatformRegistries;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
|
||||
@@ -12,111 +12,111 @@ public class B {
|
||||
private record BoundRegistries(IrisPlatform platform, PlatformRegistries registries) {
|
||||
}
|
||||
|
||||
public static PlatformBlockState getState(String bdxf) {
|
||||
public static NativeBlockState getState(String bdxf) {
|
||||
return registries().block(bdxf);
|
||||
}
|
||||
|
||||
public static PlatformBlockState getStateOrNull(String bdxf) {
|
||||
public static NativeBlockState getStateOrNull(String bdxf) {
|
||||
return registries().blockOrNull(bdxf);
|
||||
}
|
||||
|
||||
public static PlatformBlockState getStateOrNull(String bdxf, boolean warn) {
|
||||
public static NativeBlockState getStateOrNull(String bdxf, boolean warn) {
|
||||
return registries().blockOrNull(bdxf, warn);
|
||||
}
|
||||
|
||||
public static KList<PlatformBlockState> getStates(KList<String> find) {
|
||||
KList<PlatformBlockState> states = new KList<>(find.size());
|
||||
public static KList<NativeBlockState> getStates(KList<String> find) {
|
||||
KList<NativeBlockState> states = new KList<>(find.size());
|
||||
for (String key : find) {
|
||||
states.add(getState(key));
|
||||
}
|
||||
return states;
|
||||
}
|
||||
|
||||
public static PlatformBlockState getAirState() {
|
||||
public static NativeBlockState getAirState() {
|
||||
return registries().air();
|
||||
}
|
||||
|
||||
public static PlatformBlockState toDeepSlateOre(PlatformBlockState block, PlatformBlockState ore) {
|
||||
public static NativeBlockState toDeepSlateOre(NativeBlockState block, NativeBlockState ore) {
|
||||
return registries().deepSlateOre(block, ore);
|
||||
}
|
||||
|
||||
public static boolean isAir(PlatformBlockState state) {
|
||||
public static boolean isAir(NativeBlockState state) {
|
||||
return state == null || state.isAir();
|
||||
}
|
||||
|
||||
public static boolean isSolid(PlatformBlockState state) {
|
||||
public static boolean isSolid(NativeBlockState state) {
|
||||
return state != null && state.isSolid();
|
||||
}
|
||||
|
||||
public static boolean isOccluding(PlatformBlockState state) {
|
||||
public static boolean isOccluding(NativeBlockState state) {
|
||||
return state != null && state.isOccluding();
|
||||
}
|
||||
|
||||
public static boolean isFluid(PlatformBlockState state) {
|
||||
public static boolean isFluid(NativeBlockState state) {
|
||||
return state != null && state.isFluid();
|
||||
}
|
||||
|
||||
public static boolean isAirOrFluid(PlatformBlockState state) {
|
||||
public static boolean isAirOrFluid(NativeBlockState state) {
|
||||
return state == null || state.isAirOrFluid();
|
||||
}
|
||||
|
||||
public static boolean isWater(PlatformBlockState state) {
|
||||
public static boolean isWater(NativeBlockState state) {
|
||||
return state != null && state.isWater();
|
||||
}
|
||||
|
||||
public static boolean isWaterLogged(PlatformBlockState state) {
|
||||
public static boolean isWaterLogged(NativeBlockState state) {
|
||||
return state != null && state.isWaterLogged();
|
||||
}
|
||||
|
||||
public static boolean isLit(PlatformBlockState state) {
|
||||
public static boolean isLit(NativeBlockState state) {
|
||||
return state != null && state.isLit();
|
||||
}
|
||||
|
||||
public static boolean isUpdatable(PlatformBlockState state) {
|
||||
public static boolean isUpdatable(NativeBlockState state) {
|
||||
return state != null && state.isUpdatable();
|
||||
}
|
||||
|
||||
public static boolean isFoliage(PlatformBlockState state) {
|
||||
public static boolean isFoliage(NativeBlockState state) {
|
||||
return state != null && state.isFoliage();
|
||||
}
|
||||
|
||||
public static boolean isTreeBlock(PlatformBlockState state) {
|
||||
public static boolean isTreeBlock(NativeBlockState state) {
|
||||
return state != null && state.isTreeBlock();
|
||||
}
|
||||
|
||||
public static boolean isFoliagePlantable(PlatformBlockState state) {
|
||||
public static boolean isFoliagePlantable(NativeBlockState state) {
|
||||
return state != null && state.isFoliagePlantable();
|
||||
}
|
||||
|
||||
public static boolean isDecorant(PlatformBlockState state) {
|
||||
public static boolean isDecorant(NativeBlockState state) {
|
||||
return state != null && state.isDecorant();
|
||||
}
|
||||
|
||||
public static boolean isStorage(PlatformBlockState state) {
|
||||
public static boolean isStorage(NativeBlockState state) {
|
||||
return state != null && state.isStorage();
|
||||
}
|
||||
|
||||
public static boolean isStorageChest(PlatformBlockState state) {
|
||||
public static boolean isStorageChest(NativeBlockState state) {
|
||||
return state != null && state.isStorageChest();
|
||||
}
|
||||
|
||||
public static boolean isOre(PlatformBlockState state) {
|
||||
public static boolean isOre(NativeBlockState state) {
|
||||
return state != null && state.isOre();
|
||||
}
|
||||
|
||||
public static boolean isDeepSlate(PlatformBlockState state) {
|
||||
public static boolean isDeepSlate(NativeBlockState state) {
|
||||
return state != null && state.isDeepSlate();
|
||||
}
|
||||
|
||||
public static boolean isVineBlock(PlatformBlockState state) {
|
||||
public static boolean isVineBlock(NativeBlockState state) {
|
||||
return state != null && state.isVineBlock();
|
||||
}
|
||||
|
||||
public static boolean canPlaceOnto(PlatformBlockState mat, PlatformBlockState onto) {
|
||||
public static boolean canPlaceOnto(NativeBlockState mat, NativeBlockState onto) {
|
||||
return mat != null && onto != null && mat.canPlaceOnto(onto);
|
||||
}
|
||||
|
||||
public static boolean matches(PlatformBlockState filter, PlatformBlockState state) {
|
||||
public static boolean matches(NativeBlockState filter, NativeBlockState state) {
|
||||
return filter != null && state != null && filter.matches(state);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package art.arcane.iris.generation.block;
|
||||
|
||||
import art.arcane.iris.platform.bukkit.BukkitBlockState;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.platform.bukkit.BukkitBlockResolution;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@@ -15,7 +15,7 @@ public final class BlockDataMergeSupport {
|
||||
}
|
||||
|
||||
public interface StateMerger {
|
||||
PlatformBlockState merge(PlatformBlockState base, PlatformBlockState update);
|
||||
NativeBlockState merge(NativeBlockState base, NativeBlockState update);
|
||||
}
|
||||
|
||||
public static synchronized StateMerger bindPlatformMerger(StateMerger merger) {
|
||||
@@ -28,7 +28,7 @@ public final class BlockDataMergeSupport {
|
||||
PLATFORM_MERGER = merger;
|
||||
}
|
||||
|
||||
public static PlatformBlockState merge(PlatformBlockState base, PlatformBlockState update) {
|
||||
public static NativeBlockState merge(NativeBlockState base, NativeBlockState update) {
|
||||
StateMerger merger = PLATFORM_MERGER;
|
||||
if (merger != null) {
|
||||
return merger.merge(base, update);
|
||||
|
||||
@@ -20,7 +20,7 @@ package art.arcane.iris.generation.block;
|
||||
|
||||
import art.arcane.iris.spi.IrisPlatform;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public final class BoundBlockState {
|
||||
private final String key;
|
||||
@@ -34,7 +34,7 @@ public final class BoundBlockState {
|
||||
return new BoundBlockState(key);
|
||||
}
|
||||
|
||||
public PlatformBlockState get() {
|
||||
public NativeBlockState get() {
|
||||
Bound current = bound;
|
||||
IrisPlatform platform = IrisPlatforms.getOrNull();
|
||||
|
||||
@@ -48,6 +48,6 @@ public final class BoundBlockState {
|
||||
return resolved.state();
|
||||
}
|
||||
|
||||
private record Bound(IrisPlatform platform, PlatformBlockState state) {
|
||||
private record Bound(IrisPlatform platform, NativeBlockState state) {
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ import art.arcane.iris.pack.validation.ContentGate;
|
||||
import art.arcane.iris.integration.Identifier;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.pack.loading.IrisRegistrant;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
@@ -31,7 +31,7 @@ import art.arcane.iris.pack.schema.annotation.RegistryListBlockType;
|
||||
import art.arcane.iris.pack.schema.annotation.RegistryMapBlockState;
|
||||
import art.arcane.iris.pack.schema.annotation.Required;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -50,7 +50,7 @@ import java.util.Map;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisBlockData extends IrisRegistrant {
|
||||
private final transient AtomicCache<PlatformBlockState> blockdata = new AtomicCache<>();
|
||||
private final transient AtomicCache<NativeBlockState> blockdata = new AtomicCache<>();
|
||||
private final transient AtomicCache<String> realProperties = new AtomicCache<>();
|
||||
@RegistryListBlockType
|
||||
@Required
|
||||
@@ -154,13 +154,13 @@ public class IrisBlockData extends IrisRegistrant {
|
||||
return keyify(getBlock()) + computeProperties();
|
||||
}
|
||||
|
||||
public PlatformBlockState getBlockData(IrisData data) {
|
||||
public NativeBlockState getBlockData(IrisData data) {
|
||||
return blockdata.aquire(() ->
|
||||
{
|
||||
IrisBlockData customData = data.getBlockLoader() == null ? null : data.getBlockLoader().load(getBlock(), false);
|
||||
|
||||
if (customData != null) {
|
||||
PlatformBlockState customState = customData.getBlockData(data);
|
||||
NativeBlockState customState = customData.getBlockData(data);
|
||||
|
||||
if (customState != null) {
|
||||
if (getData().isEmpty()) {
|
||||
@@ -175,7 +175,7 @@ public class IrisBlockData extends IrisRegistrant {
|
||||
IrisLogging.debug("Block Data used " + sx + " (CUSTOM)");
|
||||
}
|
||||
|
||||
PlatformBlockState bx = resolve(data, sx);
|
||||
NativeBlockState bx = resolve(data, sx);
|
||||
|
||||
if (bx != null) {
|
||||
return bx;
|
||||
@@ -186,7 +186,7 @@ public class IrisBlockData extends IrisRegistrant {
|
||||
}
|
||||
|
||||
String ss = stateKey();
|
||||
PlatformBlockState resolved = resolve(data, ss);
|
||||
NativeBlockState resolved = resolve(data, ss);
|
||||
|
||||
if (debug) {
|
||||
IrisLogging.debug("Block Data used " + ss);
|
||||
@@ -210,7 +210,7 @@ public class IrisBlockData extends IrisRegistrant {
|
||||
* (after custom blocks, the gate chain and every backup) yields a {@link art.arcane.iris.pack.validation.MissingBlockState}
|
||||
* carrying the key instead of air, so a palette placeholder with the same key can still be matched and rewritten.
|
||||
*/
|
||||
public PlatformBlockState getBlockDataOrPlaceholder(IrisData data) {
|
||||
public NativeBlockState getBlockDataOrPlaceholder(IrisData data) {
|
||||
ContentGate gate = data.getContentGate();
|
||||
String state = stateKey();
|
||||
|
||||
@@ -222,7 +222,7 @@ public class IrisBlockData extends IrisRegistrant {
|
||||
return backup.getBlockDataOrPlaceholder(data);
|
||||
}
|
||||
|
||||
PlatformBlockState placeholder = gate.resolveBlockOrPlaceholder(state);
|
||||
NativeBlockState placeholder = gate.resolveBlockOrPlaceholder(state);
|
||||
return placeholder == null ? getBlockData(data) : placeholder;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public class IrisBlockData extends IrisRegistrant {
|
||||
* {@link art.arcane.iris.pack.validation.KeyStatus#UNKNOWN}) gates nothing and answers null for every key, so this
|
||||
* keeps the plain registry lookup in that case - otherwise every block in the pack would resolve to air.
|
||||
*/
|
||||
private static PlatformBlockState resolve(IrisData data, String state) {
|
||||
private static NativeBlockState resolve(IrisData data, String state) {
|
||||
ContentGate gate = data.getContentGate();
|
||||
|
||||
if (gate == null || !gate.ready()) {
|
||||
@@ -250,7 +250,7 @@ public class IrisBlockData extends IrisRegistrant {
|
||||
|
||||
public TileData tryGetTile(IrisData data) {
|
||||
//TODO Do like a registry thing with the tile data registry. Also update the parsing of data to include **block** entities.
|
||||
PlatformBlockState state = getBlockData(data);
|
||||
NativeBlockState state = getBlockData(data);
|
||||
String stateKey = state.key();
|
||||
int bracket = stateKey.indexOf('[');
|
||||
String blockKey = bracket >= 0 ? stateKey.substring(0, bracket) : stateKey;
|
||||
|
||||
@@ -11,8 +11,8 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.CreatureSpawner;
|
||||
import org.bukkit.block.Sign;
|
||||
import art.arcane.iris.platform.bukkit.nms.container.Pair;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.collection.Pair;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import art.arcane.iris.platform.reflect.KeyedType;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.block;
|
||||
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.Strictness;
|
||||
@@ -72,7 +72,7 @@ public class TileData implements Cloneable {
|
||||
}
|
||||
|
||||
public interface TileFactory {
|
||||
TileData create(PlatformBlockState state, KMap<String, Object> properties);
|
||||
TileData create(NativeBlockState state, KMap<String, Object> properties);
|
||||
}
|
||||
|
||||
public static synchronized TileReader bindPlatformReader(TileReader reader) {
|
||||
@@ -136,7 +136,7 @@ public class TileData implements Cloneable {
|
||||
return new TileData().fromBukkit(block);
|
||||
}
|
||||
|
||||
public static TileData of(PlatformBlockState state, KMap<String, Object> properties) {
|
||||
public static TileData of(NativeBlockState state, KMap<String, Object> properties) {
|
||||
TileFactory factory = PLATFORM_FACTORY;
|
||||
if (factory != null) {
|
||||
return factory.create(state, properties);
|
||||
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 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 art.arcane.iris.generation.cache;
|
||||
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.volmlib.util.function.NastySupplier;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class AtomicCache<T> {
|
||||
private static final Object NULL_VALUE = new Object();
|
||||
private transient final Object initLock = new Object();
|
||||
private transient final boolean nullSupport;
|
||||
private transient volatile Object value;
|
||||
private transient volatile Throwable failure;
|
||||
|
||||
public AtomicCache() {
|
||||
this(false);
|
||||
}
|
||||
|
||||
public AtomicCache(boolean nullSupport) {
|
||||
this.nullSupport = nullSupport;
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
synchronized (initLock) {
|
||||
value = null;
|
||||
failure = null;
|
||||
}
|
||||
}
|
||||
|
||||
public T getIfPresent() {
|
||||
return unwrap(value);
|
||||
}
|
||||
|
||||
public T aquireNasty(NastySupplier<T> t) {
|
||||
return aquire(() -> {
|
||||
try {
|
||||
return t.get();
|
||||
} catch (Throwable e) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public T aquireNastyPrint(NastySupplier<T> t) {
|
||||
return aquire(() -> {
|
||||
try {
|
||||
return t.get();
|
||||
} catch (Throwable e) {
|
||||
IrisLogging.reportError("Atomic cache supplier failed.", e);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #aquire(Supplier)} but propagates a supplier failure to the caller instead
|
||||
* of swallowing it into a null return. For values that are mandatory: a caller of a
|
||||
* "@NotNull" accessor should see the supplier's real exception, not a downstream NPE.
|
||||
* <p>
|
||||
* The supplier is retried on every call until it produces a value, which is what a caller that can
|
||||
* repair the cause between attempts needs. Use {@link #aquireOnceOrThrow(Supplier)} when re-running a
|
||||
* failed supplier is itself the problem.
|
||||
*/
|
||||
public T aquireOrThrow(Supplier<T> t) {
|
||||
Object v = value;
|
||||
|
||||
if (v != null) {
|
||||
return unwrap(v);
|
||||
}
|
||||
|
||||
synchronized (initLock) {
|
||||
v = value;
|
||||
|
||||
if (v != null) {
|
||||
return unwrap(v);
|
||||
}
|
||||
|
||||
T computed = t.get();
|
||||
if (computed == null) {
|
||||
throw new IllegalStateException("Atomic cache supplier produced null");
|
||||
}
|
||||
value = computed;
|
||||
return computed;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Like {@link #aquireOrThrow(Supplier)} but memoizes the failure as well as the value, so a supplier
|
||||
* that cannot produce one is run exactly once and every later caller is told the same reason. For
|
||||
* values whose supplier rebuilds shared state, where re-running it per call repeats that work and
|
||||
* hides the original cause behind whatever the retry happens to fail on. {@link #reset()} clears it.
|
||||
*/
|
||||
public T aquireOnceOrThrow(Supplier<T> t) {
|
||||
Object v = value;
|
||||
|
||||
if (v != null) {
|
||||
return unwrap(v);
|
||||
}
|
||||
rethrowFailure(failure);
|
||||
|
||||
synchronized (initLock) {
|
||||
v = value;
|
||||
|
||||
if (v != null) {
|
||||
return unwrap(v);
|
||||
}
|
||||
rethrowFailure(failure);
|
||||
|
||||
T computed;
|
||||
try {
|
||||
computed = t.get();
|
||||
if (computed == null) {
|
||||
throw new IllegalStateException("Atomic cache supplier produced null");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
failure = e;
|
||||
throw e;
|
||||
}
|
||||
value = computed;
|
||||
return computed;
|
||||
}
|
||||
}
|
||||
|
||||
private static void rethrowFailure(Throwable memoized) {
|
||||
if (memoized == null) {
|
||||
return;
|
||||
}
|
||||
if (memoized instanceof RuntimeException runtimeFailure) {
|
||||
throw runtimeFailure;
|
||||
}
|
||||
if (memoized instanceof Error error) {
|
||||
throw error;
|
||||
}
|
||||
throw new IllegalStateException("Atomic cache supplier failed", memoized);
|
||||
}
|
||||
|
||||
public T aquire(Supplier<T> t) {
|
||||
Object v = value;
|
||||
|
||||
if (v != null) {
|
||||
return unwrap(v);
|
||||
}
|
||||
|
||||
synchronized (initLock) {
|
||||
v = value;
|
||||
|
||||
if (v != null) {
|
||||
return unwrap(v);
|
||||
}
|
||||
|
||||
try {
|
||||
T computed = t.get();
|
||||
|
||||
if (computed != null) {
|
||||
value = computed;
|
||||
return computed;
|
||||
}
|
||||
|
||||
if (nullSupport) {
|
||||
value = NULL_VALUE;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
// aquire retries on every call, so a supplier that stays broken is reached per sample.
|
||||
// The first statement of it carries the stack; the rest are traces of the same cause.
|
||||
if (IrisLogging.warnOnce("atomic-cache:" + e.getClass().getName() + ":" + e.getMessage(),
|
||||
"Atomic cache supplier failed: %s: %s", e.getClass().getSimpleName(), e.getMessage())) {
|
||||
IrisLogging.reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private T unwrap(Object v) {
|
||||
return v == null || v == NULL_VALUE ? null : (T) v;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.chunk;
|
||||
import art.arcane.iris.generation.runtime.BlockEditAccess;
|
||||
import art.arcane.iris.spi.IrisServices;
|
||||
import art.arcane.iris.platform.bukkit.BukkitBiome;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@SuppressWarnings("ClassCanBeRecord")
|
||||
public class ChunkBiomeHunkView extends art.arcane.volmlib.util.hunk.view.ChunkWorldHunkView<PlatformBiome> implements Hunk<PlatformBiome> {
|
||||
public class ChunkBiomeHunkView extends art.arcane.volmlib.util.hunk.view.ChunkWorldHunkView<NativeBiome> implements Hunk<NativeBiome> {
|
||||
public ChunkBiomeHunkView(Chunk chunk) {
|
||||
super(chunk,
|
||||
chunk.getWorld().getMaxHeight(),
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
package art.arcane.iris.generation.chunk;
|
||||
|
||||
import art.arcane.iris.platform.bukkit.nms.INMS;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockVolume;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.BoundBlockState;
|
||||
import art.arcane.iris.generation.block.IrisCustomData;
|
||||
import art.arcane.volmlib.util.hunk.storage.AtomicHunk;
|
||||
@@ -27,7 +28,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
@SuppressWarnings("ClassCanBeRecord")
|
||||
public class ChunkDataHunkHolder extends AtomicHunk<PlatformBlockState> {
|
||||
public class ChunkDataHunkHolder extends AtomicHunk<NativeBlockState> implements NativeBlockVolume {
|
||||
private static final BoundBlockState AIR = BoundBlockState.of("AIR");
|
||||
|
||||
private final ChunkData chunk;
|
||||
@@ -48,7 +49,7 @@ public class ChunkDataHunkHolder extends AtomicHunk<PlatformBlockState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRaw(int x, int y, int z, PlatformBlockState t) {
|
||||
public void setRaw(int x, int y, int z, NativeBlockState t) {
|
||||
// Block-hunk contract: null means "no write", never "erase" — ChunkDataHunkView and
|
||||
// the modded ModdedBlockBuffer already discard nulls, and storing one here made the
|
||||
// Bukkit output diverge from the modded loaders for the same engine emission.
|
||||
@@ -59,17 +60,17 @@ public class ChunkDataHunkHolder extends AtomicHunk<PlatformBlockState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState getRaw(int x, int y, int z) {
|
||||
public NativeBlockState getRaw(int x, int y, int z) {
|
||||
if (y < 0 || y >= getHeight()) {
|
||||
return AIR.get();
|
||||
}
|
||||
|
||||
PlatformBlockState b = super.getRaw(x, y, z);
|
||||
NativeBlockState b = super.getRaw(x, y, z);
|
||||
|
||||
return b != null ? b : AIR.get();
|
||||
}
|
||||
|
||||
public PlatformBlockState getStoredRaw(int x, int y, int z) {
|
||||
public NativeBlockState getStoredRaw(int x, int y, int z) {
|
||||
return super.getRaw(x, y, z);
|
||||
}
|
||||
|
||||
@@ -89,7 +90,7 @@ public class ChunkDataHunkHolder extends AtomicHunk<PlatformBlockState> {
|
||||
int runStart = -1;
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
PlatformBlockState state = super.getRaw(x, y, z);
|
||||
NativeBlockState state = super.getRaw(x, y, z);
|
||||
BlockData block = state == null ? null : (BlockData) state.nativeHandle();
|
||||
// Custom wrappers are not real Bukkit data; write the vanilla base like the
|
||||
// NMS fast path (NMSBinding.applyChunkDataBlocks) does.
|
||||
|
||||
@@ -21,14 +21,14 @@ package art.arcane.iris.generation.chunk;
|
||||
import art.arcane.iris.platform.bukkit.BukkitBlockResolution;
|
||||
|
||||
import art.arcane.iris.platform.bukkit.BukkitBlockState;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.IrisCustomData;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
@SuppressWarnings("ClassCanBeRecord")
|
||||
public class ChunkDataHunkView implements Hunk<PlatformBlockState> {
|
||||
public class ChunkDataHunkView implements Hunk<NativeBlockState> {
|
||||
private final art.arcane.volmlib.util.hunk.view.ChunkDataHunkView view;
|
||||
|
||||
public ChunkDataHunkView(ChunkData chunk) {
|
||||
@@ -51,7 +51,7 @@ public class ChunkDataHunkView implements Hunk<PlatformBlockState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x1, int y1, int z1, int x2, int y2, int z2, PlatformBlockState t) {
|
||||
public void set(int x1, int y1, int z1, int x2, int y2, int z2, NativeBlockState t) {
|
||||
if (t == null) {
|
||||
return;
|
||||
}
|
||||
@@ -60,12 +60,12 @@ public class ChunkDataHunkView implements Hunk<PlatformBlockState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState get(int x, int y, int z) {
|
||||
public NativeBlockState get(int x, int y, int z) {
|
||||
return BukkitBlockState.of(view.get(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, PlatformBlockState t) {
|
||||
public void set(int x, int y, int z, NativeBlockState t) {
|
||||
if (t == null) {
|
||||
return;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class ChunkDataHunkView implements Hunk<PlatformBlockState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRaw(int x, int y, int z, PlatformBlockState t) {
|
||||
public void setRaw(int x, int y, int z, NativeBlockState t) {
|
||||
if (t == null) {
|
||||
return;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ public class ChunkDataHunkView implements Hunk<PlatformBlockState> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState getRaw(int x, int y, int z) {
|
||||
public NativeBlockState getRaw(int x, int y, int z) {
|
||||
return BukkitBlockState.of(view.getRaw(x, y, z));
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.chunk;
|
||||
import art.arcane.iris.generation.runtime.BlockEditAccess;
|
||||
import art.arcane.iris.spi.IrisServices;
|
||||
import art.arcane.iris.platform.bukkit.BukkitBlockState;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
@@ -29,7 +29,7 @@ import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
@SuppressWarnings("ClassCanBeRecord")
|
||||
public class ChunkHunkView extends art.arcane.volmlib.util.hunk.view.ChunkWorldHunkView<PlatformBlockState> implements Hunk<PlatformBlockState> {
|
||||
public class ChunkHunkView extends art.arcane.volmlib.util.hunk.view.ChunkWorldHunkView<NativeBlockState> implements Hunk<NativeBlockState> {
|
||||
public ChunkHunkView(Chunk chunk) {
|
||||
super(chunk,
|
||||
chunk.getWorld().getMaxHeight(),
|
||||
|
||||
@@ -20,8 +20,8 @@ package art.arcane.iris.generation.chunk;
|
||||
|
||||
import art.arcane.iris.platform.bukkit.BukkitBiome;
|
||||
import art.arcane.iris.platform.bukkit.BukkitBlockState;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.IrisCustomData;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
@@ -50,14 +50,14 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBiome getBiome(int x, int y, int z) {
|
||||
public NativeBiome getBiome(int x, int y, int z) {
|
||||
int index = biomeIndex(x, y, z);
|
||||
Biome biome = biomes[index];
|
||||
return BukkitBiome.of(biome == null ? Biome.PLAINS : biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBiome(int x, int y, int z, PlatformBiome bio) {
|
||||
public void setBiome(int x, int y, int z, NativeBiome bio) {
|
||||
biomes[biomeIndex(x, y, z)] = (Biome) bio.nativeHandle();
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
||||
* Writes the whole vertical column in one pass, striding the flat biome array directly. Equivalent to
|
||||
* calling setBiome for every y in [minHeight, maxHeight).
|
||||
*/
|
||||
public void fillBiomeColumn(int x, int z, PlatformBiome bio) {
|
||||
public void fillBiomeColumn(int x, int z, NativeBiome bio) {
|
||||
Biome handle = (Biome) bio.nativeHandle();
|
||||
int stride = CHUNK_SIZE * CHUNK_SIZE;
|
||||
int index = (z & (CHUNK_SIZE - 1)) * CHUNK_SIZE + (x & (CHUNK_SIZE - 1));
|
||||
@@ -87,7 +87,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setBlock(int x, int y, int z, PlatformBlockState state) {
|
||||
public synchronized void setBlock(int x, int y, int z, NativeBlockState state) {
|
||||
BlockData blockData = (BlockData) state.nativeHandle();
|
||||
if (blockData instanceof IrisCustomData data) {
|
||||
blockData = data.getBase();
|
||||
@@ -96,7 +96,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, PlatformBlockState state) {
|
||||
public synchronized void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, NativeBlockState state) {
|
||||
BlockData blockData = (BlockData) state.nativeHandle();
|
||||
if (blockData instanceof IrisCustomData data) {
|
||||
blockData = data.getBase();
|
||||
@@ -105,7 +105,7 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState getBlockData(int x, int y, int z) {
|
||||
public NativeBlockState getBlockData(int x, int y, int z) {
|
||||
return BukkitBlockState.of(rawChunkData.getBlockData(x, y, z));
|
||||
}
|
||||
|
||||
|
||||
@@ -18,12 +18,13 @@
|
||||
|
||||
package art.arcane.iris.generation.chunk;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import org.bukkit.World;
|
||||
import art.arcane.volmlib.nativelib.terrain.BukkitTerrainBuffer;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
public interface TerrainChunk {
|
||||
public interface TerrainChunk extends BukkitTerrainBuffer {
|
||||
static TerrainChunk create(World world) {
|
||||
return new LinkedTerrainChunk(world);
|
||||
}
|
||||
@@ -32,13 +33,4 @@ public interface TerrainChunk {
|
||||
return new LinkedTerrainChunk(raw);
|
||||
}
|
||||
|
||||
PlatformBiome getBiome(int x, int y, int z);
|
||||
|
||||
void setBiome(int x, int y, int z, PlatformBiome bio);
|
||||
int getMinHeight();
|
||||
int getMaxHeight();
|
||||
void setBlock(int x, int y, int z, PlatformBlockState blockData);
|
||||
void setRegion(int xMin, int yMin, int zMin, int xMax, int yMax, int zMax, PlatformBlockState blockData);
|
||||
PlatformBlockState getBlockData(int x, int y, int z);
|
||||
ChunkData getChunkData();
|
||||
}
|
||||
@@ -18,12 +18,12 @@
|
||||
|
||||
package art.arcane.iris.generation.chunk;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.hunk.storage.StorageHunk;
|
||||
import art.arcane.volmlib.util.hunk.HunkMutationSupport;
|
||||
|
||||
public class TerrainChunkBiomeHunkView extends StorageHunk<PlatformBiome> implements Hunk<PlatformBiome> {
|
||||
public class TerrainChunkBiomeHunkView extends StorageHunk<NativeBiome> implements Hunk<NativeBiome> {
|
||||
private final TerrainChunk chunk;
|
||||
|
||||
public TerrainChunkBiomeHunkView(TerrainChunk chunk) {
|
||||
@@ -37,7 +37,7 @@ public class TerrainChunkBiomeHunkView extends StorageHunk<PlatformBiome> implem
|
||||
* through to the generic element wise write.
|
||||
*/
|
||||
@Override
|
||||
public void set(int x1, int y1, int z1, int x2, int y2, int z2, PlatformBiome biome) {
|
||||
public void set(int x1, int y1, int z1, int x2, int y2, int z2, NativeBiome biome) {
|
||||
if (x1 == x2 && z1 == z2 && y1 == 0 && y2 == getHeight() - 1 && chunk instanceof LinkedTerrainChunk linked) {
|
||||
linked.fillBiomeColumn(x1, z1, biome);
|
||||
return;
|
||||
@@ -47,12 +47,12 @@ public class TerrainChunkBiomeHunkView extends StorageHunk<PlatformBiome> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRaw(int x, int y, int z, PlatformBiome biome) {
|
||||
public void setRaw(int x, int y, int z, NativeBiome biome) {
|
||||
chunk.setBiome(x, y + chunk.getMinHeight(), z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBiome getRaw(int x, int y, int z) {
|
||||
public NativeBiome getRaw(int x, int y, int z) {
|
||||
return chunk.getBiome(x, y + chunk.getMinHeight(), z);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ import art.arcane.iris.generation.biome.FloatingIslandBoundarySampler;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.world.history.FloatingBiomeOverlay;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.iris.generation.concurrent.MultiBurst;
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.concurrent.CompletableFuture;
|
||||
public class ChunkContext {
|
||||
private boolean naturalTerrain = true;
|
||||
private boolean speculativeTerrain;
|
||||
private Hunk<PlatformBiome> terrainBiomes;
|
||||
private Hunk<NativeBiome> terrainBiomes;
|
||||
private FloatingBiomeOverlay floatingBiomes;
|
||||
private final int x;
|
||||
private final int z;
|
||||
@@ -32,8 +32,8 @@ public class ChunkContext {
|
||||
private final int[] roundedHeight;
|
||||
private final ChunkedDataCache<IrisBiome> biome;
|
||||
private final ChunkedDataCache<IrisBiome> cave;
|
||||
private final ChunkedDataCache<PlatformBlockState> rock;
|
||||
private final ChunkedDataCache<PlatformBlockState> fluid;
|
||||
private final ChunkedDataCache<NativeBlockState> rock;
|
||||
private final ChunkedDataCache<NativeBlockState> fluid;
|
||||
private final ChunkedDataCache<IrisRegion> region;
|
||||
private final FloatingIslandBoundarySampler floatingIslandBoundarySampler;
|
||||
private final DimensionStackContext dimensionStackContext;
|
||||
@@ -139,7 +139,7 @@ public class ChunkContext {
|
||||
return !MultiBurst.burst.ownsCurrentThread();
|
||||
}
|
||||
|
||||
public void setTerrainBiomeOutput(Hunk<PlatformBiome> terrainBiomes) {
|
||||
public void setTerrainBiomeOutput(Hunk<NativeBiome> terrainBiomes) {
|
||||
this.terrainBiomes = terrainBiomes;
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ChunkContext {
|
||||
return floatingBiomes;
|
||||
}
|
||||
|
||||
public void setNaturalBiome(int localX, int y, int localZ, PlatformBiome biome) {
|
||||
public void setNaturalBiome(int localX, int y, int localZ, NativeBiome biome) {
|
||||
if (terrainBiomes != null) {
|
||||
terrainBiomes.setRaw(localX, y, localZ, biome);
|
||||
}
|
||||
@@ -227,11 +227,11 @@ public class ChunkContext {
|
||||
return cave;
|
||||
}
|
||||
|
||||
public ChunkedDataCache<PlatformBlockState> getRock() {
|
||||
public ChunkedDataCache<NativeBlockState> getRock() {
|
||||
return rock;
|
||||
}
|
||||
|
||||
public ChunkedDataCache<PlatformBlockState> getFluid() {
|
||||
public ChunkedDataCache<NativeBlockState> getFluid() {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
package art.arcane.iris.generation.context;
|
||||
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeGenerationScope;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.generation.mantle.EngineMantle;
|
||||
@@ -97,7 +99,7 @@ public final class IrisContext {
|
||||
.qput("queued", mantle.getUnloadRegionCount()));
|
||||
}
|
||||
|
||||
public static final class Scope implements AutoCloseable {
|
||||
public static final class Scope implements NativeGenerationScope {
|
||||
private final Thread owner;
|
||||
private final IrisContext previous;
|
||||
private final IrisContext installed;
|
||||
|
||||
@@ -23,7 +23,7 @@ import art.arcane.iris.generation.mantle.EngineMantle;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.platform.bukkit.BukkitBlockState;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
@@ -40,10 +40,10 @@ final class DecoratorCore {
|
||||
private static final String WEEPING_VINES_PLANT = "minecraft:weeping_vines_plant";
|
||||
private static final String TWISTING_VINES = "minecraft:twisting_vines";
|
||||
private static final String TWISTING_VINES_PLANT = "minecraft:twisting_vines_plant";
|
||||
private static volatile PlatformBlockState weepingVines;
|
||||
private static volatile PlatformBlockState weepingVinesPlant;
|
||||
private static volatile PlatformBlockState twistingVines;
|
||||
private static volatile PlatformBlockState twistingVinesPlant;
|
||||
private static volatile NativeBlockState weepingVines;
|
||||
private static volatile NativeBlockState weepingVinesPlant;
|
||||
private static volatile NativeBlockState twistingVines;
|
||||
private static volatile NativeBlockState twistingVinesPlant;
|
||||
|
||||
static final ThreadLocal<PlaceOpts> SCRATCH_OPTS = ThreadLocal.withInitial(PlaceOpts::new);
|
||||
|
||||
@@ -106,14 +106,14 @@ final class DecoratorCore {
|
||||
|
||||
static void placeSurfaceSingle(IrisDecorator decorator,
|
||||
int x, int z, int realX, int height, int realZ,
|
||||
Hunk<PlatformBlockState> data, RNG rng, IrisData irisData,
|
||||
Hunk<NativeBlockState> data, RNG rng, IrisData irisData,
|
||||
boolean underwater, boolean caveSkipFluid, EngineMantle mantle) {
|
||||
if (height < 0 || height >= data.getHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlatformBlockState bdx = data.get(x, height, z);
|
||||
PlatformBlockState bd = decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
NativeBlockState bdx = data.get(x, height, z);
|
||||
NativeBlockState bd = decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
|
||||
if (!IrisSpeleothems.isSpike(bd) && !underwater && !canGoOn(bd, bdx)
|
||||
&& !decorator.isForcePlace() && decorator.getForceBlock() == null) {
|
||||
@@ -156,8 +156,8 @@ final class DecoratorCore {
|
||||
}
|
||||
|
||||
try {
|
||||
PlatformBlockState upper = bd.withProperty("half", topHalfValue(half));
|
||||
PlatformBlockState lower = fixFacesForHunk(
|
||||
NativeBlockState upper = bd.withProperty("half", topHalfValue(half));
|
||||
NativeBlockState lower = fixFacesForHunk(
|
||||
bd.withProperty("half", bottomHalfValue(half)),
|
||||
data, x, z, realX, lowerY, realZ, mantle);
|
||||
data.set(x, lowerY, z, lower);
|
||||
@@ -174,7 +174,7 @@ final class DecoratorCore {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean matchesPalette(PlatformBlockState[] palette, PlatformBlockState surface) {
|
||||
private static boolean matchesPalette(NativeBlockState[] palette, NativeBlockState surface) {
|
||||
if (surface == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -188,9 +188,9 @@ final class DecoratorCore {
|
||||
}
|
||||
|
||||
static void placeSingleAt(IrisDecorator decorator, int x, int z,
|
||||
int realX, int height, int realZ, Hunk<PlatformBlockState> data,
|
||||
int realX, int height, int realZ, Hunk<NativeBlockState> data,
|
||||
RNG rng, IrisData irisData, boolean applyFixFaces, EngineMantle mantle) {
|
||||
PlatformBlockState bd = decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
NativeBlockState bd = decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
if (bd == null) {
|
||||
return;
|
||||
}
|
||||
@@ -211,13 +211,13 @@ final class DecoratorCore {
|
||||
}
|
||||
|
||||
static void placeStackUp(IrisDecorator decorator, int x, int z, int realX, int realZ,
|
||||
int height, int max, Hunk<PlatformBlockState> data,
|
||||
int height, int max, Hunk<NativeBlockState> data,
|
||||
RNG rng, IrisData irisData, PlaceOpts opts) {
|
||||
if (height < 0 || height >= data.getHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlatformBlockState support = data.get(x, height, z);
|
||||
NativeBlockState support = data.get(x, height, z);
|
||||
if (!allowsSurface(decorator, support, irisData)) {
|
||||
return;
|
||||
}
|
||||
@@ -230,13 +230,13 @@ final class DecoratorCore {
|
||||
if (y >= data.getHeight()) {
|
||||
break;
|
||||
}
|
||||
PlatformBlockState existing = data.get(x, y, z);
|
||||
NativeBlockState existing = data.get(x, y, z);
|
||||
if (!canReplaceStackTarget(existing, opts.underwater)
|
||||
|| (opts.caveSkipFluid && B.isFluid(existing))) {
|
||||
break;
|
||||
}
|
||||
double threshold = stack == 1 ? 1.0 : ((double) i) / (stack - 1);
|
||||
PlatformBlockState block = threshold >= decorator.getTopThreshold()
|
||||
NativeBlockState block = threshold >= decorator.getTopThreshold()
|
||||
? decorator.pickBlockDataTop(rng, irisData, realX, realZ)
|
||||
: decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
if (block == null) {
|
||||
@@ -267,12 +267,12 @@ final class DecoratorCore {
|
||||
}
|
||||
|
||||
static void placeStackDown(IrisDecorator decorator, int x, int z, int realX, int realZ,
|
||||
int height, int minHeight, Hunk<PlatformBlockState> data,
|
||||
int height, int minHeight, Hunk<NativeBlockState> data,
|
||||
RNG rng, IrisData irisData, int max, PlaceOpts opts, EngineMantle mantle) {
|
||||
if (height < 0 || height >= data.getHeight()) {
|
||||
return;
|
||||
}
|
||||
PlatformBlockState support = height + 1 < data.getHeight() ? data.get(x, height + 1, z) : null;
|
||||
NativeBlockState support = height + 1 < data.getHeight() ? data.get(x, height + 1, z) : null;
|
||||
if (!allowsSurface(decorator, support, irisData)) {
|
||||
return;
|
||||
}
|
||||
@@ -284,13 +284,13 @@ final class DecoratorCore {
|
||||
if (y < 0 || y < minHeight) {
|
||||
break;
|
||||
}
|
||||
PlatformBlockState existing = data.get(x, y, z);
|
||||
NativeBlockState existing = data.get(x, y, z);
|
||||
if (!canReplaceStackTarget(existing, opts.underwater)
|
||||
|| (opts.caveSkipFluid && B.isFluid(existing))) {
|
||||
break;
|
||||
}
|
||||
double threshold = stack == 1 ? 1.0 : ((double) i) / (stack - 1);
|
||||
PlatformBlockState block = threshold >= decorator.getTopThreshold()
|
||||
NativeBlockState block = threshold >= decorator.getTopThreshold()
|
||||
? decorator.pickBlockDataTop(rng, irisData, realX, realZ)
|
||||
: decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
if (block == null) {
|
||||
@@ -321,9 +321,9 @@ final class DecoratorCore {
|
||||
|
||||
static void placeFloatingSimple(IrisDecorator decorator,
|
||||
int xf, int zf, int realX, int realZ,
|
||||
int height, int max, Hunk<PlatformBlockState> data,
|
||||
int height, int max, Hunk<NativeBlockState> data,
|
||||
RNG rng, IrisData irisData, EngineMantle mantle) {
|
||||
PlatformBlockState bd = decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
NativeBlockState bd = decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
if (bd == null) {
|
||||
return;
|
||||
}
|
||||
@@ -348,8 +348,8 @@ final class DecoratorCore {
|
||||
}
|
||||
|
||||
try {
|
||||
PlatformBlockState upper = bd.withProperty("half", topHalfValue(half));
|
||||
PlatformBlockState lower = bd.withProperty("half", bottomHalfValue(half));
|
||||
NativeBlockState upper = bd.withProperty("half", topHalfValue(half));
|
||||
NativeBlockState lower = bd.withProperty("half", bottomHalfValue(half));
|
||||
data.set(xf, lowerY, zf, lower);
|
||||
data.set(xf, upperY, zf, upper);
|
||||
} catch (Throwable e) {
|
||||
@@ -365,7 +365,7 @@ final class DecoratorCore {
|
||||
|
||||
static int placeFloatingStacked(IrisDecorator decorator,
|
||||
int xf, int zf, int realX, int realZ,
|
||||
int height, int max, Hunk<PlatformBlockState> data,
|
||||
int height, int max, Hunk<NativeBlockState> data,
|
||||
RNG rng, IrisData irisData, EngineMantle mantle) {
|
||||
int stack = decorator.getHeight(rng, realX, realZ, irisData);
|
||||
if (decorator.isScaleStack()) {
|
||||
@@ -382,7 +382,7 @@ final class DecoratorCore {
|
||||
break;
|
||||
}
|
||||
double threshold = stack == 1 ? 0.0 : ((double) i) / (stack - 1);
|
||||
PlatformBlockState bd = threshold >= decorator.getTopThreshold()
|
||||
NativeBlockState bd = threshold >= decorator.getTopThreshold()
|
||||
? decorator.pickBlockDataTop(rng, irisData, realX, realZ)
|
||||
: decorator.pickBlockData(rng, irisData, realX, realZ);
|
||||
if (bd == null) {
|
||||
@@ -413,7 +413,7 @@ final class DecoratorCore {
|
||||
return placed;
|
||||
}
|
||||
|
||||
static PlatformBlockState fixFacesForHunk(PlatformBlockState b, Hunk<PlatformBlockState> hunk, int rX, int rZ,
|
||||
static NativeBlockState fixFacesForHunk(NativeBlockState b, Hunk<NativeBlockState> hunk, int rX, int rZ,
|
||||
int x, int y, int z, EngineMantle mantle) {
|
||||
if (!B.isVineBlock(b)) {
|
||||
return b;
|
||||
@@ -434,9 +434,9 @@ final class DecoratorCore {
|
||||
}
|
||||
int yy = y + f.getModY();
|
||||
|
||||
PlatformBlockState rs = null;
|
||||
NativeBlockState rs = null;
|
||||
if (mantle != null) {
|
||||
rs = mantle.getMantle().get(x + f.getModX(), yy, z + f.getModZ(), PlatformBlockState.class);
|
||||
rs = mantle.getMantle().get(x + f.getModX(), yy, z + f.getModZ(), NativeBlockState.class);
|
||||
}
|
||||
BlockData r = rs == null ? (BlockData) EngineMantle.AIR.get().nativeHandle() : (BlockData) rs.nativeHandle();
|
||||
if (r.isFaceSturdy(f.getOppositeFace(), BlockSupport.FULL)) {
|
||||
@@ -470,31 +470,31 @@ final class DecoratorCore {
|
||||
return BukkitBlockState.of(cloned);
|
||||
}
|
||||
|
||||
static boolean canGoOn(PlatformBlockState decorator, PlatformBlockState surface) {
|
||||
static boolean canGoOn(NativeBlockState decorator, NativeBlockState surface) {
|
||||
if (!B.canPlaceOnto(decorator, surface)) {
|
||||
return false;
|
||||
}
|
||||
return IrisSugarCane.isSugarCane(decorator) || IrisSpeleothems.isSturdy(surface, true);
|
||||
}
|
||||
|
||||
static boolean isValidShorelineSupport(IrisDecorator decorator, PlatformBlockState decorant, PlatformBlockState surface) {
|
||||
static boolean isValidShorelineSupport(IrisDecorator decorator, NativeBlockState decorant, NativeBlockState surface) {
|
||||
return surface != null
|
||||
&& B.isSolid(surface)
|
||||
&& (decorator.isForcePlace() || canGoOn(decorant, surface));
|
||||
}
|
||||
|
||||
static boolean canReplaceStackTarget(PlatformBlockState state, boolean allowFluid) {
|
||||
static boolean canReplaceStackTarget(NativeBlockState state, boolean allowFluid) {
|
||||
return B.isAir(state) || allowFluid && B.isFluid(state);
|
||||
}
|
||||
|
||||
private static boolean canPlaceTwoBlockPlant(Hunk<PlatformBlockState> data, int x, int z,
|
||||
private static boolean canPlaceTwoBlockPlant(Hunk<NativeBlockState> data, int x, int z,
|
||||
int lowerY, int upperY, boolean caveSkipFluid) {
|
||||
if (lowerY < 0 || upperY >= data.getHeight()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
PlatformBlockState lower = data.get(x, lowerY, z);
|
||||
PlatformBlockState upper = data.get(x, upperY, z);
|
||||
NativeBlockState lower = data.get(x, lowerY, z);
|
||||
NativeBlockState upper = data.get(x, upperY, z);
|
||||
return B.isAir(lower) && B.isAir(upper)
|
||||
&& (!caveSkipFluid || !B.isFluid(lower) && !B.isFluid(upper));
|
||||
}
|
||||
@@ -510,13 +510,13 @@ final class DecoratorCore {
|
||||
return stack;
|
||||
}
|
||||
|
||||
private static boolean allowsSurface(IrisDecorator decorator, PlatformBlockState surface, IrisData data) {
|
||||
private static boolean allowsSurface(IrisDecorator decorator, NativeBlockState surface, IrisData data) {
|
||||
return decorator.isForcePlace()
|
||||
|| (decorator.getWhitelist() == null || matchesPalette(decorator.getWhitelistArray(data), surface))
|
||||
&& (decorator.getBlacklist() == null || !matchesPalette(decorator.getBlacklistArray(data), surface));
|
||||
}
|
||||
|
||||
private static void placeSingleSpike(PlatformBlockState spike, Hunk<PlatformBlockState> data,
|
||||
private static void placeSingleSpike(NativeBlockState spike, Hunk<NativeBlockState> data,
|
||||
int x, int z, int y, boolean upward, boolean allowWater) {
|
||||
if (!IrisSpeleothems.canPlace(spike, data, x, z, y, upward, allowWater)) {
|
||||
return;
|
||||
@@ -525,15 +525,15 @@ final class DecoratorCore {
|
||||
IrisSpeleothems.finishColumn(data, x, z, y, 1, upward);
|
||||
}
|
||||
|
||||
private static void finishVineTip(Hunk<PlatformBlockState> data, int x, int z, int y) {
|
||||
PlatformBlockState state = data.get(x, y, z);
|
||||
PlatformBlockState tip = stackedVineBlock(state, 1, 0);
|
||||
private static void finishVineTip(Hunk<NativeBlockState> data, int x, int z, int y) {
|
||||
NativeBlockState state = data.get(x, y, z);
|
||||
NativeBlockState tip = stackedVineBlock(state, 1, 0);
|
||||
if (tip != state) {
|
||||
data.set(x, y, z, tip);
|
||||
}
|
||||
}
|
||||
|
||||
static String stackedVineKey(PlatformBlockState state, int stack, int index) {
|
||||
static String stackedVineKey(NativeBlockState state, int stack, int index) {
|
||||
String material = IrisProceduralBlocks.materialKey(state);
|
||||
boolean tip = index == stack - 1;
|
||||
return switch (material) {
|
||||
@@ -543,7 +543,7 @@ final class DecoratorCore {
|
||||
};
|
||||
}
|
||||
|
||||
private static PlatformBlockState stackedVineBlock(PlatformBlockState state, int stack, int index) {
|
||||
private static NativeBlockState stackedVineBlock(NativeBlockState state, int stack, int index) {
|
||||
String key = stackedVineKey(state, stack, index);
|
||||
if (key == null) {
|
||||
return state;
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.decoration;
|
||||
|
||||
import art.arcane.iris.generation.mantle.EngineMantle;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
|
||||
public final class DecoratorPlatformHooks {
|
||||
@@ -30,11 +30,11 @@ public final class DecoratorPlatformHooks {
|
||||
}
|
||||
|
||||
public interface FaceFixer {
|
||||
PlatformBlockState fixFaces(PlatformBlockState state, Hunk<PlatformBlockState> hunk, int rX, int rZ, int x, int y, int z, EngineMantle mantle);
|
||||
NativeBlockState fixFaces(NativeBlockState state, Hunk<NativeBlockState> hunk, int rX, int rZ, int x, int y, int z, EngineMantle mantle);
|
||||
}
|
||||
|
||||
public interface SurfaceSturdiness {
|
||||
boolean canGoOn(PlatformBlockState surface, boolean upward);
|
||||
boolean canGoOn(NativeBlockState surface, boolean upward);
|
||||
}
|
||||
|
||||
public static synchronized Bindings bind(FaceFixer faceFixer, SurfaceSturdiness surfaceSturdiness) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
/*
|
||||
* Floating island decoration path. Bypasses all canGoOn, slope, whitelist, and blacklist
|
||||
@@ -33,7 +33,7 @@ public class FloatingDecorator {
|
||||
|
||||
public static int decorateColumn(Engine engine, IrisBiome target, IrisDecorationPart part,
|
||||
int xf, int zf, int realX, int realZ,
|
||||
int height, int max, Hunk<PlatformBlockState> data, RNG rng,
|
||||
int height, int max, Hunk<NativeBlockState> data, RNG rng,
|
||||
Runnable candidatesNullCallback) {
|
||||
RNG gRNG = new RNG(DecoratorCore.partSeed(engine.getSeedManager().getDecorator(), part));
|
||||
IrisDecorator decorator = DecoratorCore.pickDecorator(target, part, gRNG, rng, engine.getData(), realX, realZ);
|
||||
|
||||
@@ -25,7 +25,7 @@ import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
private final RNG partRNG;
|
||||
@@ -38,13 +38,13 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
Hunk<PlatformBlockState> data, IrisBiome biome, int height, int max) {
|
||||
Hunk<NativeBlockState> data, IrisBiome biome, int height, int max) {
|
||||
decorate(x, z, realX, realX1, realX_1, realZ, realZ1, realZ_1, data, biome, biome.getInferredType(), height, max);
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
Hunk<PlatformBlockState> data, IrisBiome biome, InferredType inferredType, int height, int max) {
|
||||
Hunk<NativeBlockState> data, IrisBiome biome, InferredType inferredType, int height, int max) {
|
||||
boolean caveSkipFluid = IrisSurfaceDecorator.skipsFluid(inferredType);
|
||||
RNG rng = getRNG(realX, realZ);
|
||||
IrisDecorator decorator = DecoratorCore.pickDecorator(biome, getPart(), partRNG, rng, getData(), realX, realZ);
|
||||
@@ -55,7 +55,7 @@ public class IrisCeilingDecorator extends IrisEngineDecorator {
|
||||
|
||||
if (!decorator.isStacking()) {
|
||||
if (caveSkipFluid) {
|
||||
PlatformBlockState state = data.get(x, height, z);
|
||||
NativeBlockState state = data.get(x, height, z);
|
||||
if (B.isFluid(state)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import art.arcane.iris.generation.noise.NoiseStyle;
|
||||
import art.arcane.iris.generation.terrain.IrisSlopeClip;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.iris.pack.schema.annotation.DependsOn;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
@@ -40,7 +40,7 @@ import art.arcane.volmlib.util.noise.CNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("decorator")
|
||||
@@ -53,12 +53,12 @@ public class IrisDecorator {
|
||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> varianceGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> blockDataTops = new AtomicCache<>();
|
||||
private final transient AtomicCache<PlatformBlockState[]> blockDataArray = new AtomicCache<>();
|
||||
private final transient AtomicCache<PlatformBlockState[]> blockDataTopsArray = new AtomicCache<>();
|
||||
private final transient AtomicCache<PlatformBlockState[]> whitelistArray = new AtomicCache<>();
|
||||
private final transient AtomicCache<PlatformBlockState[]> blacklistArray = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<NativeBlockState>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<NativeBlockState>> blockDataTops = new AtomicCache<>();
|
||||
private final transient AtomicCache<NativeBlockState[]> blockDataArray = new AtomicCache<>();
|
||||
private final transient AtomicCache<NativeBlockState[]> blockDataTopsArray = new AtomicCache<>();
|
||||
private final transient AtomicCache<NativeBlockState[]> whitelistArray = new AtomicCache<>();
|
||||
private final transient AtomicCache<NativeBlockState[]> blacklistArray = new AtomicCache<>();
|
||||
@Description("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
|
||||
private IrisGeneratorStyle variance = NoiseStyle.STATIC.style();
|
||||
@Description("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
|
||||
@@ -176,7 +176,7 @@ public class IrisDecorator {
|
||||
return getGenerator(rng, data).fitDouble(0D, 1D, xx, zz) <= chance;
|
||||
}
|
||||
|
||||
public PlatformBlockState getBlockData(IrisBiome b, RNG rng, double x, double z, IrisData data) {
|
||||
public NativeBlockState getBlockData(IrisBiome b, RNG rng, double x, double z, IrisData data) {
|
||||
if (!passesChanceGate(rng, x, z, data)) {
|
||||
return null;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public class IrisDecorator {
|
||||
return getVarianceGenerator(rng, data).fit(getBlockData(data), z, x);
|
||||
}
|
||||
|
||||
public PlatformBlockState getBlockData100(IrisBiome b, RNG rng, double x, double y, double z, IrisData data) {
|
||||
public NativeBlockState getBlockData100(IrisBiome b, RNG rng, double x, double y, double z, IrisData data) {
|
||||
if (getBlockData(data).isEmpty()) {
|
||||
IrisLogging.warnOnce("decorator-empty:" + b.getName(), "Empty Block Data for " + b.getName());
|
||||
return null;
|
||||
@@ -199,7 +199,7 @@ public class IrisDecorator {
|
||||
return getVarianceGenerator(rng, data).fit(getBlockData(data), z, y, x); //X and Z must be switched
|
||||
}
|
||||
|
||||
public PlatformBlockState getBlockDataForTop(IrisBiome b, RNG rng, double x, double y, double z, IrisData data) {
|
||||
public NativeBlockState getBlockDataForTop(IrisBiome b, RNG rng, double x, double y, double z, IrisData data) {
|
||||
if (getBlockDataTops(data).isEmpty()) {
|
||||
return getBlockData100(b, rng, x, y, z, data);
|
||||
}
|
||||
@@ -218,8 +218,8 @@ public class IrisDecorator {
|
||||
return null;
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> getBlockData(IrisData data) {
|
||||
KList<PlatformBlockState> cached = blockData.getIfPresent();
|
||||
public KList<NativeBlockState> getBlockData(IrisData data) {
|
||||
KList<NativeBlockState> cached = blockData.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -227,9 +227,9 @@ public class IrisDecorator {
|
||||
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<PlatformBlockState> blockData = new KList<>();
|
||||
KList<NativeBlockState> blockData = new KList<>();
|
||||
for (IrisBlockData i : palette) {
|
||||
PlatformBlockState bx = i.getBlockData(data);
|
||||
NativeBlockState bx = i.getBlockData(data);
|
||||
if (bx != null) {
|
||||
for (int n = 0; n < i.getWeight(); n++) {
|
||||
blockData.add(bx);
|
||||
@@ -241,8 +241,8 @@ public class IrisDecorator {
|
||||
});
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> getBlockDataTops(IrisData data) {
|
||||
KList<PlatformBlockState> cached = blockDataTops.getIfPresent();
|
||||
public KList<NativeBlockState> getBlockDataTops(IrisData data) {
|
||||
KList<NativeBlockState> cached = blockDataTops.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -250,9 +250,9 @@ public class IrisDecorator {
|
||||
|
||||
return blockDataTops.aquire(() ->
|
||||
{
|
||||
KList<PlatformBlockState> blockDataTops = new KList<>();
|
||||
KList<NativeBlockState> blockDataTops = new KList<>();
|
||||
for (IrisBlockData i : topPalette) {
|
||||
PlatformBlockState bx = i.getBlockData(data);
|
||||
NativeBlockState bx = i.getBlockData(data);
|
||||
if (bx != null) {
|
||||
for (int n = 0; n < i.getWeight(); n++) {
|
||||
blockDataTops.add(bx);
|
||||
@@ -264,29 +264,29 @@ public class IrisDecorator {
|
||||
});
|
||||
}
|
||||
|
||||
public PlatformBlockState[] getBlockDataArray(IrisData data) {
|
||||
PlatformBlockState[] cached = blockDataArray.getIfPresent();
|
||||
public NativeBlockState[] getBlockDataArray(IrisData data) {
|
||||
NativeBlockState[] cached = blockDataArray.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
return blockDataArray.aquire(() -> {
|
||||
KList<PlatformBlockState> list = getBlockData(data);
|
||||
return list.toArray(new PlatformBlockState[0]);
|
||||
KList<NativeBlockState> list = getBlockData(data);
|
||||
return list.toArray(new NativeBlockState[0]);
|
||||
});
|
||||
}
|
||||
|
||||
public PlatformBlockState[] getBlockDataTopsArray(IrisData data) {
|
||||
PlatformBlockState[] cached = blockDataTopsArray.getIfPresent();
|
||||
public NativeBlockState[] getBlockDataTopsArray(IrisData data) {
|
||||
NativeBlockState[] cached = blockDataTopsArray.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
}
|
||||
|
||||
return blockDataTopsArray.aquire(() -> {
|
||||
KList<PlatformBlockState> list = getBlockDataTops(data);
|
||||
return list.toArray(new PlatformBlockState[0]);
|
||||
KList<NativeBlockState> list = getBlockDataTops(data);
|
||||
return list.toArray(new NativeBlockState[0]);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -294,8 +294,8 @@ public class IrisDecorator {
|
||||
* The resolved whitelist palette. Empty when no whitelist is configured; callers must still gate on
|
||||
* {@link #getWhitelist()} being non null, because an explicitly empty whitelist blocks all placement.
|
||||
*/
|
||||
public PlatformBlockState[] getWhitelistArray(IrisData data) {
|
||||
PlatformBlockState[] cached = whitelistArray.getIfPresent();
|
||||
public NativeBlockState[] getWhitelistArray(IrisData data) {
|
||||
NativeBlockState[] cached = whitelistArray.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -304,8 +304,8 @@ public class IrisDecorator {
|
||||
return whitelistArray.aquire(() -> resolvePalette(whitelist, data));
|
||||
}
|
||||
|
||||
public PlatformBlockState[] getBlacklistArray(IrisData data) {
|
||||
PlatformBlockState[] cached = blacklistArray.getIfPresent();
|
||||
public NativeBlockState[] getBlacklistArray(IrisData data) {
|
||||
NativeBlockState[] cached = blacklistArray.getIfPresent();
|
||||
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -314,12 +314,12 @@ public class IrisDecorator {
|
||||
return blacklistArray.aquire(() -> resolvePalette(blacklist, data));
|
||||
}
|
||||
|
||||
private static PlatformBlockState[] resolvePalette(KList<IrisBlockData> list, IrisData data) {
|
||||
private static NativeBlockState[] resolvePalette(KList<IrisBlockData> list, IrisData data) {
|
||||
if (list == null) {
|
||||
return new PlatformBlockState[0];
|
||||
return new NativeBlockState[0];
|
||||
}
|
||||
|
||||
PlatformBlockState[] resolved = new PlatformBlockState[list.size()];
|
||||
NativeBlockState[] resolved = new NativeBlockState[list.size()];
|
||||
|
||||
for (int i = 0; i < resolved.length; i++) {
|
||||
resolved[i] = list.get(i).getBlockData(data);
|
||||
@@ -328,8 +328,8 @@ public class IrisDecorator {
|
||||
return resolved;
|
||||
}
|
||||
|
||||
public PlatformBlockState pickBlockData(RNG rng, IrisData data, double x, double z) {
|
||||
PlatformBlockState[] arr = getBlockDataArray(data);
|
||||
public NativeBlockState pickBlockData(RNG rng, IrisData data, double x, double z) {
|
||||
NativeBlockState[] arr = getBlockDataArray(data);
|
||||
if (arr.length == 0) {
|
||||
return null;
|
||||
}
|
||||
@@ -339,8 +339,8 @@ public class IrisDecorator {
|
||||
return arr[Math.abs((int) getVarianceGenerator(rng, data).fit(0, arr.length - 1, z, x))];
|
||||
}
|
||||
|
||||
public PlatformBlockState pickBlockDataTop(RNG rng, IrisData data, double x, double z) {
|
||||
PlatformBlockState[] arr = getBlockDataTopsArray(data);
|
||||
public NativeBlockState pickBlockDataTop(RNG rng, IrisData data, double x, double z) {
|
||||
NativeBlockState[] arr = getBlockDataTopsArray(data);
|
||||
if (arr.length == 0) {
|
||||
return pickBlockData(rng, data, x, z);
|
||||
}
|
||||
|
||||
+14
-14
@@ -23,7 +23,7 @@ import art.arcane.iris.generation.block.IrisBlockData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
@@ -31,7 +31,7 @@ import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.Required;
|
||||
import art.arcane.iris.pack.schema.annotation.Snippet;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
@@ -57,7 +57,7 @@ public class IrisDepositGenerator {
|
||||
private static final long FNV_PRIME = 0x100000001b3L;
|
||||
|
||||
private final transient ConcurrentMap<ClumpCacheKey, KList<IrisObject>> objects = new ConcurrentHashMap<>();
|
||||
private final transient AtomicCache<KList<PlatformBlockState>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KList<NativeBlockState>> blockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<Boolean> ore = new AtomicCache<>();
|
||||
private final transient AtomicCache<KSet<String>> replaceableBlockData = new AtomicCache<>();
|
||||
private final transient AtomicCache<KSet<String>> surfaceReplaceableBlockData = new AtomicCache<>();
|
||||
@@ -210,9 +210,9 @@ public class IrisDepositGenerator {
|
||||
hash = mix(hash, Double.doubleToLongBits(spawnChance));
|
||||
hash = mix(hash, Double.doubleToLongBits(perClumpSpawnChance));
|
||||
hash = mix(hash, Double.doubleToLongBits(discardChanceOnAirExposure));
|
||||
KList<PlatformBlockState> resolvedPalette = getBlockData(rdata);
|
||||
KList<NativeBlockState> resolvedPalette = getBlockData(rdata);
|
||||
hash = mix(hash, resolvedPalette.size());
|
||||
for (PlatformBlockState block : resolvedPalette) {
|
||||
for (NativeBlockState block : resolvedPalette) {
|
||||
hash = mixString(hash, block == null ? null : block.key());
|
||||
}
|
||||
hash = mix(hash, varience);
|
||||
@@ -443,17 +443,17 @@ public class IrisDepositGenerator {
|
||||
return o;
|
||||
}
|
||||
|
||||
private PlatformBlockState nextBlock(RNG rngv, IrisData rdata) {
|
||||
private NativeBlockState nextBlock(RNG rngv, IrisData rdata) {
|
||||
return getBlockData(rdata).get(rngv.i(0, getBlockData(rdata).size()));
|
||||
}
|
||||
|
||||
public KList<PlatformBlockState> getBlockData(IrisData rdata) {
|
||||
public KList<NativeBlockState> getBlockData(IrisData rdata) {
|
||||
return blockData.aquire(() ->
|
||||
{
|
||||
KList<PlatformBlockState> blockData = new KList<>();
|
||||
KList<NativeBlockState> blockData = new KList<>();
|
||||
|
||||
for (IrisBlockData ix : palette) {
|
||||
PlatformBlockState bx = ix.getBlockData(rdata);
|
||||
NativeBlockState bx = ix.getBlockData(rdata);
|
||||
|
||||
if (bx != null) {
|
||||
blockData.add(bx);
|
||||
@@ -466,7 +466,7 @@ public class IrisDepositGenerator {
|
||||
|
||||
public boolean isOre(IrisData rdata) {
|
||||
return ore.aquire(() -> {
|
||||
for (PlatformBlockState block : getBlockData(rdata)) {
|
||||
for (NativeBlockState block : getBlockData(rdata)) {
|
||||
if (block.isOre()) {
|
||||
return true;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ public class IrisDepositGenerator {
|
||||
});
|
||||
}
|
||||
|
||||
public boolean canReplace(PlatformBlockState state) {
|
||||
public boolean canReplace(NativeBlockState state) {
|
||||
if (replaceableBlocks == null || replaceableBlocks.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ public class IrisDepositGenerator {
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean canReplaceSurface(PlatformBlockState state) {
|
||||
public boolean canReplaceSurface(NativeBlockState state) {
|
||||
if (surfaceReplaceableBlocks == null || surfaceReplaceableBlocks.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
@@ -507,7 +507,7 @@ public class IrisDepositGenerator {
|
||||
return surfaceReplaceableBlocks != null && !surfaceReplaceableBlocks.isEmpty();
|
||||
}
|
||||
|
||||
public boolean canReplaceSurface(PlatformBlockState state, IrisBiome surfaceBiome) {
|
||||
public boolean canReplaceSurface(NativeBlockState state, IrisBiome surfaceBiome) {
|
||||
if (surfaceBiome != null && surfaceBiome.hasSurfaceOreReplaceableBlocks()) {
|
||||
return surfaceBiome.canReplaceSurfaceOre(state);
|
||||
}
|
||||
@@ -539,7 +539,7 @@ public class IrisDepositGenerator {
|
||||
private KSet<String> resolveBlockKeys(KList<String> keys) {
|
||||
KSet<String> resolved = new KSet<>();
|
||||
for (String key : keys) {
|
||||
PlatformBlockState state = B.getStateOrNull(key, false);
|
||||
NativeBlockState state = B.getStateOrNull(key, false);
|
||||
if (state != null) {
|
||||
resolved.add(IrisProceduralBlocks.materialKey(state));
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.decoration;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
@@ -29,7 +29,7 @@ import art.arcane.volmlib.util.collection.KMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@@ -40,7 +40,7 @@ import lombok.experimental.Accessors;
|
||||
@Description("Remaps ore block ids to alternate block ids within a vertical band. Ores declared at dimension, region, and biome scope can be rewritten at placement time (for example, iron_ore -> deepslate_iron_ore inside a deep carving band, or yourmod:iron -> yourmod:moon_iron inside a lunar biome).")
|
||||
@Data
|
||||
public class IrisDepositVariant {
|
||||
private final transient AtomicCache<KMap<String, PlatformBlockState>> resolved = new AtomicCache<>();
|
||||
private final transient AtomicCache<KMap<String, NativeBlockState>> resolved = new AtomicCache<>();
|
||||
|
||||
@Required
|
||||
@MinNumber(-2048)
|
||||
@@ -58,21 +58,21 @@ public class IrisDepositVariant {
|
||||
@Description("Source block id (for example `minecraft:iron_ore`) -> replacement block id (for example `minecraft:deepslate_iron_ore`). Any block id the data loader resolves is accepted, including external/mod blocks. Source match is by material only, so block properties on the source key are ignored.")
|
||||
private KMap<String, String> remap = new KMap<>();
|
||||
|
||||
public PlatformBlockState remapOrNull(PlatformBlockState ore, IrisData rdata) {
|
||||
public NativeBlockState remapOrNull(NativeBlockState ore, IrisData rdata) {
|
||||
if (ore == null || remap == null || remap.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
KMap<String, PlatformBlockState> map = resolved.aquire(() -> buildResolved(rdata));
|
||||
KMap<String, NativeBlockState> map = resolved.aquire(() -> buildResolved(rdata));
|
||||
return map.get(IrisProceduralBlocks.materialKey(ore));
|
||||
}
|
||||
|
||||
private KMap<String, PlatformBlockState> buildResolved(IrisData rdata) {
|
||||
KMap<String, PlatformBlockState> out = new KMap<>();
|
||||
private KMap<String, NativeBlockState> buildResolved(IrisData rdata) {
|
||||
KMap<String, NativeBlockState> out = new KMap<>();
|
||||
|
||||
for (java.util.Map.Entry<String, String> entry : remap.entrySet()) {
|
||||
PlatformBlockState source = B.getStateOrNull(entry.getKey(), false);
|
||||
PlatformBlockState target = B.getStateOrNull(entry.getValue(), true);
|
||||
NativeBlockState source = B.getStateOrNull(entry.getKey(), false);
|
||||
NativeBlockState target = B.getStateOrNull(entry.getValue(), true);
|
||||
|
||||
if (source == null || target == null) {
|
||||
continue;
|
||||
|
||||
@@ -24,7 +24,7 @@ import art.arcane.iris.generation.terrain.IrisMaterialPalette;
|
||||
import art.arcane.iris.pack.value.IrisRange;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
@@ -33,7 +33,7 @@ import art.arcane.volmlib.util.noise.CNG;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@@ -62,7 +62,7 @@ public class IrisOreGenerator {
|
||||
palette.getLayerGenerator(rng, data);
|
||||
}
|
||||
|
||||
public PlatformBlockState generate(int x, int y, int z, RNG rng, IrisData data) {
|
||||
public NativeBlockState generate(int x, int y, int z, RNG rng, IrisData data) {
|
||||
if (threshold <= 0 || !range.contains(y)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import art.arcane.iris.generation.terrain.IrisMaterialPalette;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
@@ -57,7 +57,7 @@ public final class IrisProceduralBlocks {
|
||||
return palette != null && palette.getPalette() != null && !palette.getPalette().isEmpty();
|
||||
}
|
||||
|
||||
public static PlatformBlockState resolve(String block, IrisMaterialPalette palette, IrisData data, int x, int y, int z, RNG paletteRng) {
|
||||
public static NativeBlockState resolve(String block, IrisMaterialPalette palette, IrisData data, int x, int y, int z, RNG paletteRng) {
|
||||
if (paletteSet(palette)) {
|
||||
return palette.get(paletteRng, x, y, z, data);
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public final class IrisProceduralBlocks {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean hasProperty(PlatformBlockState state, String property) {
|
||||
public static boolean hasProperty(NativeBlockState state, String property) {
|
||||
String key = state.key();
|
||||
int start = propertyStart(key, property);
|
||||
if (start < 0) {
|
||||
@@ -78,7 +78,7 @@ public final class IrisProceduralBlocks {
|
||||
}
|
||||
|
||||
/** Blocks that fall when unsupported: sand, gravel and concrete powder. */
|
||||
public static boolean isGravityAffected(PlatformBlockState state) {
|
||||
public static boolean isGravityAffected(NativeBlockState state) {
|
||||
if (state == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ public final class IrisProceduralBlocks {
|
||||
|| key.endsWith("_concrete_powder");
|
||||
}
|
||||
|
||||
public static String materialKey(PlatformBlockState state) {
|
||||
public static String materialKey(NativeBlockState state) {
|
||||
String memoized = state.materialKey();
|
||||
if (memoized != null) {
|
||||
return memoized;
|
||||
@@ -101,7 +101,7 @@ public final class IrisProceduralBlocks {
|
||||
return bracket < 0 ? key : key.substring(0, bracket);
|
||||
}
|
||||
|
||||
public static String propertyValue(PlatformBlockState state, String property) {
|
||||
public static String propertyValue(NativeBlockState state, String property) {
|
||||
String key = state.key();
|
||||
int start = propertyStart(key, property);
|
||||
if (start < 0) {
|
||||
@@ -142,7 +142,7 @@ public final class IrisProceduralBlocks {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static IrisObject assemble(Map<Vector3i, PlatformBlockState> blocks) {
|
||||
public static IrisObject assemble(Map<Vector3i, NativeBlockState> blocks) {
|
||||
if (blocks == null || blocks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ public final class IrisProceduralBlocks {
|
||||
int cz = d / 2;
|
||||
|
||||
IrisObject object = new IrisObject(w, h, d);
|
||||
for (Map.Entry<Vector3i, PlatformBlockState> entry : blocks.entrySet()) {
|
||||
for (Map.Entry<Vector3i, NativeBlockState> entry : blocks.entrySet()) {
|
||||
Vector3i v = entry.getKey();
|
||||
int nx = v.getBlockX() - minX - cx;
|
||||
int ny = v.getBlockY() - cy + 1;
|
||||
|
||||
@@ -23,7 +23,7 @@ import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
||||
private final RNG partRNG;
|
||||
@@ -36,7 +36,7 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
Hunk<PlatformBlockState> data, IrisBiome biome, int height, int max) {
|
||||
Hunk<NativeBlockState> data, IrisBiome biome, int height, int max) {
|
||||
int limit = Math.min(max, Math.min(getEngine().getHeight(), data.getHeight()));
|
||||
if (height < 0 || height >= limit) {
|
||||
return;
|
||||
@@ -53,7 +53,7 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
||||
&& !decorator.getSlopeCondition().isValid(getComplex().getSlopeStream().get(realX, realZ))) {
|
||||
return;
|
||||
}
|
||||
PlatformBlockState block = decorator.getBlockData100(biome, rng, realX, height, realZ, getData());
|
||||
NativeBlockState block = decorator.getBlockData100(biome, rng, realX, height, realZ, getData());
|
||||
if (block != null) {
|
||||
data.set(x, height, z, block);
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class IrisSeaFloorDecorator extends IrisEngineDecorator {
|
||||
for (int i = 0; i < stack; i++) {
|
||||
int h = height + i;
|
||||
double threshold = stack == 1 ? 1.0 : ((double) i) / (stack - 1);
|
||||
PlatformBlockState block = threshold >= decorator.getTopThreshold()
|
||||
NativeBlockState block = threshold >= decorator.getTopThreshold()
|
||||
? decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData())
|
||||
: decorator.getBlockData100(biome, rng, realX, h, realZ, getData());
|
||||
if (block == null) {
|
||||
|
||||
+4
-4
@@ -23,7 +23,7 @@ import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||
private final RNG partRNG;
|
||||
@@ -36,7 +36,7 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
Hunk<PlatformBlockState> data, IrisBiome biome, int height, int max) {
|
||||
Hunk<NativeBlockState> data, IrisBiome biome, int height, int max) {
|
||||
int maxBaseY = Math.min(max, Math.min(getEngine().getHeight(), data.getHeight()) - 1);
|
||||
if (height < 0 || height >= maxBaseY) {
|
||||
return;
|
||||
@@ -51,7 +51,7 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||
if (!decorator.isStacking()) {
|
||||
int targetY = height + 1;
|
||||
if (DecoratorCore.canReplaceStackTarget(data.get(x, targetY, z), false)) {
|
||||
PlatformBlockState block = decorator.getBlockData100(biome, rng, realX, height, realZ, getData());
|
||||
NativeBlockState block = decorator.getBlockData100(biome, rng, realX, height, realZ, getData());
|
||||
if (block != null) {
|
||||
data.set(x, targetY, z, block);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class IrisSeaSurfaceDecorator extends IrisEngineDecorator {
|
||||
break;
|
||||
}
|
||||
double threshold = stack == 1 ? 1.0 : ((double) i) / (stack - 1);
|
||||
PlatformBlockState block = threshold >= decorator.getTopThreshold()
|
||||
NativeBlockState block = threshold >= decorator.getTopThreshold()
|
||||
? decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData())
|
||||
: decorator.getBlockData100(biome, rng, realX, h, realZ, getData());
|
||||
if (block == null) {
|
||||
|
||||
+8
-8
@@ -24,7 +24,7 @@ import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.stream.ProceduralStream;
|
||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
private final RNG partRNG;
|
||||
@@ -37,7 +37,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
Hunk<PlatformBlockState> data, IrisBiome biome, int height, int max) {
|
||||
Hunk<NativeBlockState> data, IrisBiome biome, int height, int max) {
|
||||
double localFluidHeight = getEngine().getMantle().getFluidHeight(realX, realZ);
|
||||
if (height != Math.round(localFluidHeight)) {
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
int z,
|
||||
int realX,
|
||||
int realZ,
|
||||
Hunk<PlatformBlockState> data,
|
||||
Hunk<NativeBlockState> data,
|
||||
IrisBiome biome,
|
||||
int height,
|
||||
int max
|
||||
@@ -72,7 +72,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
int z,
|
||||
int realX,
|
||||
int realZ,
|
||||
Hunk<PlatformBlockState> data,
|
||||
Hunk<NativeBlockState> data,
|
||||
IrisBiome biome,
|
||||
int height,
|
||||
int max
|
||||
@@ -89,7 +89,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
return;
|
||||
}
|
||||
|
||||
PlatformBlockState support = data.get(x, height, z);
|
||||
NativeBlockState support = data.get(x, height, z);
|
||||
if (support == null || !support.isSolid()) {
|
||||
return;
|
||||
}
|
||||
@@ -102,7 +102,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
|| !DecoratorCore.canReplaceStackTarget(data.get(x, targetY, z), false)) {
|
||||
return;
|
||||
}
|
||||
PlatformBlockState block = decorator.getBlockData100(biome, rng, realX, height, realZ, getData());
|
||||
NativeBlockState block = decorator.getBlockData100(biome, rng, realX, height, realZ, getData());
|
||||
if (block != null && DecoratorCore.isValidShorelineSupport(decorator, block, support)
|
||||
&& IrisSugarCane.canPlace(block, data, x, targetY, z, realX, realZ, getEngine())) {
|
||||
data.set(x, targetY, z, block);
|
||||
@@ -124,7 +124,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
return;
|
||||
}
|
||||
|
||||
PlatformBlockState block = decorator.getBlockDataForTop(biome, rng, realX, height, realZ, getData());
|
||||
NativeBlockState block = decorator.getBlockDataForTop(biome, rng, realX, height, realZ, getData());
|
||||
if (block != null && DecoratorCore.isValidShorelineSupport(decorator, block, support)
|
||||
&& IrisSugarCane.canPlace(block, data, x, targetY, z, realX, realZ, getEngine())) {
|
||||
data.set(x, targetY, z, block);
|
||||
@@ -141,7 +141,7 @@ public class IrisShoreLineDecorator extends IrisEngineDecorator {
|
||||
break;
|
||||
}
|
||||
double threshold = ((double) i) / (stack - 1);
|
||||
PlatformBlockState block = threshold >= decorator.getTopThreshold()
|
||||
NativeBlockState block = threshold >= decorator.getTopThreshold()
|
||||
? decorator.getBlockDataForTop(biome, rng, realX, h, realZ, getData())
|
||||
: decorator.getBlockData100(biome, rng, realX, h, realZ, getData());
|
||||
if (block == null) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package art.arcane.iris.generation.decoration;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -11,12 +11,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public final class IrisSpeleothems {
|
||||
private static final String[] SPIKE_THICKNESSES = {"tip", "frustum", "base", "middle", "tip_merge"};
|
||||
private static final ConcurrentHashMap<PlatformBlockState, PlatformBlockState[][]> SPIKE_STATES = new ConcurrentHashMap<>();
|
||||
private static final ConcurrentHashMap<NativeBlockState, NativeBlockState[][]> SPIKE_STATES = new ConcurrentHashMap<>();
|
||||
|
||||
private IrisSpeleothems() {
|
||||
}
|
||||
|
||||
public static boolean isSpike(PlatformBlockState state) {
|
||||
public static boolean isSpike(NativeBlockState state) {
|
||||
if (state == null || state.key() == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -24,29 +24,29 @@ public final class IrisSpeleothems {
|
||||
return material.equals("minecraft:pointed_dripstone") || material.equals("minecraft:sulfur_spike");
|
||||
}
|
||||
|
||||
public static boolean isSupported(PlatformBlockState state, Hunk<PlatformBlockState> data, int x, int z, int y) {
|
||||
public static boolean isSupported(NativeBlockState state, Hunk<NativeBlockState> data, int x, int z, int y) {
|
||||
return isSupported(state, data, x, z, y,
|
||||
"up".equals(IrisProceduralBlocks.propertyValue(state, "vertical_direction")));
|
||||
}
|
||||
|
||||
public static void finishAtTip(Hunk<PlatformBlockState> data, int x, int z, int y) {
|
||||
PlatformBlockState state = data.get(x, y, z);
|
||||
public static void finishAtTip(Hunk<NativeBlockState> data, int x, int z, int y) {
|
||||
NativeBlockState state = data.get(x, y, z);
|
||||
if (!isSpike(state)) {
|
||||
return;
|
||||
}
|
||||
boolean upward = "up".equals(IrisProceduralBlocks.propertyValue(state, "vertical_direction"));
|
||||
int frontY = y + (upward ? 1 : -1);
|
||||
PlatformBlockState front = frontY >= 0 && frontY < data.getHeight() ? data.get(x, frontY, z) : null;
|
||||
NativeBlockState front = frontY >= 0 && frontY < data.getHeight() ? data.get(x, frontY, z) : null;
|
||||
if (!sameSpike(state, front, upward)) {
|
||||
finishColumn(data, x, z, y, 1, upward);
|
||||
}
|
||||
}
|
||||
|
||||
public static void finishColumn(Hunk<PlatformBlockState> data, int x, int z, int start, int placed, boolean upward) {
|
||||
public static void finishColumn(Hunk<NativeBlockState> data, int x, int z, int start, int placed, boolean upward) {
|
||||
int step = upward ? 1 : -1;
|
||||
for (int i = placed - 1; i >= 0; i--) {
|
||||
int y = start + step * i;
|
||||
PlatformBlockState state = data.get(x, y, z);
|
||||
NativeBlockState state = data.get(x, y, z);
|
||||
if (isSpike(state)) {
|
||||
finishSpike(data, x, z, y, state, upward);
|
||||
}
|
||||
@@ -54,12 +54,12 @@ public final class IrisSpeleothems {
|
||||
if (placed == 0) {
|
||||
return;
|
||||
}
|
||||
PlatformBlockState state = data.get(x, start, z);
|
||||
NativeBlockState state = data.get(x, start, z);
|
||||
if (!isSpike(state)) {
|
||||
return;
|
||||
}
|
||||
for (int y = start - step; y >= 0 && y < data.getHeight(); y -= step) {
|
||||
PlatformBlockState behind = data.get(x, y, z);
|
||||
NativeBlockState behind = data.get(x, y, z);
|
||||
if (!sameSpike(state, behind, upward)) {
|
||||
break;
|
||||
}
|
||||
@@ -67,27 +67,27 @@ public final class IrisSpeleothems {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean canPlace(PlatformBlockState spike, Hunk<PlatformBlockState> data,
|
||||
static boolean canPlace(NativeBlockState spike, Hunk<NativeBlockState> data,
|
||||
int x, int z, int y, boolean upward, boolean allowWater) {
|
||||
int supportY = y + (upward ? -1 : 1);
|
||||
if (y < 0 || y >= data.getHeight() || supportY < 0 || supportY >= data.getHeight()) {
|
||||
return false;
|
||||
}
|
||||
PlatformBlockState existing = data.get(x, y, z);
|
||||
NativeBlockState existing = data.get(x, y, z);
|
||||
if (!B.isAir(existing) && !(allowWater && existing != null && existing.isWater())) {
|
||||
return false;
|
||||
}
|
||||
return isSupported(spike, data, x, z, y, upward);
|
||||
}
|
||||
|
||||
static PlatformBlockState orient(PlatformBlockState state, PlatformBlockState existing, boolean upward) {
|
||||
static NativeBlockState orient(NativeBlockState state, NativeBlockState existing, boolean upward) {
|
||||
if (existing != null && existing.isWater() && !state.isWaterLogged()) {
|
||||
state = state.withProperty("waterlogged", "true");
|
||||
}
|
||||
return spikeBlock(state, upward, 0);
|
||||
}
|
||||
|
||||
static boolean isSturdy(PlatformBlockState surface, boolean upward) {
|
||||
static boolean isSturdy(NativeBlockState surface, boolean upward) {
|
||||
if (surface == null || B.isAir(surface) || B.isFluid(surface)) {
|
||||
return false;
|
||||
}
|
||||
@@ -98,20 +98,20 @@ public final class IrisSpeleothems {
|
||||
return ((BlockData) surface.nativeHandle()).isFaceSturdy(upward ? BlockFace.UP : BlockFace.DOWN, BlockSupport.FULL);
|
||||
}
|
||||
|
||||
private static boolean isSupported(PlatformBlockState state, Hunk<PlatformBlockState> data,
|
||||
private static boolean isSupported(NativeBlockState state, Hunk<NativeBlockState> data,
|
||||
int x, int z, int y, boolean upward) {
|
||||
int supportY = y + (upward ? -1 : 1);
|
||||
if (supportY < 0 || supportY >= data.getHeight()) {
|
||||
return false;
|
||||
}
|
||||
PlatformBlockState support = data.get(x, supportY, z);
|
||||
NativeBlockState support = data.get(x, supportY, z);
|
||||
return sameSpike(state, support, upward) || isSturdy(support, upward);
|
||||
}
|
||||
|
||||
private static PlatformBlockState[][] buildSpikeStates(PlatformBlockState state) {
|
||||
PlatformBlockState[][] states = new PlatformBlockState[2][SPIKE_THICKNESSES.length];
|
||||
private static NativeBlockState[][] buildSpikeStates(NativeBlockState state) {
|
||||
NativeBlockState[][] states = new NativeBlockState[2][SPIKE_THICKNESSES.length];
|
||||
for (int direction = 0; direction < states.length; direction++) {
|
||||
PlatformBlockState directed = state.withProperty("vertical_direction", direction == 0 ? "up" : "down");
|
||||
NativeBlockState directed = state.withProperty("vertical_direction", direction == 0 ? "up" : "down");
|
||||
for (int thickness = 0; thickness < SPIKE_THICKNESSES.length; thickness++) {
|
||||
states[direction][thickness] = directed.withProperty("thickness", SPIKE_THICKNESSES[thickness]);
|
||||
}
|
||||
@@ -119,22 +119,22 @@ public final class IrisSpeleothems {
|
||||
return states;
|
||||
}
|
||||
|
||||
private static boolean sameSpike(PlatformBlockState state, PlatformBlockState other, boolean upward) {
|
||||
private static boolean sameSpike(NativeBlockState state, NativeBlockState other, boolean upward) {
|
||||
return isSpike(other)
|
||||
&& IrisProceduralBlocks.materialKey(state).equals(IrisProceduralBlocks.materialKey(other))
|
||||
&& (upward ? "up" : "down").equals(IrisProceduralBlocks.propertyValue(other, "vertical_direction"));
|
||||
}
|
||||
|
||||
private static PlatformBlockState spikeBlock(PlatformBlockState state, boolean upward, int thickness) {
|
||||
private static NativeBlockState spikeBlock(NativeBlockState state, boolean upward, int thickness) {
|
||||
return SPIKE_STATES.computeIfAbsent(state, IrisSpeleothems::buildSpikeStates)[upward ? 0 : 1][thickness];
|
||||
}
|
||||
|
||||
private static void finishSpike(Hunk<PlatformBlockState> data, int x, int z, int y, PlatformBlockState state, boolean upward) {
|
||||
private static void finishSpike(Hunk<NativeBlockState> data, int x, int z, int y, NativeBlockState state, boolean upward) {
|
||||
int step = upward ? 1 : -1;
|
||||
int frontY = y + step;
|
||||
int backY = y - step;
|
||||
PlatformBlockState front = frontY >= 0 && frontY < data.getHeight() ? data.get(x, frontY, z) : null;
|
||||
PlatformBlockState back = backY >= 0 && backY < data.getHeight() ? data.get(x, backY, z) : null;
|
||||
NativeBlockState front = frontY >= 0 && frontY < data.getHeight() ? data.get(x, frontY, z) : null;
|
||||
NativeBlockState back = backY >= 0 && backY < data.getHeight() ? data.get(x, backY, z) : null;
|
||||
int thickness = 0;
|
||||
if (sameSpike(state, front, !upward)) {
|
||||
String frontThickness = IrisProceduralBlocks.propertyValue(front, "thickness");
|
||||
|
||||
@@ -6,7 +6,7 @@ import art.arcane.iris.world.history.TerrainBoundarySignature;
|
||||
import art.arcane.iris.generation.hydrology.HydrologyColumnLayer;
|
||||
import art.arcane.iris.generation.hydrology.HydrologyColumnSample;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
@@ -20,7 +20,7 @@ final class IrisSugarCane {
|
||||
private IrisSugarCane() {
|
||||
}
|
||||
|
||||
static boolean isSugarCane(PlatformBlockState state) {
|
||||
static boolean isSugarCane(NativeBlockState state) {
|
||||
if (state == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ final class IrisSugarCane {
|
||||
return key != null && (key.equals("minecraft:sugar_cane") || key.startsWith("minecraft:sugar_cane["));
|
||||
}
|
||||
|
||||
static boolean canPlace(PlatformBlockState block, Hunk<PlatformBlockState> data,
|
||||
static boolean canPlace(NativeBlockState block, Hunk<NativeBlockState> data,
|
||||
int x, int y, int z, int worldX, int worldZ, Engine engine) {
|
||||
if (!isSugarCane(block)) {
|
||||
return true;
|
||||
@@ -37,8 +37,8 @@ final class IrisSugarCane {
|
||||
return false;
|
||||
}
|
||||
int baseY = y - 1;
|
||||
PlatformBlockState support = data.get(x, baseY, z);
|
||||
PlatformBlockState target = data.get(x, y, z);
|
||||
NativeBlockState support = data.get(x, baseY, z);
|
||||
NativeBlockState target = data.get(x, y, z);
|
||||
if (support == null || !block.canPlaceOnto(support) || target != null && !target.isAir()) {
|
||||
return false;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ final class IrisSugarCane {
|
||||
return false;
|
||||
}
|
||||
|
||||
static boolean supportsAdjacent(PlatformBlockState state) {
|
||||
static boolean supportsAdjacent(NativeBlockState state) {
|
||||
if (state == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ final class IrisSugarCane {
|
||||
return false;
|
||||
}
|
||||
IrisBiome biome = complex.getTrueBiomeStream().get(x, z);
|
||||
KList<PlatformBlockState> layers = biome.generateSeaLayers(x, z,
|
||||
KList<NativeBlockState> layers = biome.generateSeaLayers(x, z,
|
||||
new RNG(engine.getSeedManager().getTerrain()), fluidHeight - terrainHeight, engine.getData());
|
||||
int depth = fluidHeight - y;
|
||||
return supportsAdjacent(layers.hasIndex(depth) ? layers.get(depth) : complex.resolveSurfaceFluid(x, z));
|
||||
|
||||
+20
-20
@@ -25,7 +25,7 @@ import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
private final RNG partRNG;
|
||||
@@ -53,13 +53,13 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
Hunk<PlatformBlockState> data, IrisBiome biome, int height, int max) {
|
||||
Hunk<NativeBlockState> data, IrisBiome biome, int height, int max) {
|
||||
decorate(x, z, realX, realX1, realX_1, realZ, realZ1, realZ_1, data, biome, biome.getInferredType(), height, max);
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
public void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1,
|
||||
Hunk<PlatformBlockState> data, IrisBiome biome, InferredType inferredType, int height, int max) {
|
||||
Hunk<NativeBlockState> data, IrisBiome biome, InferredType inferredType, int height, int max) {
|
||||
int fluidHeight = getEngine().getMantle().getFluidHeight(realX, realZ);
|
||||
if (inferredType == InferredType.SHORE && height < fluidHeight) {
|
||||
return;
|
||||
@@ -104,11 +104,11 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
return inferredType == InferredType.CAVE;
|
||||
}
|
||||
|
||||
static boolean hasFluidAbove(Hunk<PlatformBlockState> data, int x, int height, int z) {
|
||||
static boolean hasFluidAbove(Hunk<NativeBlockState> data, int x, int height, int z) {
|
||||
return height + 1 < data.getHeight() && data.get(x, height + 1, z).isFluid();
|
||||
}
|
||||
|
||||
public static boolean isAquaticPlacement(PlatformBlockState state) {
|
||||
public static boolean isAquaticPlacement(NativeBlockState state) {
|
||||
if (state == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
&& !material.contains(":dead_");
|
||||
}
|
||||
|
||||
public static boolean hasConnectedWater(Hunk<PlatformBlockState> data, int x, int y, int z) {
|
||||
public static boolean hasConnectedWater(Hunk<NativeBlockState> data, int x, int y, int z) {
|
||||
if (y < 0 || y >= data.getHeight() || !isWater(data.get(x, y, z))) {
|
||||
return false;
|
||||
}
|
||||
@@ -142,7 +142,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
static AquaticPlacementSnapshot captureAquaticPlacement(
|
||||
IrisDecorator decorator,
|
||||
IrisData irisData,
|
||||
Hunk<PlatformBlockState> data,
|
||||
Hunk<NativeBlockState> data,
|
||||
int x,
|
||||
int z,
|
||||
int height,
|
||||
@@ -161,7 +161,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
return AquaticPlacementSnapshot.EMPTY;
|
||||
}
|
||||
|
||||
PlatformBlockState[] originals = new PlatformBlockState[upperY - lowerY + 1];
|
||||
NativeBlockState[] originals = new NativeBlockState[upperY - lowerY + 1];
|
||||
boolean[] connectedWater = new boolean[originals.length];
|
||||
for (int i = 0; i < originals.length; i++) {
|
||||
int y = lowerY + i;
|
||||
@@ -172,17 +172,17 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
|
||||
private static boolean mayPlaceAquatic(IrisDecorator decorator, IrisData irisData) {
|
||||
PlatformBlockState[] palette = decorator.getBlockDataArray(irisData);
|
||||
NativeBlockState[] palette = decorator.getBlockDataArray(irisData);
|
||||
if (palette != null) {
|
||||
for (PlatformBlockState state : palette) {
|
||||
for (NativeBlockState state : palette) {
|
||||
if (isAquaticPlacement(state)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
PlatformBlockState[] topPalette = decorator.getBlockDataTopsArray(irisData);
|
||||
NativeBlockState[] topPalette = decorator.getBlockDataTopsArray(irisData);
|
||||
if (topPalette != null) {
|
||||
for (PlatformBlockState state : topPalette) {
|
||||
for (NativeBlockState state : topPalette) {
|
||||
if (isAquaticPlacement(state)) {
|
||||
return true;
|
||||
}
|
||||
@@ -199,28 +199,28 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
return Math.max(1, Math.min(Math.max(1, max), decorator.getStackMax()));
|
||||
}
|
||||
|
||||
private static boolean isWaterNeighbor(Hunk<PlatformBlockState> data, int x, int y, int z) {
|
||||
private static boolean isWaterNeighbor(Hunk<NativeBlockState> data, int x, int y, int z) {
|
||||
if (x < 0 || x >= data.getWidth() || z < 0 || z >= data.getDepth()) {
|
||||
return false;
|
||||
}
|
||||
return isWater(data.get(x, y, z));
|
||||
}
|
||||
|
||||
private static boolean isWater(PlatformBlockState state) {
|
||||
private static boolean isWater(NativeBlockState state) {
|
||||
return state != null && state.isWater();
|
||||
}
|
||||
|
||||
static final class AquaticPlacementSnapshot {
|
||||
private static final AquaticPlacementSnapshot EMPTY = new AquaticPlacementSnapshot(
|
||||
0, new PlatformBlockState[0], new boolean[0]);
|
||||
0, new NativeBlockState[0], new boolean[0]);
|
||||
|
||||
private final int lowerY;
|
||||
private final PlatformBlockState[] originals;
|
||||
private final NativeBlockState[] originals;
|
||||
private final boolean[] connectedWater;
|
||||
|
||||
private AquaticPlacementSnapshot(
|
||||
int lowerY,
|
||||
PlatformBlockState[] originals,
|
||||
NativeBlockState[] originals,
|
||||
boolean[] connectedWater
|
||||
) {
|
||||
this.lowerY = lowerY;
|
||||
@@ -228,7 +228,7 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
this.connectedWater = connectedWater;
|
||||
}
|
||||
|
||||
void restoreIfUnsupported(Hunk<PlatformBlockState> data, int x, int z) {
|
||||
void restoreIfUnsupported(Hunk<NativeBlockState> data, int x, int z) {
|
||||
if (!containsUnsupportedAquatic(data, x, z)) {
|
||||
return;
|
||||
}
|
||||
@@ -237,9 +237,9 @@ public class IrisSurfaceDecorator extends IrisEngineDecorator {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean containsUnsupportedAquatic(Hunk<PlatformBlockState> data, int x, int z) {
|
||||
private boolean containsUnsupportedAquatic(Hunk<NativeBlockState> data, int x, int z) {
|
||||
for (int i = 0; i < originals.length; i++) {
|
||||
PlatformBlockState placed = data.get(x, lowerY + i, z);
|
||||
NativeBlockState placed = data.get(x, lowerY + i, z);
|
||||
if (placed != originals[i] && isAquaticPlacement(placed) && !connectedWater[i]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.generation.decoration.tree.TreeFunctions;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -50,7 +50,7 @@ public final class CoralGenerator {
|
||||
case TENDRIL -> buildTendril(canvas, coral, height, shapeSeed, rng);
|
||||
}
|
||||
|
||||
Map<Vector3i, PlatformBlockState> resolved = resolve(canvas, coral, data);
|
||||
Map<Vector3i, NativeBlockState> resolved = resolve(canvas, coral, data);
|
||||
return IrisProceduralBlocks.assemble(resolved);
|
||||
}
|
||||
|
||||
@@ -233,15 +233,15 @@ public final class CoralGenerator {
|
||||
};
|
||||
}
|
||||
|
||||
private static Map<Vector3i, PlatformBlockState> resolve(CoralCanvas canvas, IrisCoral coral, IrisData data) {
|
||||
Map<Vector3i, PlatformBlockState> out = new HashMap<>();
|
||||
private static Map<Vector3i, NativeBlockState> resolve(CoralCanvas canvas, IrisCoral coral, IrisData data) {
|
||||
Map<Vector3i, NativeBlockState> out = new HashMap<>();
|
||||
RNG paletteRng = new RNG(coral.getSeed());
|
||||
for (Map.Entry<Long, CoralCanvas.Role> entry : canvas.getCells().entrySet()) {
|
||||
int[] xyz = CoralCanvas.decode(entry.getKey());
|
||||
int x = xyz[0];
|
||||
int y = xyz[1];
|
||||
int z = xyz[2];
|
||||
PlatformBlockState state;
|
||||
NativeBlockState state;
|
||||
if (entry.getValue() == CoralCanvas.Role.TIP) {
|
||||
state = IrisProceduralBlocks.resolve(coral.getTipBlock(), coral.getTipPalette(), data, x, y, z, paletteRng);
|
||||
if (state == null) {
|
||||
|
||||
@@ -31,7 +31,7 @@ import art.arcane.iris.structure.object.IrisObjectTranslate;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
|
||||
+10
-10
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.decoration.crystal;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -39,7 +39,7 @@ public final class CrystalGenerator {
|
||||
CrystalBaseBuilder.build(canvas, crystal, structureSeed + 977L);
|
||||
CrystalShardBuilder.build(canvas, crystal, rng);
|
||||
|
||||
Map<Vector3i, PlatformBlockState> resolved = new HashMap<>();
|
||||
Map<Vector3i, NativeBlockState> resolved = new HashMap<>();
|
||||
RNG paletteRng = new RNG(crystal.getSeed());
|
||||
RNG tipRng = new RNG(crystal.getSeed() + (variantIndex * 31337L) + 4099L);
|
||||
|
||||
@@ -48,7 +48,7 @@ public final class CrystalGenerator {
|
||||
int x = position.getBlockX();
|
||||
int y = position.getBlockY();
|
||||
int z = position.getBlockZ();
|
||||
PlatformBlockState blockData = resolveRole(crystal, entry.getValue(), data, x, y, z, paletteRng, tipRng);
|
||||
NativeBlockState blockData = resolveRole(crystal, entry.getValue(), data, x, y, z, paletteRng, tipRng);
|
||||
if (blockData == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ public final class CrystalGenerator {
|
||||
return IrisProceduralBlocks.assemble(resolved);
|
||||
}
|
||||
|
||||
private static PlatformBlockState resolveRole(IrisCrystal crystal, CrystalRole role, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
|
||||
private static NativeBlockState resolveRole(IrisCrystal crystal, CrystalRole role, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
|
||||
return switch (role) {
|
||||
case BASE -> resolveBase(crystal, data, x, y, z, paletteRng);
|
||||
case SHARD -> resolveShard(crystal, data, x, y, z, paletteRng);
|
||||
@@ -66,11 +66,11 @@ public final class CrystalGenerator {
|
||||
};
|
||||
}
|
||||
|
||||
private static PlatformBlockState resolveBase(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
|
||||
private static NativeBlockState resolveBase(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
|
||||
boolean hasBase = IrisProceduralBlocks.paletteSet(crystal.getBasePalette())
|
||||
|| (crystal.getBaseBlock() != null && !crystal.getBaseBlock().isEmpty());
|
||||
if (hasBase) {
|
||||
PlatformBlockState base = IrisProceduralBlocks.resolve(crystal.getBaseBlock(), crystal.getBasePalette(), data, x, y, z, paletteRng);
|
||||
NativeBlockState base = IrisProceduralBlocks.resolve(crystal.getBaseBlock(), crystal.getBasePalette(), data, x, y, z, paletteRng);
|
||||
if (base != null) {
|
||||
return base;
|
||||
}
|
||||
@@ -78,17 +78,17 @@ public final class CrystalGenerator {
|
||||
return resolveShard(crystal, data, x, y, z, paletteRng);
|
||||
}
|
||||
|
||||
private static PlatformBlockState resolveShard(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
|
||||
private static NativeBlockState resolveShard(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng) {
|
||||
return IrisProceduralBlocks.resolve(crystal.getBlock(), crystal.getBlockPalette(), data, x, y, z, paletteRng);
|
||||
}
|
||||
|
||||
private static PlatformBlockState resolveTip(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
|
||||
private static NativeBlockState resolveTip(IrisCrystal crystal, IrisData data, int x, int y, int z, RNG paletteRng, RNG tipRng) {
|
||||
boolean hasTip = IrisProceduralBlocks.paletteSet(crystal.getTipPalette())
|
||||
|| (crystal.getTipBlock() != null && !crystal.getTipBlock().isEmpty());
|
||||
|
||||
if (hasTip) {
|
||||
if (tipRng.chance(crystal.getTipChance())) {
|
||||
PlatformBlockState tip = IrisProceduralBlocks.resolve(crystal.getTipBlock(), crystal.getTipPalette(), data, x, y, z, paletteRng);
|
||||
NativeBlockState tip = IrisProceduralBlocks.resolve(crystal.getTipBlock(), crystal.getTipPalette(), data, x, y, z, paletteRng);
|
||||
if (tip != null) {
|
||||
return tip;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ public final class CrystalGenerator {
|
||||
|
||||
if (crystal.isGlow() && crystal.getGlowBlock() != null && !crystal.getGlowBlock().isEmpty()) {
|
||||
if (tipRng.chance(crystal.getTipChance())) {
|
||||
PlatformBlockState glow = IrisProceduralBlocks.resolve(crystal.getGlowBlock(), null, data, x, y, z, paletteRng);
|
||||
NativeBlockState glow = IrisProceduralBlocks.resolve(crystal.getGlowBlock(), null, data, x, y, z, paletteRng);
|
||||
if (glow != null) {
|
||||
return glow;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import art.arcane.iris.structure.object.IrisObjectTranslate;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
|
||||
+4
-4
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.decoration.formation;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
@@ -38,13 +38,13 @@ public final class FormationBlockResolver {
|
||||
paletteRng = new RNG(formation.getSeed());
|
||||
}
|
||||
|
||||
public PlatformBlockState resolve(FormationCanvas.Role role, Vector3i raw) {
|
||||
public NativeBlockState resolve(FormationCanvas.Role role, Vector3i raw) {
|
||||
int x = raw.getBlockX();
|
||||
int y = raw.getBlockY();
|
||||
int z = raw.getBlockZ();
|
||||
|
||||
if (role == FormationCanvas.Role.CAP && capDefined(formation)) {
|
||||
PlatformBlockState cap = IrisProceduralBlocks.resolve(formation.getCapBlock(), formation.getCapPalette(), data, x, y, z, paletteRng);
|
||||
NativeBlockState cap = IrisProceduralBlocks.resolve(formation.getCapBlock(), formation.getCapPalette(), data, x, y, z, paletteRng);
|
||||
if (cap != null) {
|
||||
return cap;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public final class FormationBlockResolver {
|
||||
strataRng = new RNG(formation.getSeed() + band * 31L);
|
||||
strataRngs.put(band, strataRng);
|
||||
}
|
||||
PlatformBlockState strataState = strata.get(strataRng, x, band, z, data);
|
||||
NativeBlockState strataState = strata.get(strataRng, x, band, z, data);
|
||||
if (strataState != null) {
|
||||
return strataState;
|
||||
}
|
||||
|
||||
+3
-3
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.decoration.formation;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -60,10 +60,10 @@ public final class FormationGenerator {
|
||||
return null;
|
||||
}
|
||||
|
||||
Map<Vector3i, PlatformBlockState> resolved = new HashMap<>();
|
||||
Map<Vector3i, NativeBlockState> resolved = new HashMap<>();
|
||||
FormationBlockResolver resolver = new FormationBlockResolver(f, data);
|
||||
for (Map.Entry<Vector3i, FormationCanvas.Role> entry : canvas.getCells().entrySet()) {
|
||||
PlatformBlockState bd = resolver.resolve(entry.getValue(), entry.getKey());
|
||||
NativeBlockState bd = resolver.resolve(entry.getValue(), entry.getKey());
|
||||
if (bd == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import art.arcane.iris.structure.object.IrisObjectTranslate;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
|
||||
+6
-6
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.decoration.fungus;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -47,10 +47,10 @@ public final class FungusGenerator {
|
||||
}
|
||||
|
||||
RNG paletteRng = new RNG(fungus.getSeed());
|
||||
Map<Vector3i, PlatformBlockState> resolved = new HashMap<>();
|
||||
Map<Vector3i, NativeBlockState> resolved = new HashMap<>();
|
||||
for (Map.Entry<Vector3i, FungusCellRole> entry : roles.entrySet()) {
|
||||
Vector3i pos = entry.getKey();
|
||||
PlatformBlockState bd = resolveRole(fungus, entry.getValue(), data, pos, paletteRng);
|
||||
NativeBlockState bd = resolveRole(fungus, entry.getValue(), data, pos, paletteRng);
|
||||
if (bd == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public final class FungusGenerator {
|
||||
return rng.i(lo, hi + 1);
|
||||
}
|
||||
|
||||
private static PlatformBlockState resolveRole(IrisFungus fungus, FungusCellRole role, IrisData data, Vector3i pos, RNG paletteRng) {
|
||||
private static NativeBlockState resolveRole(IrisFungus fungus, FungusCellRole role, IrisData data, Vector3i pos, RNG paletteRng) {
|
||||
int x = pos.getBlockX();
|
||||
int y = pos.getBlockY();
|
||||
int z = pos.getBlockZ();
|
||||
@@ -87,11 +87,11 @@ public final class FungusGenerator {
|
||||
case STEM -> IrisProceduralBlocks.resolve(fungus.getStem(), fungus.getStemPalette(), data, x, y, z, paletteRng);
|
||||
case CAP -> IrisProceduralBlocks.resolve(fungus.getCap(), fungus.getCapPalette(), data, x, y, z, paletteRng);
|
||||
case GILL -> {
|
||||
PlatformBlockState gill = IrisProceduralBlocks.resolve(fungus.getGillBlock(), fungus.getGillPalette(), data, x, y, z, paletteRng);
|
||||
NativeBlockState gill = IrisProceduralBlocks.resolve(fungus.getGillBlock(), fungus.getGillPalette(), data, x, y, z, paletteRng);
|
||||
yield gill != null ? gill : IrisProceduralBlocks.resolve(fungus.getCap(), fungus.getCapPalette(), data, x, y, z, paletteRng);
|
||||
}
|
||||
case SPOT -> {
|
||||
PlatformBlockState spot = IrisProceduralBlocks.resolve(fungus.getSpotBlock(), fungus.getSpotPalette(), data, x, y, z, paletteRng);
|
||||
NativeBlockState spot = IrisProceduralBlocks.resolve(fungus.getSpotBlock(), fungus.getSpotPalette(), data, x, y, z, paletteRng);
|
||||
yield spot != null ? spot : IrisProceduralBlocks.resolve(fungus.getCap(), fungus.getCapPalette(), data, x, y, z, paletteRng);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ import art.arcane.iris.structure.object.IrisObjectTranslate;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
import art.arcane.iris.pack.schema.annotation.MinNumber;
|
||||
|
||||
@@ -31,7 +31,7 @@ import art.arcane.iris.structure.object.IrisObjectTranslate;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package art.arcane.iris.generation.decoration.ruin;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -33,7 +33,7 @@ final class RuinBlockCanvas {
|
||||
static final class Cell {
|
||||
private Role role;
|
||||
private boolean structural;
|
||||
private PlatformBlockState accentData;
|
||||
private NativeBlockState accentData;
|
||||
|
||||
Cell(Role role, boolean structural) {
|
||||
this.role = role;
|
||||
@@ -48,7 +48,7 @@ final class RuinBlockCanvas {
|
||||
return structural;
|
||||
}
|
||||
|
||||
PlatformBlockState accentData() {
|
||||
NativeBlockState accentData() {
|
||||
return accentData;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ final class RuinBlockCanvas {
|
||||
this.structural = this.structural || structuralNext;
|
||||
}
|
||||
|
||||
void makeAccent(PlatformBlockState data) {
|
||||
void makeAccent(NativeBlockState data) {
|
||||
this.role = Role.ACCENT;
|
||||
this.structural = false;
|
||||
this.accentData = data;
|
||||
@@ -80,14 +80,14 @@ final class RuinBlockCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
void accent(int x, int y, int z, PlatformBlockState data) {
|
||||
void accent(int x, int y, int z, NativeBlockState data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
cells.put(new Vector3i(x, y, z), accentCell(data));
|
||||
}
|
||||
|
||||
private static Cell accentCell(PlatformBlockState data) {
|
||||
private static Cell accentCell(NativeBlockState data) {
|
||||
Cell cell = new Cell(Role.ACCENT, false);
|
||||
cell.makeAccent(data);
|
||||
return cell;
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ package art.arcane.iris.generation.decoration.ruin;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -47,7 +47,7 @@ final class RuinDecoratorApplier {
|
||||
if (!rng.chance(decorator.getChance())) {
|
||||
continue;
|
||||
}
|
||||
PlatformBlockState bd = IrisProceduralBlocks.resolve(decorator.getBlock(), decorator.getPalette(), data, v.getBlockX(), v.getBlockY(), v.getBlockZ(), paletteRng);
|
||||
NativeBlockState bd = IrisProceduralBlocks.resolve(decorator.getBlock(), decorator.getPalette(), data, v.getBlockX(), v.getBlockY(), v.getBlockZ(), paletteRng);
|
||||
if (bd != null) {
|
||||
canvas.accent(v.getBlockX(), v.getBlockY(), v.getBlockZ(), bd);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.decoration.ruin;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.decoration.tree.TreeFunctions;
|
||||
import art.arcane.volmlib.util.math.Vector3i;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
@@ -147,11 +147,11 @@ public final class RuinGenerator {
|
||||
}
|
||||
int span = Math.max(1, maxY - minY);
|
||||
|
||||
Map<Vector3i, PlatformBlockState> blocks = new HashMap<>();
|
||||
Map<Vector3i, NativeBlockState> blocks = new HashMap<>();
|
||||
for (Map.Entry<Vector3i, RuinBlockCanvas.Cell> entry : canvas.cells().entrySet()) {
|
||||
Vector3i v = entry.getKey();
|
||||
RuinBlockCanvas.Cell cell = entry.getValue();
|
||||
PlatformBlockState bd;
|
||||
NativeBlockState bd;
|
||||
if (cell.role() == RuinBlockCanvas.Role.ACCENT) {
|
||||
bd = cell.accentData();
|
||||
} else {
|
||||
@@ -165,7 +165,7 @@ public final class RuinGenerator {
|
||||
return IrisProceduralBlocks.assemble(blocks);
|
||||
}
|
||||
|
||||
private static PlatformBlockState structuralBlock(IrisRuin ruin, RuinBlockCanvas.Cell cell, Vector3i v, IrisData data, RNG paletteRng, double scale, double mossiness, long weatherSeed, int minY, int span) {
|
||||
private static NativeBlockState structuralBlock(IrisRuin ruin, RuinBlockCanvas.Cell cell, Vector3i v, IrisData data, RNG paletteRng, double scale, double mossiness, long weatherSeed, int minY, int span) {
|
||||
boolean weathered = false;
|
||||
if (mossiness > 0.0) {
|
||||
int sx = (int) Math.round(v.getBlockX() * scale);
|
||||
@@ -178,7 +178,7 @@ public final class RuinGenerator {
|
||||
}
|
||||
|
||||
if (weathered) {
|
||||
PlatformBlockState wd = IrisProceduralBlocks.resolve(ruin.getWeatheredBlock(), ruin.getWeatheringPalette(), data, v.getBlockX(), v.getBlockY(), v.getBlockZ(), paletteRng);
|
||||
NativeBlockState wd = IrisProceduralBlocks.resolve(ruin.getWeatheredBlock(), ruin.getWeatheringPalette(), data, v.getBlockX(), v.getBlockY(), v.getBlockZ(), paletteRng);
|
||||
if (wd != null) {
|
||||
return wd;
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ import art.arcane.iris.structure.object.IrisObjectTranslate;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
import art.arcane.iris.pack.schema.annotation.MaxNumber;
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ package art.arcane.iris.generation.decoration.tree;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -62,13 +62,13 @@ public final class ProceduralTreeGenerator {
|
||||
TreeSupport.ensureLeavesSupported(canvas, 24);
|
||||
}
|
||||
|
||||
Map<TreeBlockCanvas.Vec, PlatformBlockState> resolved = new HashMap<>();
|
||||
Map<TreeBlockCanvas.Vec, NativeBlockState> resolved = new HashMap<>();
|
||||
Set<TreeBlockCanvas.Vec> trunkPositions = new HashSet<>();
|
||||
Set<TreeBlockCanvas.Vec> leafPositions = new HashSet<>();
|
||||
RNG paletteRng = new RNG(tree.getSeed());
|
||||
for (Map.Entry<TreeBlockCanvas.Vec, TreeBlockCanvas.Cell> entry : canvas.getCells().entrySet()) {
|
||||
TreeBlockCanvas.Cell cell = entry.getValue();
|
||||
PlatformBlockState state = TreeBlockResolver.resolve(tree, data, cell, entry.getKey(), paletteRng);
|
||||
NativeBlockState state = TreeBlockResolver.resolve(tree, data, cell, entry.getKey(), paletteRng);
|
||||
if (state == null) {
|
||||
continue;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public final class ProceduralTreeGenerator {
|
||||
return assemble(resolved);
|
||||
}
|
||||
|
||||
private static IrisObject assemble(Map<TreeBlockCanvas.Vec, PlatformBlockState> resolved) {
|
||||
private static IrisObject assemble(Map<TreeBlockCanvas.Vec, NativeBlockState> resolved) {
|
||||
if (resolved.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public final class ProceduralTreeGenerator {
|
||||
int cz = d / 2;
|
||||
|
||||
IrisObject object = new IrisObject(w, h, d);
|
||||
for (Map.Entry<TreeBlockCanvas.Vec, PlatformBlockState> entry : resolved.entrySet()) {
|
||||
for (Map.Entry<TreeBlockCanvas.Vec, NativeBlockState> entry : resolved.entrySet()) {
|
||||
TreeBlockCanvas.Vec v = entry.getKey();
|
||||
int nx = v.x() - minX - cx;
|
||||
int ny = v.y() - cy + 1;
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
package art.arcane.iris.generation.decoration.tree;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -12,7 +12,7 @@ public record TreeBlockMaterial(String materialKey) {
|
||||
}
|
||||
}
|
||||
|
||||
public static TreeBlockMaterial of(PlatformBlockState state) {
|
||||
public static TreeBlockMaterial of(NativeBlockState state) {
|
||||
return of(Objects.requireNonNull(state, "state").key());
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.decoration.tree;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.terrain.IrisMaterialPalette;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.math.RNG;
|
||||
|
||||
@@ -29,11 +29,11 @@ public final class TreeBlockResolver {
|
||||
private TreeBlockResolver() {
|
||||
}
|
||||
|
||||
public static PlatformBlockState resolve(IrisProceduralTree tree, IrisData data, TreeBlockCanvas.Cell cell, TreeBlockCanvas.Vec pos, RNG paletteRng) {
|
||||
public static NativeBlockState resolve(IrisProceduralTree tree, IrisData data, TreeBlockCanvas.Cell cell, TreeBlockCanvas.Vec pos, RNG paletteRng) {
|
||||
return switch (cell.role()) {
|
||||
case TRUNK -> finishTrunk(resolveBlock(tree.getTrunk(), tree.getTrunkPalette(), data, pos, paletteRng), cell);
|
||||
case SECONDARY_TRUNK -> {
|
||||
PlatformBlockState state = resolveBlock(tree.getSecondaryTrunk(), tree.getSecondaryTrunkPalette(), data, pos, paletteRng);
|
||||
NativeBlockState state = resolveBlock(tree.getSecondaryTrunk(), tree.getSecondaryTrunkPalette(), data, pos, paletteRng);
|
||||
if (state == null) {
|
||||
state = resolveBlock(tree.getTrunk(), tree.getTrunkPalette(), data, pos, paletteRng);
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public final class TreeBlockResolver {
|
||||
}
|
||||
case LEAF -> resolveBlock(tree.getLeaves(), tree.getLeavesPalette(), data, pos, paletteRng);
|
||||
case SECONDARY_LEAF -> {
|
||||
PlatformBlockState state = resolveSecondaryLeaf(tree, data, pos, paletteRng);
|
||||
NativeBlockState state = resolveSecondaryLeaf(tree, data, pos, paletteRng);
|
||||
if (state == null) {
|
||||
state = resolveBlock(tree.getLeaves(), tree.getLeavesPalette(), data, pos, paletteRng);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public final class TreeBlockResolver {
|
||||
yield null;
|
||||
}
|
||||
IrisTreeDecorator dec = tree.getDecorators().get(index);
|
||||
PlatformBlockState state = resolveBlock(dec.getBlock(), dec.getPalette(), data, pos, paletteRng);
|
||||
NativeBlockState state = resolveBlock(dec.getBlock(), dec.getPalette(), data, pos, paletteRng);
|
||||
if (state != null && cell.facing() != null && IrisProceduralBlocks.hasProperty(state, "facing")) {
|
||||
try {
|
||||
state = state.withProperty("facing", cell.facing().toLowerCase());
|
||||
@@ -66,7 +66,7 @@ public final class TreeBlockResolver {
|
||||
};
|
||||
}
|
||||
|
||||
private static PlatformBlockState finishTrunk(PlatformBlockState state, TreeBlockCanvas.Cell cell) {
|
||||
private static NativeBlockState finishTrunk(NativeBlockState state, TreeBlockCanvas.Cell cell) {
|
||||
if (state == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public final class TreeBlockResolver {
|
||||
return state;
|
||||
}
|
||||
|
||||
private static PlatformBlockState resolveSecondaryLeaf(IrisProceduralTree tree, IrisData data, TreeBlockCanvas.Vec pos, RNG paletteRng) {
|
||||
private static NativeBlockState resolveSecondaryLeaf(IrisProceduralTree tree, IrisData data, TreeBlockCanvas.Vec pos, RNG paletteRng) {
|
||||
if (IrisProceduralBlocks.paletteSet(tree.getSecondaryLeavesPalette())) {
|
||||
return tree.getSecondaryLeavesPalette().get(paletteRng, pos.x(), pos.y(), pos.z(), data);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ public final class TreeBlockResolver {
|
||||
return tree.getWeightedSecondaryLeaves().get(tree.getWeightedSecondaryLeaves().size() - 1).getBlock();
|
||||
}
|
||||
|
||||
private static PlatformBlockState resolveBlock(String block, IrisMaterialPalette palette, IrisData data, TreeBlockCanvas.Vec pos, RNG paletteRng) {
|
||||
private static NativeBlockState resolveBlock(String block, IrisMaterialPalette palette, IrisData data, TreeBlockCanvas.Vec pos, RNG paletteRng) {
|
||||
if (IrisProceduralBlocks.paletteSet(palette)) {
|
||||
return palette.get(paletteRng, pos.x(), pos.y(), pos.z(), data);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public final class TreeBlockResolver {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static PlatformBlockState woodCap(PlatformBlockState state) {
|
||||
private static NativeBlockState woodCap(NativeBlockState state) {
|
||||
String key = state.key();
|
||||
int bracket = key.indexOf('[');
|
||||
String base = bracket < 0 ? key : key.substring(0, bracket);
|
||||
@@ -138,7 +138,7 @@ public final class TreeBlockResolver {
|
||||
if (woodKey == null) {
|
||||
return state;
|
||||
}
|
||||
PlatformBlockState wood = B.getStateOrNull(woodKey, false);
|
||||
NativeBlockState wood = B.getStateOrNull(woodKey, false);
|
||||
if (wood == null) {
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.decoration.tree;
|
||||
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashMap;
|
||||
@@ -36,11 +36,11 @@ public final class TreePlausibility {
|
||||
private TreePlausibility() {
|
||||
}
|
||||
|
||||
public static void apply(Map<TreeBlockCanvas.Vec, PlatformBlockState> resolved, Set<TreeBlockCanvas.Vec> trunkPositions,
|
||||
public static void apply(Map<TreeBlockCanvas.Vec, NativeBlockState> resolved, Set<TreeBlockCanvas.Vec> trunkPositions,
|
||||
Set<TreeBlockCanvas.Vec> leafPositions, IrisProceduralTree tree) {
|
||||
Set<TreeBlockCanvas.Vec> realLeaves = new HashSet<>();
|
||||
for (TreeBlockCanvas.Vec v : leafPositions) {
|
||||
PlatformBlockState state = resolved.get(v);
|
||||
NativeBlockState state = resolved.get(v);
|
||||
if (state != null && IrisProceduralBlocks.hasProperty(state, "persistent") && IrisProceduralBlocks.hasProperty(state, "distance")) {
|
||||
realLeaves.add(v);
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public final class TreePlausibility {
|
||||
: Map.of();
|
||||
|
||||
for (TreeBlockCanvas.Vec v : realLeaves) {
|
||||
PlatformBlockState leaf = resolved.get(v);
|
||||
NativeBlockState leaf = resolved.get(v);
|
||||
Integer d = distance.get(v);
|
||||
if (!tree.isPlausible()) {
|
||||
leaf = leaf.withProperty("persistent", "true").withProperty("distance", "1");
|
||||
|
||||
@@ -6,7 +6,7 @@ import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.generation.terrain.InferredType;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -116,7 +116,7 @@ public final class IrisImageMapRuntime {
|
||||
return target == null ? null : binding.biomes.get(target);
|
||||
}
|
||||
|
||||
public PlatformBlockState sampleSurfaceBlock(double worldX, double worldZ) {
|
||||
public NativeBlockState sampleSurfaceBlock(double worldX, double worldZ) {
|
||||
RuntimeBinding binding = applications.get(IrisImageMapApplication.SURFACE_BLOCK);
|
||||
if (binding == null || !selectCategorical(binding.maskWeight(worldX, worldZ))) {
|
||||
return null;
|
||||
@@ -172,7 +172,7 @@ public final class IrisImageMapRuntime {
|
||||
}
|
||||
Map<String, IrisRegion> regions = new LinkedHashMap<>();
|
||||
Map<String, IrisBiome> biomes = new LinkedHashMap<>();
|
||||
Map<String, PlatformBlockState> blocks = new LinkedHashMap<>();
|
||||
Map<String, NativeBlockState> blocks = new LinkedHashMap<>();
|
||||
Set<String> targets = legendTargets(definition);
|
||||
|
||||
if (application == IrisImageMapApplication.REGION) {
|
||||
@@ -197,7 +197,7 @@ public final class IrisImageMapRuntime {
|
||||
}
|
||||
} else if (application == IrisImageMapApplication.SURFACE_BLOCK) {
|
||||
for (String target : targets) {
|
||||
PlatformBlockState block = B.getStateOrNull(target, false);
|
||||
NativeBlockState block = B.getStateOrNull(target, false);
|
||||
if (block == null) {
|
||||
throw validation("Image-map '" + key + "' references unknown surface block target '" + target + "'");
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public final class IrisImageMapRuntime {
|
||||
private final CompiledIrisImageMap compiled;
|
||||
private final Map<String, IrisRegion> regions;
|
||||
private final Map<String, IrisBiome> biomes;
|
||||
private final Map<String, PlatformBlockState> blocks;
|
||||
private final Map<String, NativeBlockState> blocks;
|
||||
private final List<IrisImageMapMask> maskDefinitions;
|
||||
private IrisImageMapMaskSampler masks = IrisImageMapMaskSampler.empty();
|
||||
|
||||
@@ -361,7 +361,7 @@ public final class IrisImageMapRuntime {
|
||||
CompiledIrisImageMap compiled,
|
||||
Map<String, IrisRegion> regions,
|
||||
Map<String, IrisBiome> biomes,
|
||||
Map<String, PlatformBlockState> blocks,
|
||||
Map<String, NativeBlockState> blocks,
|
||||
List<IrisImageMapMask> maskDefinitions
|
||||
) {
|
||||
this.key = key;
|
||||
|
||||
+8
-8
@@ -25,7 +25,7 @@ import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.structure.object.IObjectPlacer;
|
||||
import art.arcane.iris.generation.block.TileData;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
|
||||
@@ -43,7 +43,7 @@ final class CaveObjectPlacementTransaction implements IObjectPlacer {
|
||||
private final int minDepthBelowSurface;
|
||||
private final int worldHeight;
|
||||
private final KList<BufferedMutation> mutations;
|
||||
private final Map<PositionKey, PlatformBlockState> bufferedBlocks;
|
||||
private final Map<PositionKey, NativeBlockState> bufferedBlocks;
|
||||
private final Long2IntOpenHashMap surfaceHeights;
|
||||
private final Long2IntOpenHashMap caveCeilings;
|
||||
private int blockWrites;
|
||||
@@ -127,7 +127,7 @@ final class CaveObjectPlacementTransaction implements IObjectPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, PlatformBlockState state) {
|
||||
public void set(int x, int y, int z, NativeBlockState state) {
|
||||
if (state == null) {
|
||||
return;
|
||||
}
|
||||
@@ -137,8 +137,8 @@ final class CaveObjectPlacementTransaction implements IObjectPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState get(int x, int y, int z) {
|
||||
PlatformBlockState buffered = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
public NativeBlockState get(int x, int y, int z) {
|
||||
NativeBlockState buffered = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
return buffered == null ? delegate.get(x, y, z) : buffered;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ final class CaveObjectPlacementTransaction implements IObjectPlacer {
|
||||
|
||||
@Override
|
||||
public boolean isSolid(int x, int y, int z) {
|
||||
PlatformBlockState buffered = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
NativeBlockState buffered = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
return buffered == null ? delegate.isSolid(x, y, z) : B.isSolid(buffered);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ final class CaveObjectPlacementTransaction implements IObjectPlacer {
|
||||
return;
|
||||
}
|
||||
mutations.add(new DataMutation(x, y, z, data));
|
||||
if (data instanceof PlatformBlockState state) {
|
||||
if (data instanceof NativeBlockState state) {
|
||||
bufferedBlocks.put(new PositionKey(x, y, z), state);
|
||||
blockWrites++;
|
||||
}
|
||||
@@ -276,7 +276,7 @@ final class CaveObjectPlacementTransaction implements IObjectPlacer {
|
||||
void apply(IObjectPlacer placer);
|
||||
}
|
||||
|
||||
private record BlockMutation(int x, int y, int z, PlatformBlockState value) implements BufferedMutation {
|
||||
private record BlockMutation(int x, int y, int z, NativeBlockState value) implements BufferedMutation {
|
||||
@Override
|
||||
public void apply(IObjectPlacer placer) {
|
||||
placer.set(x, y, z, value);
|
||||
|
||||
@@ -49,7 +49,7 @@ import art.arcane.volmlib.util.matter.MatterMarker;
|
||||
import art.arcane.volmlib.util.matter.Matter;
|
||||
import art.arcane.volmlib.util.matter.slices.UpdateMatter;
|
||||
import art.arcane.iris.generation.concurrent.MultiBurst;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import org.jetbrains.annotations.UnmodifiableView;
|
||||
|
||||
import java.util.List;
|
||||
@@ -128,7 +128,7 @@ public interface EngineMantle extends MatterGenerator {
|
||||
if (resolved.isPresent()) {
|
||||
PreObjectMatterCell cell = getMantle().get(x, h, z, PreObjectMatterCell.class);
|
||||
if (cell != null && cell.blockCaptured()) {
|
||||
PlatformBlockState block = getMantle().get(x, h, z, PlatformBlockState.class);
|
||||
NativeBlockState block = getMantle().get(x, h, z, NativeBlockState.class);
|
||||
if (block != null) {
|
||||
return (block.isAir() || block.isFluid())
|
||||
&& resolved.get().geometry().hasSolidAbove(h + getEngine().getMinHeight());
|
||||
@@ -147,14 +147,14 @@ public interface EngineMantle extends MatterGenerator {
|
||||
|| getComplex().isTerrain3DOpening(x, h, z);
|
||||
}
|
||||
|
||||
default PlatformBlockState get(int x, int y, int z) {
|
||||
PlatformBlockState block = getMantle().get(x, y, z, PlatformBlockState.class);
|
||||
default NativeBlockState get(int x, int y, int z) {
|
||||
NativeBlockState block = getMantle().get(x, y, z, NativeBlockState.class);
|
||||
Optional<TerrainBoundarySignature> resolved = getComplex().resolvedTerrainColumn(x, z);
|
||||
if (resolved.isPresent()) {
|
||||
PreObjectMatterCell cell = getMantle().get(x, y, z, PreObjectMatterCell.class);
|
||||
if (cell == null || !cell.blockCaptured()) {
|
||||
String stateKey = resolved.get().geometry().voxelAt(y + getEngine().getMinHeight()).stateKey();
|
||||
PlatformBlockState natural = IrisPlatforms.get().registries().blockOrNull(stateKey);
|
||||
NativeBlockState natural = IrisPlatforms.get().registries().blockOrNull(stateKey);
|
||||
if (natural == null) {
|
||||
throw new IllegalStateException("Saved terrain state is unavailable: " + stateKey);
|
||||
}
|
||||
@@ -239,7 +239,7 @@ public interface EngineMantle extends MatterGenerator {
|
||||
default void insertMatter(
|
||||
int x,
|
||||
int z,
|
||||
Hunk<PlatformBlockState> blocks,
|
||||
Hunk<NativeBlockState> blocks,
|
||||
boolean multicore,
|
||||
ChunkContext context
|
||||
) {
|
||||
@@ -260,7 +260,7 @@ public interface EngineMantle extends MatterGenerator {
|
||||
int localZ = i & 15;
|
||||
layouts[i] = context.getDimensionStackLayout(localX, localZ);
|
||||
}
|
||||
chunk.iterate(PlatformBlockState.class, (localX, y, localZ, value) -> {
|
||||
chunk.iterate(NativeBlockState.class, (localX, y, localZ, value) -> {
|
||||
DimensionStackLayout layout = layouts[(localX << 4) | (localZ & 15)];
|
||||
if (!layout.isHostFeatureProtectedY(y)) {
|
||||
blocks.set(localX, y, localZ, value);
|
||||
@@ -277,14 +277,14 @@ public interface EngineMantle extends MatterGenerator {
|
||||
int worldZ = chunkBlockZ + lz;
|
||||
upperYs[i] = upperCtx.getEffectiveSurfaceY(worldX, worldZ);
|
||||
}
|
||||
chunk.iterate(PlatformBlockState.class, (lx, y, lz, value) -> {
|
||||
chunk.iterate(NativeBlockState.class, (lx, y, lz, value) -> {
|
||||
int colIdx = (lx << 4) | (lz & 15);
|
||||
if (y < upperYs[colIdx]) {
|
||||
blocks.set(lx, y, lz, value);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
chunk.iterate(PlatformBlockState.class, (lx, y, lz, value) -> blocks.set(lx, y, lz, value));
|
||||
chunk.iterate(NativeBlockState.class, (lx, y, lz, value) -> blocks.set(lx, y, lz, value));
|
||||
}
|
||||
} finally {
|
||||
chunk.release();
|
||||
@@ -371,7 +371,7 @@ public interface EngineMantle extends MatterGenerator {
|
||||
}
|
||||
|
||||
private void cleanupSlices(MantleChunk<Matter> chunk, boolean force) {
|
||||
MantleSliceRetention.deleteUnlessRetained(chunk, PlatformBlockState.class);
|
||||
MantleSliceRetention.deleteUnlessRetained(chunk, NativeBlockState.class);
|
||||
if (force) {
|
||||
MantleSliceRetention.deleteUnlessRetained(chunk, String.class);
|
||||
}
|
||||
|
||||
+8
-8
@@ -23,7 +23,7 @@ import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.runtime.IrisComplex;
|
||||
import art.arcane.iris.structure.object.IObjectPlacer;
|
||||
import art.arcane.iris.generation.block.TileData;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -34,7 +34,7 @@ import java.util.Map;
|
||||
final class FloatingObjectPlacementTransaction implements IObjectPlacer {
|
||||
private final IslandObjectPlacer delegate;
|
||||
private final KList<BufferedMutation> mutations;
|
||||
private final Map<PositionKey, PlatformBlockState> bufferedBlocks;
|
||||
private final Map<PositionKey, NativeBlockState> bufferedBlocks;
|
||||
private int blockWrites;
|
||||
|
||||
FloatingObjectPlacementTransaction(IslandObjectPlacer delegate) {
|
||||
@@ -85,7 +85,7 @@ final class FloatingObjectPlacementTransaction implements IObjectPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, PlatformBlockState state) {
|
||||
public void set(int x, int y, int z, NativeBlockState state) {
|
||||
if (state == null) {
|
||||
return;
|
||||
}
|
||||
@@ -95,8 +95,8 @@ final class FloatingObjectPlacementTransaction implements IObjectPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState get(int x, int y, int z) {
|
||||
PlatformBlockState state = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
public NativeBlockState get(int x, int y, int z) {
|
||||
NativeBlockState state = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
return state == null ? delegate.get(x, y, z) : state;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ final class FloatingObjectPlacementTransaction implements IObjectPlacer {
|
||||
|
||||
@Override
|
||||
public boolean isSolid(int x, int y, int z) {
|
||||
PlatformBlockState state = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
NativeBlockState state = bufferedBlocks.get(new PositionKey(x, y, z));
|
||||
return state == null ? delegate.isSolid(x, y, z) : B.isSolid(state);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ final class FloatingObjectPlacementTransaction implements IObjectPlacer {
|
||||
return;
|
||||
}
|
||||
mutations.add(new DataMutation(x, y, z, data));
|
||||
if (data instanceof PlatformBlockState state) {
|
||||
if (data instanceof NativeBlockState state) {
|
||||
bufferedBlocks.put(new PositionKey(x, y, z), state);
|
||||
blockWrites++;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ final class FloatingObjectPlacementTransaction implements IObjectPlacer {
|
||||
void apply(IObjectPlacer placer);
|
||||
}
|
||||
|
||||
private record BlockMutation(int x, int y, int z, PlatformBlockState value) implements BufferedMutation {
|
||||
private record BlockMutation(int x, int y, int z, NativeBlockState value) implements BufferedMutation {
|
||||
@Override
|
||||
public void apply(IObjectPlacer placer) {
|
||||
placer.set(x, y, z, value);
|
||||
|
||||
@@ -23,7 +23,7 @@ import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.structure.object.IObjectPlacer;
|
||||
import art.arcane.iris.generation.block.TileData;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
final class GoldenDebugObjectPlacer implements IObjectPlacer {
|
||||
private static final int[] GOLDEN_DEBUG_TARGET = parseGoldenDebugTarget(resolveGoldenDebugSpec());
|
||||
@@ -89,12 +89,12 @@ final class GoldenDebugObjectPlacer implements IObjectPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, PlatformBlockState d) {
|
||||
public void set(int x, int y, int z, NativeBlockState d) {
|
||||
delegate.set(x, y, z, d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState get(int x, int y, int z) {
|
||||
public NativeBlockState get(int x, int y, int z) {
|
||||
return delegate.get(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
|
||||
package art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.volmlib.util.structure.StructureCarvingFootprint;
|
||||
|
||||
import art.arcane.volmlib.util.structure.StructureCarveEnvelope;
|
||||
|
||||
import art.arcane.iris.configuration.IrisSettings;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.Cache;
|
||||
@@ -35,13 +39,13 @@ import art.arcane.iris.structure.object.IrisObjectPlacement;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.structure.placement.IrisStructure;
|
||||
import art.arcane.iris.structure.placement.IrisStructureCarveShape;
|
||||
import art.arcane.volmlib.util.structure.StructureCarveShape;
|
||||
import art.arcane.iris.structure.placement.IrisStructurePlacement;
|
||||
import art.arcane.iris.structure.placement.IrisStructureStiltSettings;
|
||||
import art.arcane.iris.structure.placement.IrisStructureTerrain;
|
||||
import art.arcane.iris.structure.placement.IrisStructureTerrainMode;
|
||||
import art.arcane.volmlib.util.structure.StructureTerrainMode;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.iris.world.storage.matter.TileWrapper;
|
||||
@@ -114,8 +118,8 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
}
|
||||
IrisStructureTerrain terrain = placement.resolvedTerrain();
|
||||
int[] bounds = computePieceBounds(pieces);
|
||||
int horizontalPadding = terrain.resolvedMode() == IrisStructureTerrainMode.FORCE_CARVE
|
||||
|| terrain.resolvedMode() == IrisStructureTerrainMode.BORE
|
||||
int horizontalPadding = terrain.resolvedMode() == StructureTerrainMode.FORCE_CARVE
|
||||
|| terrain.resolvedMode() == StructureTerrainMode.BORE
|
||||
? Math.max(0, terrain.getHorizontalPadding())
|
||||
: 0;
|
||||
if (bounds == null || !complex.allowsNewGenerationFootprint(
|
||||
@@ -135,13 +139,13 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
clearIntersectingObjectTrees(writer, resolved);
|
||||
}
|
||||
|
||||
IrisStructureTerrainMode terrainMode = terrain.resolvedMode();
|
||||
if (terrainMode == IrisStructureTerrainMode.FORCE_CARVE) {
|
||||
StructureTerrainMode terrainMode = terrain.resolvedMode();
|
||||
if (terrainMode == StructureTerrainMode.FORCE_CARVE) {
|
||||
forceCarveStructure(writer, pieces, terrain);
|
||||
} else if (terrainMode == IrisStructureTerrainMode.BORE) {
|
||||
} else if (terrainMode == StructureTerrainMode.BORE) {
|
||||
boreStructure(writer, pieces, terrain);
|
||||
} else if (terrainMode != IrisStructureTerrainMode.PRESERVE
|
||||
&& terrainMode != IrisStructureTerrainMode.SOURCE) {
|
||||
} else if (terrainMode != StructureTerrainMode.PRESERVE
|
||||
&& terrainMode != StructureTerrainMode.SOURCE) {
|
||||
throw new IllegalStateException("Iris assembly terrain mode " + terrainMode
|
||||
+ " is not implemented for structure '" + key + "'");
|
||||
}
|
||||
@@ -198,8 +202,8 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
int worldX = StructureFoundationPlanner.unpackX(column.getLongKey());
|
||||
int worldZ = StructureFoundationPlanner.unpackZ(column.getLongKey());
|
||||
int foundationY = column.getIntValue();
|
||||
PlatformBlockState foundationState = writer.getDataIfPresent(
|
||||
worldX, foundationY, worldZ, PlatformBlockState.class);
|
||||
NativeBlockState foundationState = writer.getDataIfPresent(
|
||||
worldX, foundationY, worldZ, NativeBlockState.class);
|
||||
if (foundationState == null || !foundationState.isSolid()) {
|
||||
continue;
|
||||
}
|
||||
@@ -207,8 +211,8 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
int groundY = StructureFoundationPlanner.findGroundY(
|
||||
foundationY, maxDepth, 0,
|
||||
y -> {
|
||||
PlatformBlockState overlay = writer.getDataIfPresent(
|
||||
worldX, y, worldZ, PlatformBlockState.class);
|
||||
NativeBlockState overlay = writer.getDataIfPresent(
|
||||
worldX, y, worldZ, NativeBlockState.class);
|
||||
boolean carved = writer.getDataIfPresent(
|
||||
worldX, y, worldZ, MatterCavern.class) != null;
|
||||
return surfaceStructure
|
||||
@@ -231,7 +235,7 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
IrisData data, int worldX, int mantleY, int worldZ,
|
||||
int mantleOffset) {
|
||||
int worldY = mantleY + mantleOffset;
|
||||
PlatformBlockState support = palette.get(rng, worldX, worldY, worldZ, data);
|
||||
NativeBlockState support = palette.get(rng, worldX, worldY, worldZ, data);
|
||||
if (support == null) {
|
||||
throw new IllegalStateException("Structure stilt palette resolved no block at "
|
||||
+ worldX + "," + worldY + "," + worldZ);
|
||||
@@ -301,7 +305,7 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
if (bounds == null) {
|
||||
return;
|
||||
}
|
||||
IrisStructureCarveShape shape = terrain.resolvedShape();
|
||||
StructureCarveShape shape = terrain.resolvedShape();
|
||||
int margin = Math.max(0, terrain.getHorizontalPadding());
|
||||
int head = Math.max(0, terrain.getCeilingPadding());
|
||||
int floorCut = Math.max(0, terrain.getFloorPadding());
|
||||
@@ -311,20 +315,20 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
int worldMax = getEngineMantle().getEngine().getMinHeight() + getEngineMantle().getEngine().getHeight() - 1;
|
||||
int upExtension = shape.maximumCeilingExtension(head, strength);
|
||||
|
||||
if (shape == IrisStructureCarveShape.BOX) {
|
||||
if (shape == StructureCarveShape.BOX) {
|
||||
carveOverboreBox(writer, bounds, margin, head, floorCut, mantleOffset, worldMin, worldMax);
|
||||
return;
|
||||
}
|
||||
|
||||
long work = overboreCandidateVolume(bounds, margin, upExtension, floorCut);
|
||||
StructureCarvingFootprint footprint = StructureCarvingFootprint.from(
|
||||
StructureCarvingFootprint footprint = StructurePieceColumns.from(
|
||||
pieces, margin, Integer.MAX_VALUE);
|
||||
if (footprint == null) {
|
||||
throw new IllegalStateException("Structure force-carve footprint is empty or exceeds addressable memory");
|
||||
}
|
||||
|
||||
double frequency = terrain.resolvedErosionFrequency();
|
||||
boolean eroded = shape == IrisStructureCarveShape.ERODED && strength > 0D;
|
||||
boolean eroded = shape == StructureCarveShape.ERODED && strength > 0D;
|
||||
CNG blob = null;
|
||||
CNG roll = null;
|
||||
if (eroded) {
|
||||
@@ -428,7 +432,7 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
Map<String, ObjectMarkerBounds> intersectingObjects = new HashMap<>();
|
||||
for (PlacedStructurePiece piece : resolved.pieces()) {
|
||||
for (IrisBlockVector local : piece.getObject().getBlocks().keys()) {
|
||||
PlatformBlockState structureState = piece.getObject().getBlocks().get(local);
|
||||
NativeBlockState structureState = piece.getObject().getBlocks().get(local);
|
||||
if (!isOccupiedStructureState(structureState)) {
|
||||
continue;
|
||||
}
|
||||
@@ -446,13 +450,13 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isOccupiedStructureState(PlatformBlockState state) {
|
||||
static boolean isOccupiedStructureState(NativeBlockState state) {
|
||||
return !B.isAir(state);
|
||||
}
|
||||
|
||||
private void collectIntersectingObjectTreeMarker(MantleWriter writer, int x, int y, int z,
|
||||
Map<String, ObjectMarkerBounds> intersectingObjects) {
|
||||
PlatformBlockState state = writer.getDataIfPresent(x, y, z, PlatformBlockState.class);
|
||||
NativeBlockState state = writer.getDataIfPresent(x, y, z, NativeBlockState.class);
|
||||
if (state == null || !state.isTreeBlock()) {
|
||||
return;
|
||||
}
|
||||
@@ -585,7 +589,7 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
}, null, getData());
|
||||
}
|
||||
|
||||
static boolean shouldWriteStructureMarker(PlatformBlockState state) {
|
||||
static boolean shouldWriteStructureMarker(NativeBlockState state) {
|
||||
return state != null && state.isStorageChest();
|
||||
}
|
||||
|
||||
@@ -631,8 +635,8 @@ public class IrisStructureComponent extends IrisMantleComponent {
|
||||
continue;
|
||||
}
|
||||
IrisStructureTerrain terrain = placement.resolvedTerrain();
|
||||
int carvePadding = terrain.resolvedMode() == IrisStructureTerrainMode.FORCE_CARVE
|
||||
|| terrain.resolvedMode() == IrisStructureTerrainMode.BORE
|
||||
int carvePadding = terrain.resolvedMode() == StructureTerrainMode.FORCE_CARVE
|
||||
|| terrain.resolvedMode() == StructureTerrainMode.BORE
|
||||
? Math.max(0, terrain.getHorizontalPadding()) : 0;
|
||||
for (String key : placement.getStructures()) {
|
||||
IrisStructure structure = getData().load(IrisStructure.class, key, false);
|
||||
|
||||
@@ -24,7 +24,7 @@ import art.arcane.iris.generation.biome.FloatingIslandSample;
|
||||
import art.arcane.iris.structure.object.IObjectPlacer;
|
||||
import art.arcane.iris.generation.biome.IrisFloatingChildBiomes;
|
||||
import art.arcane.iris.generation.block.TileData;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class IslandObjectPlacer implements IObjectPlacer {
|
||||
@@ -110,14 +110,14 @@ public final class IslandObjectPlacer implements IObjectPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, PlatformBlockState state) {
|
||||
public void set(int x, int y, int z, NativeBlockState state) {
|
||||
if (!shouldSkipAirColumn(x, y, z)) {
|
||||
wrapped.set(x, y, z, state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState get(int x, int y, int z) {
|
||||
public NativeBlockState get(int x, int y, int z) {
|
||||
return wrapped.get(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import art.arcane.iris.generation.terrain.IrisDimensionCarvingEntry;
|
||||
import art.arcane.iris.generation.terrain.IrisDimensionCarvingResolver;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.pack.value.IrisRange;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
import art.arcane.volmlib.util.stream.ProceduralStream;
|
||||
|
||||
+3
-3
@@ -33,7 +33,7 @@ import art.arcane.iris.structure.object.IrisObjectTranslate;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.structure.object.ObjectPlaceMode;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
@@ -484,11 +484,11 @@ public class MantleFloatingObjectComponent extends IrisMantleComponent {
|
||||
return rotation.rotate(new IrisBlockVector(fp.getTallestKx(), fp.getLowestSolidKeyY(), fp.getTallestKz()), 0, 0, 0);
|
||||
}
|
||||
|
||||
private static boolean shouldWritePlacementMarker(IObjectPlacer placer, PlatformBlockState state, int x, int y, int z) {
|
||||
private static boolean shouldWritePlacementMarker(IObjectPlacer placer, NativeBlockState state, int x, int y, int z) {
|
||||
if (state == null) {
|
||||
return false;
|
||||
}
|
||||
PlatformBlockState existingState = placer.get(x, y, z);
|
||||
NativeBlockState existingState = placer.get(x, y, z);
|
||||
boolean wouldReplace = B.isSolid(existingState) && B.isVineBlock(state);
|
||||
String material = IrisProceduralBlocks.materialKey(state);
|
||||
boolean placesBlock = !material.equals("minecraft:air") && !material.equals("minecraft:cave_air") && !wouldReplace;
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ import art.arcane.iris.generation.hydrology.cave.CavePosition;
|
||||
import art.arcane.iris.generation.hydrology.cave.CaveVoxel;
|
||||
import art.arcane.iris.generation.hydrology.cave.CaveVoxelView;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
import art.arcane.volmlib.util.mantle.flag.ReservedFlag;
|
||||
import art.arcane.volmlib.util.mantle.runtime.Mantle;
|
||||
@@ -130,7 +130,7 @@ public final class MantleHydrologyCaveVoxelView implements CaveVoxelView {
|
||||
}
|
||||
return CaveVoxel.CAVE_AIR;
|
||||
}
|
||||
PlatformBlockState block = dataIfPresent(position, PlatformBlockState.class);
|
||||
NativeBlockState block = dataIfPresent(position, NativeBlockState.class);
|
||||
if (block != null) {
|
||||
if (!block.isFluid()) {
|
||||
return CaveVoxel.SOLID;
|
||||
|
||||
@@ -17,7 +17,7 @@ import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.generation.hydrology.IrisHydrology;
|
||||
import art.arcane.iris.generation.decoration.IrisProceduralBlocks;
|
||||
import art.arcane.iris.generation.hydrology.IrisRiverHydrology;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
import art.arcane.volmlib.util.mantle.flag.MantleFlag;
|
||||
import art.arcane.volmlib.util.mantle.flag.ReservedFlag;
|
||||
@@ -731,16 +731,16 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
ChunkContext context,
|
||||
Publication publication
|
||||
) {
|
||||
LinkedHashMap<CavePosition, PlatformBlockState> resolvedSurfaceWrites = new LinkedHashMap<>();
|
||||
LinkedHashMap<CavePosition, NativeBlockState> resolvedSurfaceWrites = new LinkedHashMap<>();
|
||||
for (Map.Entry<CavePosition, SurfaceFluidWrite> entry : sortedEntries(publication.surfaceWrites())) {
|
||||
CavePosition position = entry.getKey();
|
||||
SurfaceFluidWrite write = entry.getValue();
|
||||
PlatformBlockState fluid = Objects.requireNonNull(context.getComplex().resolveHydrologyFluid(
|
||||
NativeBlockState fluid = Objects.requireNonNull(context.getComplex().resolveHydrologyFluid(
|
||||
write.profileKey(),
|
||||
position.x(),
|
||||
position.z()
|
||||
));
|
||||
PlatformBlockState state = write.action() == HydrologyCaveAction.FALLING_FLUID
|
||||
NativeBlockState state = write.action() == HydrologyCaveAction.FALLING_FLUID
|
||||
? fallingFluidState(fluid)
|
||||
: fluid;
|
||||
resolvedSurfaceWrites.put(position, state);
|
||||
@@ -762,7 +762,7 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
));
|
||||
}
|
||||
}
|
||||
for (Map.Entry<CavePosition, PlatformBlockState> entry : resolvedSurfaceWrites.entrySet()) {
|
||||
for (Map.Entry<CavePosition, NativeBlockState> entry : resolvedSurfaceWrites.entrySet()) {
|
||||
CavePosition position = entry.getKey();
|
||||
writer.setData(position.x(), position.y(), position.z(), entry.getValue());
|
||||
}
|
||||
@@ -825,7 +825,7 @@ public final class MantleHydrologyComponent extends IrisMantleComponent {
|
||||
};
|
||||
}
|
||||
|
||||
private static PlatformBlockState fallingFluidState(PlatformBlockState fluid) {
|
||||
private static NativeBlockState fallingFluidState(NativeBlockState fluid) {
|
||||
if (!IrisProceduralBlocks.hasProperty(fluid, "level")
|
||||
|| "8".equals(IrisProceduralBlocks.propertyValue(fluid, "level"))) {
|
||||
return fluid;
|
||||
|
||||
@@ -63,7 +63,7 @@ import art.arcane.volmlib.util.noise.CNG;
|
||||
import art.arcane.volmlib.util.noise.NoiseType;
|
||||
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.DataProvider;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
|
||||
@@ -115,7 +115,7 @@ public class MantleObjectComponent extends IrisMantleComponent {
|
||||
|| (placement != null && placement.getTrees() != null && placement.getTrees().isNotEmpty());
|
||||
}
|
||||
|
||||
private static void writeTreeMaterial(IObjectPlacer placer, int x, int y, int z, PlatformBlockState data) {
|
||||
private static void writeTreeMaterial(IObjectPlacer placer, int x, int y, int z, NativeBlockState data) {
|
||||
placer.setData(x, y, z, TreeBlockMaterial.of(data));
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.mantle.runtime.MantleChunk;
|
||||
import art.arcane.volmlib.util.matter.Matter;
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class MantleSliceRetention {
|
||||
}
|
||||
|
||||
public static void retain(String className) {
|
||||
if (className == null || PlatformBlockState.class.getCanonicalName().equals(className)) {
|
||||
if (className == null || NativeBlockState.class.getCanonicalName().equals(className)) {
|
||||
return;
|
||||
}
|
||||
if (retained.add(className)) {
|
||||
|
||||
@@ -56,7 +56,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@@ -304,7 +304,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
return;
|
||||
}
|
||||
|
||||
if (y == 0 && t instanceof PlatformBlockState && engineMantle.getEngine().getDimension().isBedrock()) {
|
||||
if (y == 0 && t instanceof NativeBlockState && engineMantle.getEngine().getDimension().isBedrock()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -313,14 +313,14 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
|
||||
synchronized (chunk) {
|
||||
Matter matter = chunk.getOrCreate(y >> 4);
|
||||
if ((t instanceof PlatformBlockState || t instanceof MatterCavern)
|
||||
if ((t instanceof NativeBlockState || t instanceof MatterCavern)
|
||||
&& hasProtectedHydrology(matter, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
if (t instanceof PlatformBlockState) {
|
||||
if (t instanceof NativeBlockState) {
|
||||
clearDeferredPlacement(matter, x, y, z);
|
||||
}
|
||||
Class<?> sliceType = t instanceof PlatformBlockState ? PlatformBlockState.class : matter.getClass(t);
|
||||
Class<?> sliceType = t instanceof NativeBlockState ? NativeBlockState.class : matter.getClass(t);
|
||||
capturePreObjectOriginal(matter, x, y, z, sliceType);
|
||||
matter.slice(sliceType).set(x & 15, y & 15, z & 15, t);
|
||||
}
|
||||
@@ -380,9 +380,9 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
if (hasProtectedHydrology(matter, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
MatterSlice<PlatformBlockState> blockSlice = matter.getSlice(PlatformBlockState.class);
|
||||
MatterSlice<NativeBlockState> blockSlice = matter.getSlice(NativeBlockState.class);
|
||||
if (blockSlice != null) {
|
||||
capturePreObjectOriginal(matter, x, y, z, PlatformBlockState.class);
|
||||
capturePreObjectOriginal(matter, x, y, z, NativeBlockState.class);
|
||||
blockSlice.set(x & 15, y & 15, z & 15, null);
|
||||
}
|
||||
clearDeferredPlacement(matter, x, y, z);
|
||||
@@ -413,9 +413,9 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
if (hasProtectedHydrology(matter, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
MatterSlice<PlatformBlockState> blockSlice = matter.getSlice(PlatformBlockState.class);
|
||||
MatterSlice<NativeBlockState> blockSlice = matter.getSlice(NativeBlockState.class);
|
||||
if (blockSlice != null) {
|
||||
capturePreObjectOriginal(matter, x, y, z, PlatformBlockState.class);
|
||||
capturePreObjectOriginal(matter, x, y, z, NativeBlockState.class);
|
||||
blockSlice.set(x & 15, y & 15, z & 15, null);
|
||||
}
|
||||
clearDeferredPlacement(matter, x, y, z);
|
||||
@@ -444,9 +444,9 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
if (hasProtectedHydrology(matter, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
MatterSlice<PlatformBlockState> blockSlice = matter.getSlice(PlatformBlockState.class);
|
||||
MatterSlice<NativeBlockState> blockSlice = matter.getSlice(NativeBlockState.class);
|
||||
if (blockSlice != null) {
|
||||
capturePreObjectOriginal(matter, x, y, z, PlatformBlockState.class);
|
||||
capturePreObjectOriginal(matter, x, y, z, NativeBlockState.class);
|
||||
blockSlice.set(x & 15, y & 15, z & 15, null);
|
||||
}
|
||||
clearDeferredPlacement(matter, x, y, z);
|
||||
@@ -522,21 +522,21 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
return complex == null ? Optional.empty() : complex.resolvedTerrainColumn(x, z);
|
||||
}
|
||||
|
||||
private PlatformBlockState resolvedBlock(TerrainBoundarySignature column, int y) {
|
||||
private NativeBlockState resolvedBlock(TerrainBoundarySignature column, int y) {
|
||||
String stateKey = column.geometry().voxelAt(y + engineMantle.getEngine().getMinHeight()).stateKey();
|
||||
PlatformBlockState state = IrisPlatforms.get().registries().blockOrNull(stateKey);
|
||||
NativeBlockState state = IrisPlatforms.get().registries().blockOrNull(stateKey);
|
||||
if (state == null) {
|
||||
throw new IllegalStateException("Saved terrain state is unavailable: " + stateKey);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public PlatformBlockState getPrerequisiteBlock(int x, int y, int z) {
|
||||
public NativeBlockState getPrerequisiteBlock(int x, int y, int z) {
|
||||
Optional<TerrainBoundarySignature> resolved = resolvedColumn(x, z);
|
||||
if (resolved.isPresent()) {
|
||||
return resolvedBlock(resolved.get(), y);
|
||||
}
|
||||
PlatformBlockState block = getPrerequisiteDataIfPresent(x, y, z, PlatformBlockState.class);
|
||||
NativeBlockState block = getPrerequisiteDataIfPresent(x, y, z, NativeBlockState.class);
|
||||
return block == null ? AIR.get() : block;
|
||||
}
|
||||
|
||||
@@ -675,7 +675,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
return false;
|
||||
}
|
||||
if (cell.blockCaptured()) {
|
||||
restoreRaw(matter, x, y, z, PlatformBlockState.class, cell.block());
|
||||
restoreRaw(matter, x, y, z, NativeBlockState.class, cell.block());
|
||||
}
|
||||
if (cell.stringCaptured()) {
|
||||
restoreRaw(matter, x, y, z, String.class, cell.string());
|
||||
@@ -703,7 +703,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
if (matter == null || !matter.hasSlice(type)) {
|
||||
return;
|
||||
}
|
||||
if ((type == PlatformBlockState.class || type == MatterCavern.class)
|
||||
if ((type == NativeBlockState.class || type == MatterCavern.class)
|
||||
&& hasProtectedHydrology(matter, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
@@ -728,7 +728,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
private void setCustomBlock(int x, int y, int z, PlatformBlockState baseState, Identifier identifier) {
|
||||
private void setCustomBlock(int x, int y, int z, NativeBlockState baseState, Identifier identifier) {
|
||||
if (!allowsWrite(x, z) || y < 0 || y >= mantle.getWorldHeight()) {
|
||||
return;
|
||||
}
|
||||
@@ -746,9 +746,9 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
if (hasProtectedHydrology(matter, x, y, z)) {
|
||||
return;
|
||||
}
|
||||
MatterSlice<PlatformBlockState> blockSlice = matter.slice(PlatformBlockState.class);
|
||||
MatterSlice<NativeBlockState> blockSlice = matter.slice(NativeBlockState.class);
|
||||
MatterSlice<Identifier> identifierSlice = matter.slice(Identifier.class);
|
||||
capturePreObjectOriginal(matter, x, y, z, PlatformBlockState.class);
|
||||
capturePreObjectOriginal(matter, x, y, z, NativeBlockState.class);
|
||||
blockSlice.set(x & 15, y & 15, z & 15, baseState);
|
||||
identifierSlice.set(x & 15, y & 15, z & 15, identifier);
|
||||
}
|
||||
@@ -770,10 +770,10 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
}
|
||||
Object original = rawValue(matter, localX, localY, localZ, type);
|
||||
PreObjectMatterCell updated;
|
||||
if (type == PlatformBlockState.class) {
|
||||
if (type == NativeBlockState.class) {
|
||||
updated = current == null
|
||||
? PreObjectMatterCell.block((PlatformBlockState) original)
|
||||
: current.captureBlock((PlatformBlockState) original);
|
||||
? PreObjectMatterCell.block((NativeBlockState) original)
|
||||
: current.captureBlock((NativeBlockState) original);
|
||||
} else if (type == String.class) {
|
||||
updated = current == null
|
||||
? PreObjectMatterCell.string((String) original)
|
||||
@@ -787,7 +787,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
}
|
||||
|
||||
private static boolean isPreObjectType(Class<?> type) {
|
||||
return type == PlatformBlockState.class || type == String.class || type == MatterCavern.class;
|
||||
return type == NativeBlockState.class || type == String.class || type == MatterCavern.class;
|
||||
}
|
||||
|
||||
private static PreObjectMatterCell preObjectCell(Matter matter, int x, int y, int z) {
|
||||
@@ -888,12 +888,12 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, PlatformBlockState s) {
|
||||
public void set(int x, int y, int z, NativeBlockState s) {
|
||||
if (s == null) {
|
||||
return;
|
||||
}
|
||||
String placementKey = s.deferredPlacementKey();
|
||||
PlatformBlockState baseState = s.placementBaseState();
|
||||
NativeBlockState baseState = s.placementBaseState();
|
||||
if (s.isCustom() && placementKey != null && baseState != null) {
|
||||
Identifier identifier = Identifier.fromString(placementKey);
|
||||
setCustomBlock(x, y, z, baseState, identifier);
|
||||
@@ -903,10 +903,10 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState get(int x, int y, int z) {
|
||||
public NativeBlockState get(int x, int y, int z) {
|
||||
// Read-only probe: getDataIfPresent returns the identical answer without materializing
|
||||
// a 16^3 section + slice on a miss the way getData's getOrCreate path does.
|
||||
PlatformBlockState block = getDataIfPresent(x, y, z, PlatformBlockState.class);
|
||||
NativeBlockState block = getDataIfPresent(x, y, z, NativeBlockState.class);
|
||||
Optional<TerrainBoundarySignature> resolved = resolvedColumn(x, z);
|
||||
if (resolved.isPresent()) {
|
||||
PreObjectMatterCell cell = getDataIfPresent(x, y, z, PreObjectMatterCell.class);
|
||||
@@ -930,7 +930,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
if (resolved.isPresent()) {
|
||||
PreObjectMatterCell cell = getDataIfPresent(x, y, z, PreObjectMatterCell.class);
|
||||
if (cell != null && cell.blockCaptured()) {
|
||||
PlatformBlockState block = getDataIfPresent(x, y, z, PlatformBlockState.class);
|
||||
NativeBlockState block = getDataIfPresent(x, y, z, NativeBlockState.class);
|
||||
if (block != null) {
|
||||
return (block.isAir() || block.isFluid())
|
||||
&& resolved.get().geometry().hasSolidAbove(y + engineMantle.getEngine().getMinHeight());
|
||||
@@ -973,7 +973,7 @@ public class MantleWriter implements ObjectPassPlacer, AutoCloseable {
|
||||
for (int y = 0; y < carved.length; y++) {
|
||||
PreObjectMatterCell cell = getDataIfPresent(x, y, z, PreObjectMatterCell.class);
|
||||
if (cell != null && cell.blockCaptured()) {
|
||||
PlatformBlockState block = getDataIfPresent(x, y, z, PlatformBlockState.class);
|
||||
NativeBlockState block = getDataIfPresent(x, y, z, NativeBlockState.class);
|
||||
if (block != null) {
|
||||
carved[y] = (block.isAir() || block.isFluid())
|
||||
&& resolved.get().geometry().hasSolidAbove(y + engineMantle.getEngine().getMinHeight())
|
||||
|
||||
+19
-19
@@ -6,7 +6,7 @@ import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.generation.block.TileData;
|
||||
import art.arcane.iris.structure.object.IObjectPlacer;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.world.storage.matter.TileWrapper;
|
||||
import art.arcane.volmlib.util.matter.MatterCavern;
|
||||
@@ -66,7 +66,7 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
continue;
|
||||
}
|
||||
captureOriginal(originals, mutation.key());
|
||||
if (mutation.key().type() == PlatformBlockState.class) {
|
||||
if (mutation.key().type() == NativeBlockState.class) {
|
||||
captureOriginal(originals, new DataKey(
|
||||
mutation.key().x(),
|
||||
mutation.key().y(),
|
||||
@@ -99,17 +99,17 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(int x, int y, int z, PlatformBlockState state) {
|
||||
public void set(int x, int y, int z, NativeBlockState state) {
|
||||
if (state == null) {
|
||||
return;
|
||||
}
|
||||
String placementKey = state.deferredPlacementKey();
|
||||
PlatformBlockState baseState = state.placementBaseState();
|
||||
NativeBlockState baseState = state.placementBaseState();
|
||||
if (state.isCustom() && placementKey != null && baseState != null) {
|
||||
if (!canSetBlock(x, y, z)) {
|
||||
return;
|
||||
}
|
||||
DataKey blockKey = new DataKey(x, y, z, PlatformBlockState.class);
|
||||
DataKey blockKey = new DataKey(x, y, z, NativeBlockState.class);
|
||||
Identifier identifier = Identifier.fromString(placementKey);
|
||||
overlay.put(blockKey, baseState);
|
||||
overlay.put(new DataKey(x, y, z, Identifier.class), identifier);
|
||||
@@ -120,13 +120,13 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlatformBlockState get(int x, int y, int z) {
|
||||
DataKey key = new DataKey(x, y, z, PlatformBlockState.class);
|
||||
public NativeBlockState get(int x, int y, int z) {
|
||||
DataKey key = new DataKey(x, y, z, NativeBlockState.class);
|
||||
Object value = overlay.get(key);
|
||||
if (value == CLEARED) {
|
||||
return EngineMantle.AIR.get();
|
||||
}
|
||||
return value instanceof PlatformBlockState state
|
||||
return value instanceof NativeBlockState state
|
||||
? state
|
||||
: writer.getPrerequisiteBlock(x, y, z);
|
||||
}
|
||||
@@ -138,8 +138,8 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
|
||||
@Override
|
||||
public boolean isCarved(int x, int y, int z) {
|
||||
Object block = overlay.get(new DataKey(x, y, z, PlatformBlockState.class));
|
||||
if (block instanceof PlatformBlockState state && !state.isAir() && !state.isFluid()) {
|
||||
Object block = overlay.get(new DataKey(x, y, z, NativeBlockState.class));
|
||||
if (block instanceof NativeBlockState state && !state.isAir() && !state.isFluid()) {
|
||||
return false;
|
||||
}
|
||||
Object hydrologyValue = overlay.get(new DataKey(x, y, z, HydrologyCaveCell.class));
|
||||
@@ -187,14 +187,14 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
if (data == null || y < 0 || y >= worldHeight) {
|
||||
return;
|
||||
}
|
||||
if (data instanceof PlatformBlockState && !canSetBlock(x, y, z)) {
|
||||
if (data instanceof NativeBlockState && !canSetBlock(x, y, z)) {
|
||||
return;
|
||||
}
|
||||
if (data instanceof MatterCavern && hasProtectedHydrology(x, y, z)) {
|
||||
return;
|
||||
}
|
||||
Class<?> type = data instanceof PlatformBlockState ? PlatformBlockState.class : data.getClass();
|
||||
if (data instanceof PlatformBlockState) {
|
||||
Class<?> type = data instanceof NativeBlockState ? NativeBlockState.class : data.getClass();
|
||||
if (data instanceof NativeBlockState) {
|
||||
overlay.put(new DataKey(x, y, z, Identifier.class), CLEARED);
|
||||
}
|
||||
DataKey key = new DataKey(x, y, z, type);
|
||||
@@ -227,8 +227,8 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
carved = carved.clone();
|
||||
}
|
||||
for (int y = 0; y < cappedHeight; y++) {
|
||||
Object block = overlay.get(new DataKey(x, y, z, PlatformBlockState.class));
|
||||
if (block instanceof PlatformBlockState state && !state.isAir() && !state.isFluid()) {
|
||||
Object block = overlay.get(new DataKey(x, y, z, NativeBlockState.class));
|
||||
if (block instanceof NativeBlockState state && !state.isAir() && !state.isFluid()) {
|
||||
carved[y] = 0;
|
||||
continue;
|
||||
}
|
||||
@@ -291,13 +291,13 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
private void rollback(LinkedHashMap<DataKey, Object> originals, Throwable failure) {
|
||||
ArrayList<Map.Entry<DataKey, Object>> entries = new ArrayList<>(originals.entrySet());
|
||||
entries.sort((first, second) -> Boolean.compare(
|
||||
second.getKey().type() == PlatformBlockState.class,
|
||||
first.getKey().type() == PlatformBlockState.class
|
||||
second.getKey().type() == NativeBlockState.class,
|
||||
first.getKey().type() == NativeBlockState.class
|
||||
));
|
||||
for (Map.Entry<DataKey, Object> entry : entries) {
|
||||
DataKey key = entry.getKey();
|
||||
try {
|
||||
if (key.type() == PlatformBlockState.class
|
||||
if (key.type() == NativeBlockState.class
|
||||
&& writer.restorePrerequisiteCell(key.x(), key.y(), key.z())) {
|
||||
continue;
|
||||
}
|
||||
@@ -349,7 +349,7 @@ final class ObjectDestinationTransaction implements ObjectPassPlacer {
|
||||
}
|
||||
}
|
||||
|
||||
record CustomBlockMutation(DataKey key, PlatformBlockState state) implements Mutation {
|
||||
record CustomBlockMutation(DataKey key, NativeBlockState state) implements Mutation {
|
||||
@Override
|
||||
public int x() {
|
||||
return key.x();
|
||||
|
||||
@@ -1,147 +0,0 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||
* Copyright (c) 2022 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 art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.iris.structure.placement.IrisStructureCarveShape;
|
||||
import art.arcane.volmlib.util.noise.CNG;
|
||||
|
||||
/**
|
||||
* Carve envelope math shared by the Iris-assembled structure path and the native (vanilla template)
|
||||
* structure path so both shrinkwrap a structure footprint the same way. The lobe channel and the
|
||||
* eroded floor are only sampled by the native path; the Iris-assembled path still carves a uniform
|
||||
* side reach and a uniform floor cut.
|
||||
*/
|
||||
public final class StructureCarveEnvelope {
|
||||
private static final double CEILING_LOBE_RATIO = 0.5D;
|
||||
private static final double CEILING_ROLL_FREQUENCY_RATIO = 3D / 7D;
|
||||
private static final double FLOOR_ROLL_AMPLITUDE = 0.35D;
|
||||
private static final double FLOOR_ROLL_FREQUENCY_RATIO = 5D / 11D;
|
||||
// Maps a lobe frequency onto the smooth 2D channel so the auto-derived 0.015 lands near a
|
||||
// 40 block wavelength: wide enough that walls bulge and recede instead of tracking the footprint.
|
||||
private static final double LOBE_FREQUENCY_SCALE = 256D;
|
||||
|
||||
private StructureCarveEnvelope() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Per-column horizontal carve reach. The lobe channel only ever removes padding, so the boundary
|
||||
* stays inside the footprint bounds the carve was sized against and never falls below
|
||||
* {@code horizontalPadding * (1 - lobeStrength)}.
|
||||
*/
|
||||
public static double lobedSideReach(CNG lobe, double lobeFrequency, double lobeStrength,
|
||||
int x, int z, int horizontalPadding) {
|
||||
if (horizontalPadding <= 0) {
|
||||
return 0D;
|
||||
}
|
||||
return horizontalPadding * lobeFactor(lobe, lobeFrequency, lobeStrength, x, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ceiling counterpart of {@link #lobedSideReach}, deliberately half as strong so the roof swells
|
||||
* with the same lobes without collapsing onto the pieces.
|
||||
*/
|
||||
public static double lobedUpReach(CNG lobe, double lobeFrequency, double lobeStrength,
|
||||
int x, int z, double upReach) {
|
||||
if (upReach <= 0D) {
|
||||
return upReach;
|
||||
}
|
||||
return Math.max(1D, upReach
|
||||
* lobeFactor(lobe, lobeFrequency, lobeStrength * CEILING_LOBE_RATIO, x, z));
|
||||
}
|
||||
|
||||
private static double lobeFactor(CNG lobe, double lobeFrequency, double lobeStrength,
|
||||
int x, int z) {
|
||||
double clampedStrength = Math.max(0D, Math.min(1D, lobeStrength));
|
||||
if (lobe == null || clampedStrength <= 0D) {
|
||||
return 1D;
|
||||
}
|
||||
double scaledFrequency = lobeFrequency * LOBE_FREQUENCY_SCALE;
|
||||
double sample = Math.max(0D, Math.min(1D, lobe.fitDouble(
|
||||
0D, 1D, x * scaledFrequency, z * scaledFrequency)));
|
||||
return 1D - clampedStrength * (1D - sample);
|
||||
}
|
||||
|
||||
public static double erodedUpReach(CNG roll, double frequency, double strength, int x, int z, int head) {
|
||||
if (head <= 0) {
|
||||
return 0D;
|
||||
}
|
||||
double clampedStrength = Math.max(0D, Math.min(1D, strength));
|
||||
if (clampedStrength <= 0D) {
|
||||
return Math.max(1D, head);
|
||||
}
|
||||
double rollFrequency = frequency * CEILING_ROLL_FREQUENCY_RATIO;
|
||||
double sample = roll.fitDouble(0D, 1D, x * rollFrequency, z * rollFrequency) * 0.7D
|
||||
+ roll.fitDouble(0D, 1D, x * rollFrequency * 3D, z * rollFrequency * 3D) * 0.3D;
|
||||
double contrast = Math.max(0D, Math.min(1D, (sample - 0.5D) * 2.6D + 0.5D));
|
||||
double roundedReach = Math.max(1D, head);
|
||||
double erodedReach = Math.max(1D, head * (0.4D + 1.4D * contrast));
|
||||
return roundedReach + clampedStrength * (erodedReach - roundedReach);
|
||||
}
|
||||
|
||||
/**
|
||||
* Floor counterpart of {@link #erodedUpReach}. The amplitude is deliberately small and the result
|
||||
* never exceeds the configured floor padding, so a padding of zero leaves every column standing on
|
||||
* its own supporting block instead of undermining the structure.
|
||||
*/
|
||||
public static double erodedDownReach(CNG roll, double frequency, double strength, int x, int z, int floorCut) {
|
||||
if (floorCut <= 0) {
|
||||
return 0D;
|
||||
}
|
||||
double clampedStrength = Math.max(0D, Math.min(1D, strength));
|
||||
if (clampedStrength <= 0D) {
|
||||
return floorCut;
|
||||
}
|
||||
double rollFrequency = frequency * FLOOR_ROLL_FREQUENCY_RATIO;
|
||||
double sample = roll.fitDouble(0D, 1D, x * rollFrequency, z * rollFrequency);
|
||||
return floorCut * (1D - clampedStrength * FLOOR_ROLL_AMPLITUDE * (1D - sample));
|
||||
}
|
||||
|
||||
public static double normalizedVerticalDistance(int y, int sourceMinY, int sourceMaxY,
|
||||
double upReach, double downReach) {
|
||||
if (y > sourceMaxY) {
|
||||
return (y - sourceMaxY) / upReach;
|
||||
}
|
||||
if (y < sourceMinY) {
|
||||
return (sourceMinY - y) / downReach;
|
||||
}
|
||||
return 0D;
|
||||
}
|
||||
|
||||
public static double overboreBoundaryLimit(double noise, double strength) {
|
||||
double clampedNoise = Math.max(0.0, Math.min(1.0, noise));
|
||||
double clampedStrength = Math.max(0.0, Math.min(1.0, strength));
|
||||
return 1D - clampedStrength * (1D - clampedNoise);
|
||||
}
|
||||
|
||||
public static boolean shouldCarveOverboreCell(IrisStructureCarveShape shape, double distanceSquared,
|
||||
double noise, double strength) {
|
||||
if (distanceSquared <= 0.0) {
|
||||
return true;
|
||||
}
|
||||
IrisStructureCarveShape resolvedShape = shape == null ? IrisStructureCarveShape.ERODED : shape;
|
||||
return switch (resolvedShape) {
|
||||
case BOX -> true;
|
||||
case ROUNDED -> distanceSquared <= 1D;
|
||||
case ERODED -> {
|
||||
double limit = overboreBoundaryLimit(noise, strength);
|
||||
yield distanceSquared <= 1D && distanceSquared <= limit * limit;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,456 +0,0 @@
|
||||
package art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.iris.structure.placement.PlacedStructurePiece;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.structure.object.IrisObjectRotation;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import it.unimi.dsi.fastutil.longs.Long2LongMap;
|
||||
import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public final class StructureCarvingFootprint {
|
||||
static final int DEFAULT_MAX_CELLS = 1_048_576;
|
||||
|
||||
private final int minX;
|
||||
private final int maxX;
|
||||
private final int minZ;
|
||||
private final int maxZ;
|
||||
private final int width;
|
||||
private final int depth;
|
||||
private final long[] distanceSquared;
|
||||
private final int[] nearestSourceIds;
|
||||
private final int[] sourceMinY;
|
||||
private final int[] sourceMaxY;
|
||||
|
||||
private StructureCarvingFootprint(FootprintData data) {
|
||||
minX = data.minX();
|
||||
maxX = data.maxX();
|
||||
minZ = data.minZ();
|
||||
maxZ = data.maxZ();
|
||||
width = data.width();
|
||||
depth = data.depth();
|
||||
distanceSquared = data.distanceSquared();
|
||||
nearestSourceIds = data.nearestSourceIds();
|
||||
sourceMinY = data.sourceMinY();
|
||||
sourceMaxY = data.sourceMaxY();
|
||||
}
|
||||
|
||||
static StructureCarvingFootprint from(KList<PlacedStructurePiece> pieces, int padding) {
|
||||
return from(pieces, padding, DEFAULT_MAX_CELLS);
|
||||
}
|
||||
|
||||
static StructureCarvingFootprint from(KList<PlacedStructurePiece> pieces, int padding, int maxCells) {
|
||||
return fromColumns(sink -> emitPieceColumns(pieces, sink), padding, maxCells);
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a footprint from any per-column occupancy source. The source reports one contribution per
|
||||
* occupied column; overlapping contributions merge into a single column whose vertical extents span
|
||||
* every contribution.
|
||||
*/
|
||||
public static StructureCarvingFootprint fromColumns(ColumnSource source, int padding, int maxCells) {
|
||||
if (padding < 0) {
|
||||
throw new IllegalArgumentException("padding must be non-negative");
|
||||
}
|
||||
if (maxCells < 1) {
|
||||
throw new IllegalArgumentException("maxCells must be positive");
|
||||
}
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SourceCollection sources = collectSources(source);
|
||||
if (sources == null || sources.columns().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Bounds bounds = paddedBounds(sources.bounds(), padding, maxCells);
|
||||
if (bounds == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int[] nearestSourceIds = new int[bounds.cellCount()];
|
||||
Arrays.fill(nearestSourceIds, -1);
|
||||
int sourceCount = sources.columns().size();
|
||||
int[] sourceX = new int[sourceCount];
|
||||
int[] sourceZ = new int[sourceCount];
|
||||
int[] sourceMinY = new int[sourceCount];
|
||||
int[] sourceMaxY = new int[sourceCount];
|
||||
int sourceId = 0;
|
||||
for (Long2LongMap.Entry entry : sources.columns().long2LongEntrySet()) {
|
||||
int localX = unpackX(entry.getLongKey()) - bounds.minX();
|
||||
int localZ = unpackZ(entry.getLongKey()) - bounds.minZ();
|
||||
long heights = entry.getLongValue();
|
||||
sourceX[sourceId] = localX;
|
||||
sourceZ[sourceId] = localZ;
|
||||
sourceMinY[sourceId] = unpackMinY(heights);
|
||||
sourceMaxY[sourceId] = unpackMaxY(heights);
|
||||
nearestSourceIds[localZ * bounds.width() + localX] = sourceId;
|
||||
sourceId++;
|
||||
}
|
||||
|
||||
transformRows(nearestSourceIds, sourceX, sourceZ, bounds.width(), bounds.depth());
|
||||
long[] distanceSquared = transformColumns(
|
||||
nearestSourceIds, sourceX, sourceZ, bounds.width(), bounds.depth());
|
||||
FootprintData data = new FootprintData(
|
||||
bounds.minX(), bounds.maxX(), bounds.minZ(), bounds.maxZ(),
|
||||
bounds.width(), bounds.depth(), distanceSquared, nearestSourceIds,
|
||||
sourceMinY, sourceMaxY);
|
||||
return new StructureCarvingFootprint(data);
|
||||
}
|
||||
|
||||
public int minX() {
|
||||
return minX;
|
||||
}
|
||||
|
||||
public int maxX() {
|
||||
return maxX;
|
||||
}
|
||||
|
||||
public int minZ() {
|
||||
return minZ;
|
||||
}
|
||||
|
||||
public int maxZ() {
|
||||
return maxZ;
|
||||
}
|
||||
|
||||
public int width() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public int depth() {
|
||||
return depth;
|
||||
}
|
||||
|
||||
public boolean contains(int worldX, int worldZ) {
|
||||
return worldX >= minX && worldX <= maxX && worldZ >= minZ && worldZ <= maxZ;
|
||||
}
|
||||
|
||||
public int indexAt(int worldX, int worldZ) {
|
||||
if (!contains(worldX, worldZ)) {
|
||||
return -1;
|
||||
}
|
||||
return (worldZ - minZ) * width + worldX - minX;
|
||||
}
|
||||
|
||||
public long distanceSquaredAt(int worldX, int worldZ) {
|
||||
return distanceSquaredAt(requireIndex(worldX, worldZ));
|
||||
}
|
||||
|
||||
public long distanceSquaredAt(int index) {
|
||||
return distanceSquared[index];
|
||||
}
|
||||
|
||||
public int sourceMinYAt(int worldX, int worldZ) {
|
||||
return sourceMinYAt(requireIndex(worldX, worldZ));
|
||||
}
|
||||
|
||||
public int sourceMinYAt(int index) {
|
||||
return sourceMinY[nearestSourceIds[index]];
|
||||
}
|
||||
|
||||
public int sourceMaxYAt(int worldX, int worldZ) {
|
||||
return sourceMaxYAt(requireIndex(worldX, worldZ));
|
||||
}
|
||||
|
||||
public int sourceMaxYAt(int index) {
|
||||
return sourceMaxY[nearestSourceIds[index]];
|
||||
}
|
||||
|
||||
Column sample(int worldX, int worldZ) {
|
||||
int index = indexAt(worldX, worldZ);
|
||||
if (index < 0) {
|
||||
return null;
|
||||
}
|
||||
return new Column(distanceSquaredAt(index), sourceMinYAt(index), sourceMaxYAt(index));
|
||||
}
|
||||
|
||||
private static SourceCollection collectSources(ColumnSource source) {
|
||||
Long2LongOpenHashMap columns = new Long2LongOpenHashMap();
|
||||
MutableBounds bounds = new MutableBounds();
|
||||
boolean usable = source.emit((worldX, worldZ, minY, maxY) -> {
|
||||
mergeColumn(columns, worldX, worldZ, minY, maxY);
|
||||
bounds.include(worldX, worldZ);
|
||||
});
|
||||
if (!usable) {
|
||||
return null;
|
||||
}
|
||||
return columns.isEmpty() ? null : new SourceCollection(columns, bounds.freeze());
|
||||
}
|
||||
|
||||
private static boolean emitPieceColumns(KList<PlacedStructurePiece> pieces, ColumnSink sink) {
|
||||
if (pieces == null) {
|
||||
return true;
|
||||
}
|
||||
for (PlacedStructurePiece piece : pieces) {
|
||||
if (piece == null) {
|
||||
continue;
|
||||
}
|
||||
IrisObject object = piece.getObject();
|
||||
IrisObjectRotation rotation = piece.getRotation();
|
||||
if (object == null || rotation == null || object.getBlocks() == null) {
|
||||
continue;
|
||||
}
|
||||
for (IrisBlockVector local : object.getBlocks().keys()) {
|
||||
if (local == null || B.isAir(object.getBlocks().get(local))) {
|
||||
continue;
|
||||
}
|
||||
IrisBlockVector rotated = rotation.rotate(local.clone());
|
||||
long worldX = (long) piece.getX() + rotated.getBlockX();
|
||||
long worldY = (long) piece.getY() + rotated.getBlockY();
|
||||
long worldZ = (long) piece.getZ() + rotated.getBlockZ();
|
||||
if (!fitsInteger(worldX) || !fitsInteger(worldY) || !fitsInteger(worldZ)) {
|
||||
return false;
|
||||
}
|
||||
sink.column((int) worldX, (int) worldZ, (int) worldY, (int) worldY);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static Bounds paddedBounds(MutableBoundsSnapshot sourceBounds, int padding, int maxCells) {
|
||||
long paddedMinX = (long) sourceBounds.minX() - padding;
|
||||
long paddedMaxX = (long) sourceBounds.maxX() + padding;
|
||||
long paddedMinZ = (long) sourceBounds.minZ() - padding;
|
||||
long paddedMaxZ = (long) sourceBounds.maxZ() + padding;
|
||||
if (!fitsInteger(paddedMinX) || !fitsInteger(paddedMaxX)
|
||||
|| !fitsInteger(paddedMinZ) || !fitsInteger(paddedMaxZ)) {
|
||||
return null;
|
||||
}
|
||||
long width = paddedMaxX - paddedMinX + 1L;
|
||||
long depth = paddedMaxZ - paddedMinZ + 1L;
|
||||
if (width < 1L || depth < 1L || width > Integer.MAX_VALUE || depth > Integer.MAX_VALUE
|
||||
|| width > maxCells / depth) {
|
||||
return null;
|
||||
}
|
||||
int cellCount = (int) (width * depth);
|
||||
return new Bounds(
|
||||
(int) paddedMinX, (int) paddedMaxX, (int) paddedMinZ, (int) paddedMaxZ,
|
||||
(int) width, (int) depth, cellCount);
|
||||
}
|
||||
|
||||
private static void mergeColumn(Long2LongOpenHashMap columns, int x, int z, int minY, int maxY) {
|
||||
long key = pack(x, z);
|
||||
if (!columns.containsKey(key)) {
|
||||
columns.put(key, packHeights(minY, maxY));
|
||||
return;
|
||||
}
|
||||
long existing = columns.get(key);
|
||||
columns.put(key, packHeights(
|
||||
Math.min(minY, unpackMinY(existing)), Math.max(maxY, unpackMaxY(existing))));
|
||||
}
|
||||
|
||||
private static void transformRows(int[] nearestSourceIds, int[] sourceX, int[] sourceZ,
|
||||
int width, int depth) {
|
||||
for (int z = 0; z < depth; z++) {
|
||||
int rowStart = z * width;
|
||||
int previousSource = -1;
|
||||
for (int x = 0; x < width; x++) {
|
||||
int index = rowStart + x;
|
||||
int sourceId = nearestSourceIds[index];
|
||||
if (isExplicitSource(sourceId, x, z, sourceX, sourceZ)) {
|
||||
previousSource = sourceId;
|
||||
} else {
|
||||
nearestSourceIds[index] = previousSource;
|
||||
}
|
||||
}
|
||||
int nextSource = -1;
|
||||
for (int x = width - 1; x >= 0; x--) {
|
||||
int index = rowStart + x;
|
||||
int currentSource = nearestSourceIds[index];
|
||||
if (isExplicitSource(currentSource, x, z, sourceX, sourceZ)) {
|
||||
nextSource = currentSource;
|
||||
}
|
||||
if (isBetterHorizontalSource(nextSource, currentSource, x, sourceX)) {
|
||||
nearestSourceIds[index] = nextSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static long[] transformColumns(int[] nearestSourceIds, int[] sourceX, int[] sourceZ,
|
||||
int width, int depth) {
|
||||
long[] distanceSquared = new long[nearestSourceIds.length];
|
||||
int[] siteRows = new int[depth];
|
||||
int[] siteSourceIds = new int[depth];
|
||||
int[] starts = new int[depth];
|
||||
long[] siteCosts = new long[depth];
|
||||
for (int x = 0; x < width; x++) {
|
||||
int siteCount = buildEnvelope(
|
||||
nearestSourceIds, sourceX, width, depth, x,
|
||||
siteRows, siteSourceIds, starts, siteCosts);
|
||||
int siteIndex = 0;
|
||||
for (int z = 0; z < depth; z++) {
|
||||
while (siteIndex + 1 < siteCount && starts[siteIndex + 1] <= z) {
|
||||
siteIndex++;
|
||||
}
|
||||
int sourceId = siteSourceIds[siteIndex];
|
||||
int index = z * width + x;
|
||||
long deltaX = (long) x - sourceX[sourceId];
|
||||
long deltaZ = (long) z - sourceZ[sourceId];
|
||||
nearestSourceIds[index] = sourceId;
|
||||
distanceSquared[index] = deltaX * deltaX + deltaZ * deltaZ;
|
||||
}
|
||||
}
|
||||
return distanceSquared;
|
||||
}
|
||||
|
||||
private static int buildEnvelope(int[] nearestSourceIds, int[] sourceX, int width, int depth,
|
||||
int x, int[] siteRows, int[] siteSourceIds,
|
||||
int[] starts, long[] siteCosts) {
|
||||
int siteCount = 0;
|
||||
for (int z = 0; z < depth; z++) {
|
||||
int sourceId = nearestSourceIds[z * width + x];
|
||||
if (sourceId < 0) {
|
||||
continue;
|
||||
}
|
||||
long deltaX = (long) x - sourceX[sourceId];
|
||||
long cost = deltaX * deltaX;
|
||||
int start = Integer.MIN_VALUE;
|
||||
while (siteCount > 0) {
|
||||
start = firstStrictlyBetterAt(
|
||||
siteRows[siteCount - 1], siteCosts[siteCount - 1], z, cost);
|
||||
if (start > starts[siteCount - 1]) {
|
||||
break;
|
||||
}
|
||||
siteCount--;
|
||||
}
|
||||
if (siteCount == 0) {
|
||||
start = Integer.MIN_VALUE;
|
||||
}
|
||||
siteRows[siteCount] = z;
|
||||
siteSourceIds[siteCount] = sourceId;
|
||||
siteCosts[siteCount] = cost;
|
||||
starts[siteCount] = start;
|
||||
siteCount++;
|
||||
}
|
||||
return siteCount;
|
||||
}
|
||||
|
||||
private static int firstStrictlyBetterAt(int existingRow, long existingCost,
|
||||
int candidateRow, long candidateCost) {
|
||||
long numerator = candidateCost + (long) candidateRow * candidateRow
|
||||
- existingCost - (long) existingRow * existingRow;
|
||||
long denominator = 2L * (candidateRow - existingRow);
|
||||
long start = Math.floorDiv(numerator, denominator) + 1L;
|
||||
if (start < Integer.MIN_VALUE) {
|
||||
return Integer.MIN_VALUE;
|
||||
}
|
||||
if (start > Integer.MAX_VALUE) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return (int) start;
|
||||
}
|
||||
|
||||
private static boolean isExplicitSource(int sourceId, int x, int z,
|
||||
int[] sourceX, int[] sourceZ) {
|
||||
return sourceId >= 0 && sourceX[sourceId] == x && sourceZ[sourceId] == z;
|
||||
}
|
||||
|
||||
private static boolean isBetterHorizontalSource(int candidateId, int currentId,
|
||||
int x, int[] sourceX) {
|
||||
if (candidateId < 0) {
|
||||
return false;
|
||||
}
|
||||
if (currentId < 0) {
|
||||
return true;
|
||||
}
|
||||
long candidateDelta = (long) x - sourceX[candidateId];
|
||||
long currentDelta = (long) x - sourceX[currentId];
|
||||
long candidateDistance = candidateDelta * candidateDelta;
|
||||
long currentDistance = currentDelta * currentDelta;
|
||||
return candidateDistance < currentDistance
|
||||
|| candidateDistance == currentDistance && sourceX[candidateId] < sourceX[currentId];
|
||||
}
|
||||
|
||||
private int requireIndex(int worldX, int worldZ) {
|
||||
int index = indexAt(worldX, worldZ);
|
||||
if (index < 0) {
|
||||
throw new IndexOutOfBoundsException(
|
||||
"coordinate outside carving footprint: " + worldX + "," + worldZ);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
private static boolean fitsInteger(long value) {
|
||||
return value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
private static long pack(int x, int z) {
|
||||
return (long) x << 32 | z & 0xffffffffL;
|
||||
}
|
||||
|
||||
private static int unpackX(long packed) {
|
||||
return (int) (packed >> 32);
|
||||
}
|
||||
|
||||
private static int unpackZ(long packed) {
|
||||
return (int) packed;
|
||||
}
|
||||
|
||||
private static long packHeights(int minY, int maxY) {
|
||||
return (long) minY << 32 | maxY & 0xffffffffL;
|
||||
}
|
||||
|
||||
private static int unpackMinY(long packed) {
|
||||
return (int) (packed >> 32);
|
||||
}
|
||||
|
||||
private static int unpackMaxY(long packed) {
|
||||
return (int) packed;
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ColumnSink {
|
||||
void column(int worldX, int worldZ, int minY, int maxY);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ColumnSource {
|
||||
/**
|
||||
* Reports every occupied column to the sink. Returning false abandons the footprint, which is how
|
||||
* a source rejects occupancy it cannot address (for example coordinates outside the integer range).
|
||||
*/
|
||||
boolean emit(ColumnSink sink);
|
||||
}
|
||||
|
||||
record Column(long distanceSquared, int sourceMinY, int sourceMaxY) {
|
||||
}
|
||||
|
||||
private record Bounds(int minX, int maxX, int minZ, int maxZ,
|
||||
int width, int depth, int cellCount) {
|
||||
}
|
||||
|
||||
private record FootprintData(int minX, int maxX, int minZ, int maxZ,
|
||||
int width, int depth, long[] distanceSquared,
|
||||
int[] nearestSourceIds, int[] sourceMinY, int[] sourceMaxY) {
|
||||
}
|
||||
|
||||
private record SourceCollection(Long2LongOpenHashMap columns, MutableBoundsSnapshot bounds) {
|
||||
}
|
||||
|
||||
private record MutableBoundsSnapshot(int minX, int maxX, int minZ, int maxZ) {
|
||||
}
|
||||
|
||||
private static final class MutableBounds {
|
||||
private int minX = Integer.MAX_VALUE;
|
||||
private int maxX = Integer.MIN_VALUE;
|
||||
private int minZ = Integer.MAX_VALUE;
|
||||
private int maxZ = Integer.MIN_VALUE;
|
||||
|
||||
private void include(int x, int z) {
|
||||
minX = Math.min(minX, x);
|
||||
maxX = Math.max(maxX, x);
|
||||
minZ = Math.min(minZ, z);
|
||||
maxZ = Math.max(maxZ, z);
|
||||
}
|
||||
|
||||
private MutableBoundsSnapshot freeze() {
|
||||
return new MutableBoundsSnapshot(minX, maxX, minZ, maxZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
package art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap;
|
||||
|
||||
import java.util.function.IntConsumer;
|
||||
@@ -13,7 +13,7 @@ final class StructureFoundationPlanner {
|
||||
}
|
||||
|
||||
static void recordBaseCell(Long2IntOpenHashMap columns, int x, int y, int z,
|
||||
PlatformBlockState state, boolean supportNonOccluding) {
|
||||
NativeBlockState state, boolean supportNonOccluding) {
|
||||
if (columns == null || state == null
|
||||
|| !(supportNonOccluding ? state.isSolid() : state.isOccluding())) {
|
||||
return;
|
||||
@@ -38,7 +38,7 @@ final class StructureFoundationPlanner {
|
||||
return NO_GROUND;
|
||||
}
|
||||
|
||||
static boolean isGroundSolid(PlatformBlockState overlay, boolean carved, int mantleY, int terrainHeight) {
|
||||
static boolean isGroundSolid(NativeBlockState overlay, boolean carved, int mantleY, int terrainHeight) {
|
||||
if (mantleY <= 0) {
|
||||
return true;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ final class StructureFoundationPlanner {
|
||||
return !carved && mantleY <= terrainHeight;
|
||||
}
|
||||
|
||||
static boolean isSurfaceSupportBoundary(PlatformBlockState overlay, boolean carved,
|
||||
static boolean isSurfaceSupportBoundary(NativeBlockState overlay, boolean carved,
|
||||
int mantleY, int terrainHeight) {
|
||||
return carved || isGroundSolid(overlay, false, mantleY, terrainHeight);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.iris.structure.placement.PlacedStructurePiece;
|
||||
import art.arcane.iris.structure.object.IrisObject;
|
||||
import art.arcane.iris.structure.object.IrisObjectRotation;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.iris.generation.geometry.IrisBlockVector;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.structure.StructureCarvingFootprint;
|
||||
import art.arcane.volmlib.util.structure.StructureCarvingFootprint.ColumnSink;
|
||||
|
||||
final class StructurePieceColumns {
|
||||
private static final int DEFAULT_MAX_CELLS = 1_048_576;
|
||||
|
||||
private StructurePieceColumns() {
|
||||
}
|
||||
|
||||
static StructureCarvingFootprint from(KList<PlacedStructurePiece> pieces, int padding) {
|
||||
return from(pieces, padding, DEFAULT_MAX_CELLS);
|
||||
}
|
||||
|
||||
static StructureCarvingFootprint from(KList<PlacedStructurePiece> pieces, int padding, int maxCells) {
|
||||
return StructureCarvingFootprint.fromColumns(sink -> emitPieceColumns(pieces, sink), padding, maxCells);
|
||||
}
|
||||
|
||||
private static boolean emitPieceColumns(KList<PlacedStructurePiece> pieces, ColumnSink sink) {
|
||||
if (pieces == null) {
|
||||
return true;
|
||||
}
|
||||
for (PlacedStructurePiece piece : pieces) {
|
||||
if (piece == null) {
|
||||
continue;
|
||||
}
|
||||
IrisObject object = piece.getObject();
|
||||
IrisObjectRotation rotation = piece.getRotation();
|
||||
if (object == null || rotation == null || object.getBlocks() == null) {
|
||||
continue;
|
||||
}
|
||||
for (IrisBlockVector local : object.getBlocks().keys()) {
|
||||
if (local == null || B.isAir(object.getBlocks().get(local))) {
|
||||
continue;
|
||||
}
|
||||
IrisBlockVector rotated = rotation.rotate(local.clone());
|
||||
long worldX = (long) piece.getX() + rotated.getBlockX();
|
||||
long worldY = (long) piece.getY() + rotated.getBlockY();
|
||||
long worldZ = (long) piece.getZ() + rotated.getBlockZ();
|
||||
if (!fitsInteger(worldX) || !fitsInteger(worldY) || !fitsInteger(worldZ)) {
|
||||
return false;
|
||||
}
|
||||
sink.column((int) worldX, (int) worldZ, (int) worldY, (int) worldY);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean fitsInteger(long value) {
|
||||
return value >= Integer.MIN_VALUE && value <= Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package art.arcane.iris.generation.mantle;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.world.storage.matter.PreObjectMatterCell;
|
||||
import art.arcane.volmlib.util.function.Consumer4;
|
||||
@@ -103,7 +103,7 @@ public final class TerrainMatterView {
|
||||
}
|
||||
|
||||
private static boolean hasJournal(Class<?> type) {
|
||||
return type == MatterCavern.class || type == PlatformBlockState.class || type == String.class
|
||||
return type == MatterCavern.class || type == NativeBlockState.class || type == String.class
|
||||
|| type == HydrologyCaveCell.class;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.dfsek.paralithic.Expression;
|
||||
import com.dfsek.paralithic.eval.parser.Parser;
|
||||
import com.dfsek.paralithic.eval.parser.Scope;
|
||||
import art.arcane.iris.pack.loading.IrisRegistrant;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.noise.IrisExpressionFunction.FunctionContext;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
|
||||
@@ -22,7 +22,7 @@ import art.arcane.iris.generation.runtime.IrisEngineStreamType;
|
||||
import art.arcane.iris.generation.runtime.IrisEngineValueType;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.cache.LazyBoundedCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.volmlib.util.documentation.Description;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.noise;
|
||||
|
||||
import art.arcane.iris.pack.loading.IrisRegistrant;
|
||||
import art.arcane.iris.generation.cache.AtomicCache;
|
||||
import art.arcane.volmlib.util.cache.AtomicCache;
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.pack.schema.annotation.ArrayType;
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
package art.arcane.iris.generation.runtime;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public interface BlockUpdater {
|
||||
|
||||
void catchBlockUpdates(int x, int y, int z, PlatformBlockState data);
|
||||
void catchBlockUpdates(int x, int y, int z, NativeBlockState data);
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package art.arcane.iris.generation.runtime;
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.generation.terrain.IrisRegion;
|
||||
import art.arcane.iris.generation.terrain.Terrain3DColumn;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -369,9 +369,9 @@ public final class DimensionStackLayout {
|
||||
DimensionTerrainContext terrainContext,
|
||||
IrisBiome biome,
|
||||
IrisRegion region,
|
||||
PlatformBlockState rockBlock,
|
||||
PlatformBlockState fluidBlock,
|
||||
PlatformBlockState surfaceBlock,
|
||||
NativeBlockState rockBlock,
|
||||
NativeBlockState fluidBlock,
|
||||
NativeBlockState surfaceBlock,
|
||||
int normalTerrainHeight,
|
||||
int fluidHeight,
|
||||
Terrain3DColumn terrainColumn
|
||||
@@ -382,9 +382,9 @@ public final class DimensionStackLayout {
|
||||
DimensionTerrainContext terrainContext,
|
||||
IrisBiome biome,
|
||||
IrisRegion region,
|
||||
PlatformBlockState rockBlock,
|
||||
PlatformBlockState fluidBlock,
|
||||
PlatformBlockState surfaceBlock,
|
||||
NativeBlockState rockBlock,
|
||||
NativeBlockState fluidBlock,
|
||||
NativeBlockState surfaceBlock,
|
||||
int localBaseY,
|
||||
int normalTerrainHeight,
|
||||
int fluidHeight,
|
||||
|
||||
+16
-16
@@ -15,7 +15,7 @@ import art.arcane.iris.generation.noise.IrisShapedGeneratorStyle;
|
||||
import art.arcane.iris.generation.terrain.Terrain3DColumn;
|
||||
import art.arcane.iris.generation.terrain.Terrain3DRuntime;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.DataProvider;
|
||||
import art.arcane.volmlib.util.interpolation.NoiseBounds;
|
||||
import art.arcane.volmlib.util.stream.ProceduralStream;
|
||||
@@ -43,7 +43,7 @@ public final class DimensionTerrainContext implements DataProvider {
|
||||
private final ProceduralStream<Double> fluidHeightStream;
|
||||
private final ProceduralStream<IrisBiome> biomeStream;
|
||||
private final ProceduralStream<IrisRegion> regionStream;
|
||||
private final ProceduralStream<PlatformBlockState> rockStream;
|
||||
private final ProceduralStream<NativeBlockState> rockStream;
|
||||
private final FluidBlockSampler fluidBlockSampler;
|
||||
private final IrisImageMapRuntime imageMapRuntime;
|
||||
private final boolean selfReferencing;
|
||||
@@ -400,12 +400,12 @@ public final class DimensionTerrainContext implements DataProvider {
|
||||
: GenerationStreams.cache2DDouble(ProceduralStream.ofDouble((x, z) -> shapedHeight(terrain3D, x, z)), cachePrefix + "Terrain3DHeightStream", engine, cacheSize);
|
||||
ProceduralStream<Double> slopeStream = GenerationStreams.cache2DDouble(shapedHeightStream.slope(3), cachePrefix + "SlopeStream", engine, cacheSize);
|
||||
|
||||
ProceduralStream<PlatformBlockState> rockStream = dimension.getRockPalette()
|
||||
ProceduralStream<NativeBlockState> rockStream = dimension.getRockPalette()
|
||||
.getLayerGenerator(rng.nextParallelRNG(45), dimensionData).stream()
|
||||
.select(dimension.getRockPalette().getBlockData(dimensionData));
|
||||
FluidBlockSampler fluidBlockSampler;
|
||||
if (includeFluid) {
|
||||
ProceduralStream<PlatformBlockState> fluidStream = dimension.getFluidPalette()
|
||||
ProceduralStream<NativeBlockState> fluidStream = dimension.getFluidPalette()
|
||||
.getLayerGenerator(rng.nextParallelRNG(78), dimensionData).stream()
|
||||
.select(dimension.getFluidPalette().getBlockData(dimensionData));
|
||||
fluidBlockSampler = fluidStream::get;
|
||||
@@ -493,13 +493,13 @@ public final class DimensionTerrainContext implements DataProvider {
|
||||
return mappedBiome == null ? proceduralBiome : mappedBiome;
|
||||
}
|
||||
|
||||
static PlatformBlockState mappedSurfaceBlock(
|
||||
static NativeBlockState mappedSurfaceBlock(
|
||||
IrisImageMapRuntime imageMapRuntime,
|
||||
PlatformBlockState proceduralBlock,
|
||||
NativeBlockState proceduralBlock,
|
||||
double worldX,
|
||||
double worldZ
|
||||
) {
|
||||
PlatformBlockState mappedBlock = imageMapRuntime.sampleSurfaceBlock(worldX, worldZ);
|
||||
NativeBlockState mappedBlock = imageMapRuntime.sampleSurfaceBlock(worldX, worldZ);
|
||||
return mappedBlock == null ? proceduralBlock : mappedBlock;
|
||||
}
|
||||
|
||||
@@ -722,22 +722,22 @@ public final class DimensionTerrainContext implements DataProvider {
|
||||
return regionStream == null ? null : regionStream.get(x, z);
|
||||
}
|
||||
|
||||
public PlatformBlockState getRockBlock(double x, double z) {
|
||||
public NativeBlockState getRockBlock(double x, double z) {
|
||||
return rockStream.get(x, z);
|
||||
}
|
||||
|
||||
public PlatformBlockState getFluidBlock(double x, double z) {
|
||||
public NativeBlockState getFluidBlock(double x, double z) {
|
||||
return getFluidBlock(x, z, usesNaturalFallback(x, z));
|
||||
}
|
||||
|
||||
private PlatformBlockState getFluidBlock(double x, double z, boolean naturalFallback) {
|
||||
private NativeBlockState getFluidBlock(double x, double z, boolean naturalFallback) {
|
||||
if (naturalFallback && selfFallback != null) {
|
||||
return selfFallback.fluidBlockSampler().sample(x, z);
|
||||
}
|
||||
return fluidBlockSampler.sample(x, z);
|
||||
}
|
||||
|
||||
public PlatformBlockState getSurfaceBlock(double x, double z) {
|
||||
public NativeBlockState getSurfaceBlock(double x, double z) {
|
||||
return imageMapRuntime.sampleSurfaceBlock(x, z);
|
||||
}
|
||||
|
||||
@@ -779,7 +779,7 @@ public final class DimensionTerrainContext implements DataProvider {
|
||||
}
|
||||
|
||||
private interface FluidBlockSampler {
|
||||
PlatformBlockState sample(double x, double z);
|
||||
NativeBlockState sample(double x, double z);
|
||||
}
|
||||
|
||||
private record ContextState(
|
||||
@@ -792,7 +792,7 @@ public final class DimensionTerrainContext implements DataProvider {
|
||||
ProceduralStream<Double> fluidHeightStream,
|
||||
ProceduralStream<IrisBiome> biomeStream,
|
||||
ProceduralStream<IrisRegion> regionStream,
|
||||
ProceduralStream<PlatformBlockState> rockStream,
|
||||
ProceduralStream<NativeBlockState> rockStream,
|
||||
FluidBlockSampler fluidBlockSampler,
|
||||
IrisImageMapRuntime imageMapRuntime,
|
||||
boolean selfReferencing,
|
||||
@@ -815,9 +815,9 @@ public final class DimensionTerrainContext implements DataProvider {
|
||||
double fluidHeight,
|
||||
IrisBiome biome,
|
||||
IrisRegion region,
|
||||
PlatformBlockState rockBlock,
|
||||
PlatformBlockState fluidBlock,
|
||||
PlatformBlockState surfaceBlock,
|
||||
NativeBlockState rockBlock,
|
||||
NativeBlockState fluidBlock,
|
||||
NativeBlockState surfaceBlock,
|
||||
Terrain3DColumn terrainColumn
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.runtime;
|
||||
import art.arcane.iris.world.history.ChunkGenerationSemantics;
|
||||
|
||||
import art.arcane.iris.structure.nativegen.NativeStructureOwnershipStore;
|
||||
import art.arcane.iris.structure.nativegen.NativeStructureVolume;
|
||||
import art.arcane.volmlib.nativelib.terrain.structure.NativeStructureVolume;
|
||||
import art.arcane.iris.structure.placement.PlacedObject;
|
||||
import art.arcane.iris.structure.placement.StructurePlacementMarker;
|
||||
|
||||
@@ -49,8 +49,8 @@ import art.arcane.iris.world.IrisWorld;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveCell;
|
||||
import art.arcane.iris.generation.hydrology.cave.HydrologyCaveStorage;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
@@ -251,7 +251,7 @@ public interface Engine extends DataProvider, Fallible, BlockUpdater, Renderer,
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
void generate(int x, int z, Hunk<PlatformBlockState> blocks, Hunk<PlatformBiome> biomes, boolean multicore) throws WrongEngineBroException;
|
||||
void generate(int x, int z, Hunk<NativeBlockState> blocks, Hunk<NativeBiome> biomes, boolean multicore) throws WrongEngineBroException;
|
||||
|
||||
EngineMetrics getMetrics();
|
||||
|
||||
@@ -542,7 +542,7 @@ public interface Engine extends DataProvider, Fallible, BlockUpdater, Renderer,
|
||||
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
default void catchBlockUpdates(int x, int y, int z, PlatformBlockState data) {
|
||||
default void catchBlockUpdates(int x, int y, int z, NativeBlockState data) {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
package art.arcane.iris.generation.runtime;
|
||||
|
||||
import art.arcane.iris.generation.biome.IrisBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
@@ -27,15 +27,15 @@ import art.arcane.volmlib.util.hunk.Hunk;
|
||||
public interface EngineDecorator extends EngineComponent {
|
||||
|
||||
@BlockCoordinates
|
||||
void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<PlatformBlockState> data, IrisBiome biome, int height, int max);
|
||||
void decorate(int x, int z, int realX, int realX1, int realX_1, int realZ, int realZ1, int realZ_1, Hunk<NativeBlockState> data, IrisBiome biome, int height, int max);
|
||||
|
||||
@BlockCoordinates
|
||||
default void decorate(int x, int z, int realX, int realZ, Hunk<PlatformBlockState> data, IrisBiome biome, int height, int max) {
|
||||
default void decorate(int x, int z, int realX, int realZ, Hunk<NativeBlockState> data, IrisBiome biome, int height, int max) {
|
||||
decorate(x, z, realX, realX, realX, realZ, realZ, realZ, data, biome, height, max);
|
||||
}
|
||||
|
||||
@SuppressWarnings("BooleanMethodIsAlwaysInverted")
|
||||
default boolean canGoOn(PlatformBlockState decorant, PlatformBlockState atop) {
|
||||
default boolean canGoOn(NativeBlockState decorant, NativeBlockState atop) {
|
||||
if (atop == null || atop.isAir()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
import art.arcane.iris.generation.concurrent.BurstExecutor;
|
||||
import art.arcane.iris.generation.concurrent.MultiBurst;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
|
||||
public interface EngineMode extends Staged {
|
||||
KList<EngineStage> getTerrainStages();
|
||||
@@ -37,7 +37,7 @@ public interface EngineMode extends Staged {
|
||||
|
||||
EngineStage getTransitionStage();
|
||||
|
||||
default void generateTerrain(int x, int z, Hunk<PlatformBlockState> blocks, Hunk<PlatformBiome> biomes,
|
||||
default void generateTerrain(int x, int z, Hunk<NativeBlockState> blocks, Hunk<NativeBiome> biomes,
|
||||
boolean multicore, ChunkContext context) {
|
||||
context.setTerrainBiomeOutput(biomes);
|
||||
for (EngineStage stage : getTerrainStages()) {
|
||||
@@ -183,7 +183,7 @@ public interface EngineMode extends Staged {
|
||||
}
|
||||
|
||||
@BlockCoordinates
|
||||
default void generate(int x, int z, Hunk<PlatformBlockState> blocks, Hunk<PlatformBiome> biomes, boolean multicore, long generationSessionId) {
|
||||
default void generate(int x, int z, Hunk<NativeBlockState> blocks, Hunk<NativeBiome> biomes, boolean multicore, long generationSessionId) {
|
||||
boolean cacheContext = !getEngine().getPlatformHooks().shouldDisableChunkContextCache(getEngine());
|
||||
ChunkContext.PrefillPlan prefillPlan = cacheContext ? ChunkContext.PrefillPlan.NO_CAVE : ChunkContext.PrefillPlan.NONE;
|
||||
ChunkContext ctx = new ChunkContext(
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
package art.arcane.iris.generation.runtime;
|
||||
|
||||
import art.arcane.iris.structure.nativegen.NativeStructureVolume;
|
||||
import art.arcane.volmlib.nativelib.terrain.structure.NativeStructureVolume;
|
||||
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.world.history.SavedTerrainChunk;
|
||||
|
||||
@@ -18,15 +18,15 @@
|
||||
|
||||
package art.arcane.iris.generation.runtime;
|
||||
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
import art.arcane.volmlib.util.documentation.BlockCoordinates;
|
||||
import art.arcane.volmlib.util.hunk.Hunk;
|
||||
|
||||
public interface EngineStage {
|
||||
@BlockCoordinates
|
||||
void generate(int x, int z, Hunk<PlatformBlockState> blocks, Hunk<PlatformBiome> biomes, boolean multicore, ChunkContext context);
|
||||
void generate(int x, int z, Hunk<NativeBlockState> blocks, Hunk<NativeBiome> biomes, boolean multicore, ChunkContext context);
|
||||
|
||||
default void close() {
|
||||
if (this instanceof EngineComponent c) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package art.arcane.iris.generation.runtime;
|
||||
|
||||
public final class GenerationSessionLease implements AutoCloseable {
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeGenerationLease;
|
||||
|
||||
public final class GenerationSessionLease implements NativeGenerationLease {
|
||||
private static final GenerationSessionLease NOOP = new GenerationSessionLease(null, null, 0L, null);
|
||||
|
||||
private final GenerationSessionManager manager;
|
||||
|
||||
@@ -66,8 +66,8 @@ import art.arcane.iris.generation.terrain.Terrain3DRuntime;
|
||||
import art.arcane.iris.generation.terrain.HydrologyBankTerrainRuntime;
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.iris.generation.block.DataProvider;
|
||||
import art.arcane.volmlib.util.math.M;
|
||||
@@ -174,7 +174,7 @@ public class IrisComplex implements DataProvider {
|
||||
private ProceduralStream<IrisBiome> naturalTrueBiomeStream;
|
||||
private ProceduralStream<IrisBiome> unblendedNaturalTrueBiomeStream;
|
||||
private ProceduralStream<IrisBiome> trueBiomeStream;
|
||||
private ProceduralStream<PlatformBiome> trueBiomeDerivativeStream;
|
||||
private ProceduralStream<NativeBiome> trueBiomeDerivativeStream;
|
||||
private ProceduralStream<Double> naturalHeightStream;
|
||||
private ProceduralStream<Double> baseTerrainHeightStream;
|
||||
@Getter(AccessLevel.NONE)
|
||||
@@ -208,9 +208,9 @@ public class IrisComplex implements DataProvider {
|
||||
private ProceduralStream<IrisDecorator> seaSurfaceDecoration;
|
||||
private ProceduralStream<IrisDecorator> seaFloorDecoration;
|
||||
private ProceduralStream<IrisDecorator> shoreSurfaceDecoration;
|
||||
private ProceduralStream<PlatformBlockState> rockStream;
|
||||
private ProceduralStream<PlatformBlockState> fluidStream;
|
||||
private Map<String, ProceduralStream<PlatformBlockState>> hydrologyFluidStreams;
|
||||
private ProceduralStream<NativeBlockState> rockStream;
|
||||
private ProceduralStream<NativeBlockState> fluidStream;
|
||||
private Map<String, ProceduralStream<NativeBlockState>> hydrologyFluidStreams;
|
||||
private final BiomeBuffetLayout biomeBuffet;
|
||||
@Getter(AccessLevel.NONE)
|
||||
private final Map<IrisBiome, GeneratorGroup[]> biomeBuffetGenerators;
|
||||
@@ -858,11 +858,11 @@ public class IrisComplex implements DataProvider {
|
||||
return false;
|
||||
}
|
||||
|
||||
private Map<String, ProceduralStream<PlatformBlockState>> createHydrologyFluidStreams(IrisHydrology hydrology) {
|
||||
private Map<String, ProceduralStream<NativeBlockState>> createHydrologyFluidStreams(IrisHydrology hydrology) {
|
||||
if (hydrology == null) {
|
||||
return Map.of();
|
||||
}
|
||||
LinkedHashMap<String, ProceduralStream<PlatformBlockState>> streams = new LinkedHashMap<>();
|
||||
LinkedHashMap<String, ProceduralStream<NativeBlockState>> streams = new LinkedHashMap<>();
|
||||
IrisRiverHydrology rivers = Objects.requireNonNull(hydrology.getRivers(), "hydrology.rivers");
|
||||
int streamIndex = 0;
|
||||
for (IrisRiverProfile profile : rivers.getProfiles()) {
|
||||
@@ -870,7 +870,7 @@ public class IrisComplex implements DataProvider {
|
||||
throw new IllegalArgumentException("hydrology.rivers.profiles cannot contain null entries");
|
||||
}
|
||||
String profileKey = requireHydrologyKey(profile.getId(), "hydrology.rivers.profiles[].id");
|
||||
ProceduralStream<PlatformBlockState> stream = configuredFluidStream(
|
||||
ProceduralStream<NativeBlockState> stream = configuredFluidStream(
|
||||
profile.getFluidPalette(),
|
||||
rng.nextParallelRNG(7900 + streamIndex++),
|
||||
"hydrology river profile " + profileKey
|
||||
@@ -884,7 +884,7 @@ public class IrisComplex implements DataProvider {
|
||||
throw new IllegalArgumentException("hydrology.deepFluids cannot contain null entries");
|
||||
}
|
||||
String profileKey = requireHydrologyKey(deepFluid.getId(), "hydrology.deepFluids[].id");
|
||||
ProceduralStream<PlatformBlockState> stream = configuredFluidStream(
|
||||
ProceduralStream<NativeBlockState> stream = configuredFluidStream(
|
||||
deepFluid.getFluidPalette(),
|
||||
rng.nextParallelRNG(8900 + streamIndex++),
|
||||
"hydrology deep-fluid profile " + profileKey
|
||||
@@ -898,7 +898,7 @@ public class IrisComplex implements DataProvider {
|
||||
throw new IllegalArgumentException("hydrology.surfacePools cannot contain null entries");
|
||||
}
|
||||
String profileKey = requireHydrologyKey(pool.getId(), "hydrology.surfacePools[].id");
|
||||
ProceduralStream<PlatformBlockState> stream = configuredFluidStream(
|
||||
ProceduralStream<NativeBlockState> stream = configuredFluidStream(
|
||||
pool.getFluidPalette(),
|
||||
rng.nextParallelRNG(9900 + streamIndex++),
|
||||
"hydrology surface pool " + profileKey
|
||||
@@ -917,18 +917,18 @@ public class IrisComplex implements DataProvider {
|
||||
return key.trim();
|
||||
}
|
||||
|
||||
private ProceduralStream<PlatformBlockState> configuredFluidStream(
|
||||
private ProceduralStream<NativeBlockState> configuredFluidStream(
|
||||
IrisMaterialPalette palette,
|
||||
RNG fluidRng,
|
||||
String configurationName
|
||||
) {
|
||||
Objects.requireNonNull(palette, configurationName + " fluidPalette must be configured");
|
||||
KList<PlatformBlockState> blocks = palette.getBlockData(data);
|
||||
KList<NativeBlockState> blocks = palette.getBlockData(data);
|
||||
if (blocks.isEmpty()) {
|
||||
throw new IllegalArgumentException(
|
||||
configurationName + " fluidPalette must resolve at least one fluid block");
|
||||
}
|
||||
for (PlatformBlockState block : blocks) {
|
||||
for (NativeBlockState block : blocks) {
|
||||
if (block == null || !block.isFluid()) {
|
||||
throw new IllegalArgumentException(
|
||||
configurationName + " fluidPalette may contain only fluid blocks");
|
||||
@@ -937,16 +937,16 @@ public class IrisComplex implements DataProvider {
|
||||
return palette.getLayerGenerator(fluidRng, data).stream().select(blocks);
|
||||
}
|
||||
|
||||
public PlatformBlockState resolveHydrologyFluid(String profileKey, double x, double z) {
|
||||
public NativeBlockState resolveHydrologyFluid(String profileKey, double x, double z) {
|
||||
String key = Objects.requireNonNull(profileKey, "profileKey").trim();
|
||||
ProceduralStream<PlatformBlockState> stream = hydrologyFluidStreams.get(key);
|
||||
ProceduralStream<NativeBlockState> stream = hydrologyFluidStreams.get(key);
|
||||
if (stream == null) {
|
||||
throw new IllegalArgumentException("Unknown hydrology fluid profile: " + key);
|
||||
}
|
||||
return stream.get(x, z);
|
||||
}
|
||||
|
||||
public PlatformBlockState resolveSurfaceFluid(double x, double z) {
|
||||
public NativeBlockState resolveSurfaceFluid(double x, double z) {
|
||||
HydrologyColumnLayer layer = surfaceFluidLayer(x, z);
|
||||
if (layer != null) {
|
||||
return resolveHydrologyFluid(layer.profileKey(), x, z);
|
||||
@@ -1294,7 +1294,7 @@ public class IrisComplex implements DataProvider {
|
||||
continue;
|
||||
}
|
||||
|
||||
PlatformBlockState block = i.getBlockData(b, rngc, x, z, data);
|
||||
NativeBlockState block = i.getBlockData(b, rngc, x, z, data);
|
||||
|
||||
if (block != null) {
|
||||
return i;
|
||||
|
||||
@@ -21,7 +21,7 @@ package art.arcane.iris.generation.runtime;
|
||||
import art.arcane.iris.generation.runtime.EngineBackgroundTasks.BackgroundTaskDrain;
|
||||
import art.arcane.iris.generation.runtime.EngineRuntimeBuilder.RuntimeAssembly;
|
||||
import art.arcane.iris.pack.loading.IrisData;
|
||||
import art.arcane.iris.structure.nativegen.NativeStructureVolume;
|
||||
import art.arcane.volmlib.nativelib.terrain.structure.NativeStructureVolume;
|
||||
import art.arcane.iris.structure.nativegen.NativeStructureVolumeMemo;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
import art.arcane.iris.structure.nativegen.NativeStructureOwnershipStore;
|
||||
@@ -44,8 +44,8 @@ import art.arcane.iris.structure.StructureIndexService;
|
||||
import art.arcane.iris.generation.mantle.EngineMantle;
|
||||
import art.arcane.iris.generation.block.B;
|
||||
import java.util.function.Consumer;
|
||||
import art.arcane.iris.spi.PlatformBiome;
|
||||
import art.arcane.iris.spi.PlatformBlockState;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBiome;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import art.arcane.volmlib.util.atomics.AtomicRollingSequence;
|
||||
import art.arcane.iris.generation.context.ChunkContext;
|
||||
import art.arcane.iris.generation.context.IrisContext;
|
||||
@@ -1497,7 +1497,7 @@ public class IrisEngine implements Engine {
|
||||
|
||||
@BlockCoordinates
|
||||
@Override
|
||||
public void generate(int x, int z, Hunk<PlatformBlockState> vblocks, Hunk<PlatformBiome> vbiomes, boolean multicore) throws WrongEngineBroException {
|
||||
public void generate(int x, int z, Hunk<NativeBlockState> vblocks, Hunk<NativeBiome> vbiomes, boolean multicore) throws WrongEngineBroException {
|
||||
awaitGenerationCacheWarm();
|
||||
try (GenerationHistoryRuntimeRouter.CoordinateScope historyScope =
|
||||
openGenerationHistoryCoordinateScope(x, z);
|
||||
@@ -1505,10 +1505,10 @@ public class IrisEngine implements Engine {
|
||||
IrisContext.Scope generationScope = IrisContext.open(this, lease.sessionId(), null)) {
|
||||
getEngineData().getStatistics().generatedChunk();
|
||||
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||
Hunk<PlatformBlockState> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y, z + zz, t));
|
||||
Hunk<NativeBlockState> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y, z + zz, t));
|
||||
|
||||
if (getDimension().isDebugChunkCrossSections() && ((x >> 4) % getDimension().getDebugCrossSectionsMod() == 0 || (z >> 4) % getDimension().getDebugCrossSectionsMod() == 0)) {
|
||||
PlatformBlockState crossSection = B.getState("CRYING_OBSIDIAN");
|
||||
NativeBlockState crossSection = B.getState("CRYING_OBSIDIAN");
|
||||
for (int i = 0; i < 16; i++) {
|
||||
for (int j = 0; j < 16; j++) {
|
||||
blocks.set(i, 0, j, crossSection);
|
||||
|
||||
Loaded 100 of 892 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user