This commit is contained in:
Brian Neumann-Fopiano committed 2026-07-09 18:34:16 -04:00
1 parent 0a7a531646
commit 6111b5670a
65 files changed
+998 -382

No files matched your search

+1 -3
View File
@@ -2,13 +2,12 @@ String apiVersion = providers.gradleProperty('minecraftVersion').get()
def mainClass = 'art.arcane.iris.Iris'
String volmLibCoordinate = providers.gradleProperty('volmLibCoordinate')
.orElse('com.github.VolmitSoftware:VolmLib:master-SNAPSHOT')
.orElse('com.github.VolmitSoftware:VolmLib:cdf7e8bb880199734dacd386a6616bda799fcde1')
.get()
dependencies {
compileOnly(project(':core'))
compileOnly(volmLibCoordinate) {
changing = true
transitive = false
}
compileOnly(libs.spigot)
@@ -18,7 +17,6 @@ dependencies {
testImplementation(libs.sentry)
testImplementation(project(':core'))
testImplementation(volmLibCoordinate) {
changing = true
transitive = false
}
compileOnly(libs.placeholderApi)
@@ -34,6 +34,7 @@ import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.IrisDimension;
import art.arcane.iris.engine.platform.PlatformChunkGenerator;
import art.arcane.iris.util.project.context.IrisContext;
import art.arcane.iris.util.project.matter.IrisMatterContext;
import art.arcane.iris.util.common.director.DirectorExecutor;
import art.arcane.volmlib.util.director.DirectorOrigin;
import art.arcane.volmlib.util.director.annotations.Director;
@@ -74,8 +75,14 @@ public class CommandDeveloper implements DirectorExecutor {
@Director(description = "Send a test exception to sentry")
public void Sentry() {
Engine engine = engine();
if (engine != null) IrisContext.getOr(engine);
Iris.reportError(new Exception("This is a test"));
Exception testException = new Exception("This is a test");
if (engine == null) {
Iris.reportError(testException);
return;
}
try (IrisContext.Scope scope = IrisContext.open(engine, engine.getGenerationSessionId(), null)) {
Iris.reportError(testException);
}
}
@Director(description = "Hash generated block output of a fixed area for determinism/identity testing", origin = DirectorOrigin.BOTH)
@@ -221,18 +228,28 @@ public class CommandDeveloper implements DirectorExecutor {
@Param(name = "name", description = "The dump file id under plugins/Iris/dump (pv.<id>.*)", defaultValue = "21474836474")
String name
) throws Throwable {
var base = Iris.instance.getDataFile("dump", "pv." + name + ".ttp.lz4b.bin");
var section = Iris.instance.getDataFile("dump", "pv." + name + ".section.bin");
Engine activeEngine = engine();
if (activeEngine == null) {
sender().sendMessage(C.RED + "Target an Iris world before reading a mantle dump.");
return;
}
File base = Iris.instance.getDataFile("dump", "pv." + name + ".ttp.lz4b.bin");
File section = Iris.instance.getDataFile("dump", "pv." + name + ".section.bin");
if (plate) {
try (var in = CountingDataInputStream.wrap(new BufferedInputStream(new FileInputStream(base)))) {
TectonicPlate.read(1088, in, true, IrisEngineMantle.createRuntimeDataAdapter(), IrisEngineMantle.createRuntimeHooks());
} catch (Throwable e) {
e.printStackTrace();
try (IrisMatterContext.Scope scope = IrisMatterContext.open(activeEngine.getData())) {
if (plate) {
try (CountingDataInputStream in = CountingDataInputStream.wrap(new BufferedInputStream(new FileInputStream(base)))) {
TectonicPlate.read(1088, in, true, IrisEngineMantle.createRuntimeDataAdapter(activeEngine.getData()), IrisEngineMantle.createRuntimeHooks());
} catch (Throwable e) {
e.printStackTrace();
}
} else {
Matter.read(section);
}
} else Matter.read(section);
if (!TectonicPlate.hasError())
}
if (!TectonicPlate.hasError()) {
Iris.info("Read " + (plate ? base : section).length() + " bytes from " + (plate ? base : section).getAbsolutePath());
}
}
@Director(description = "Test")
@@ -42,21 +42,36 @@ public class CommandPregen implements DirectorExecutor {
@Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0")
Vector center,
@Param(description = "Open the Iris pregen gui", defaultValue = "true")
boolean gui
boolean gui,
@Param(name = "serial", description = "Generate only one chunk at a time", defaultValue = "false")
boolean serial
) {
if (radius <= 0) {
sender().sendMessage(C.RED + "Pregen radius must be greater than zero blocks.");
return;
}
if (serial && !IrisToolbelt.supportsStrictSerialPregeneration()) {
sender().sendMessage(C.RED + "Strict serial pregeneration requires Paper or a Paper-compatible server.");
return;
}
try {
if (sender().isPlayer() && access() == null) {
sender().sendMessage(C.RED + "The engine access for this world is null!");
sender().sendMessage(C.RED + "Please make sure the world is loaded & the engine is initialized. Generate a new chunk, for example.");
}
radius = Math.max(radius, 1024);
IrisToolbelt.pregenerate(PregenTask
PregenTask task = PregenTask
.builder()
.center(new Position2(center.getBlockX(), center.getBlockZ()))
.gui(gui)
.radiusX(radius)
.radiusZ(radius)
.build(), world);
.build();
if (serial) {
IrisToolbelt.pregenerateSerial(task, world);
} else {
IrisToolbelt.pregenerate(task, world);
}
String msg = C.GREEN + "Pregen started in " + C.GOLD + world.getName() + C.GREEN + " of " + C.GOLD + (radius * 2) + C.GREEN + " by " + C.GOLD + (radius * 2) + C.GREEN + " blocks from " + C.GOLD + center.getX() + "," + center.getZ();
sender().sendMessage(msg);
Iris.info(msg);
+2 -1
View File
@@ -31,6 +31,7 @@ file('../../gradle.properties').withInputStream { InputStream stream -> rootProp
String irisVersion = providers.gradleProperty('irisVersion').getOrElse(rootProperties.getProperty('irisVersion', '4.0.0-26.2'))
String minecraftVersion = providers.gradleProperty('minecraftVersion').getOrElse(rootProperties.getProperty('minecraftVersion', '26.2'))
String fabricLoaderVersion = providers.gradleProperty('fabricLoaderVersion').getOrElse(rootProperties.getProperty('fabricLoaderVersion', '0.19.3'))
String volmLibCoordinate = providers.gradleProperty('volmLibCoordinate').getOrElse(rootProperties.getProperty('volmLibCoordinate', 'com.github.VolmitSoftware:VolmLib:cdf7e8bb880199734dacd386a6616bda799fcde1'))
Closure<String> irisArtifactName = { String platform, String targetVersion ->
return "Iris v${project.version} [${platform}] ${targetVersion}.jar"
}
@@ -124,7 +125,7 @@ dependencies {
List<Object> shared = [
"art.arcane:core:${irisVersion}".toString(),
"art.arcane:spi:${irisVersion}".toString(),
'com.github.VolmitSoftware:VolmLib:master-SNAPSHOT',
volmLibCoordinate,
libs.paralithic,
libs.lru,
libs.kotlin.stdlib,
@@ -25,6 +25,7 @@
{ "file": "META-INF/jars/fabric-command-api-v2.jar" },
{ "file": "META-INF/jars/fabric-events-interaction-v0.jar" },
{ "file": "META-INF/jars/fabric-rendering-v1.jar" },
{ "file": "META-INF/jars/fabric-transitive-access-wideners-v1.jar" },
{ "file": "META-INF/jars/fabric-key-mapping-api-v1.jar" }
],
"depends": {
+2 -1
View File
@@ -31,6 +31,7 @@ file('../../gradle.properties').withInputStream { InputStream stream -> rootProp
String irisVersion = providers.gradleProperty('irisVersion').getOrElse(rootProperties.getProperty('irisVersion', '4.0.0-26.2'))
String minecraftVersion = providers.gradleProperty('minecraftVersion').getOrElse(rootProperties.getProperty('minecraftVersion', '26.2'))
String forgeVersion = providers.gradleProperty('forgeVersion').getOrElse(rootProperties.getProperty('forgeVersion', '26.2-65.0.0'))
String volmLibCoordinate = providers.gradleProperty('volmLibCoordinate').getOrElse(rootProperties.getProperty('volmLibCoordinate', 'com.github.VolmitSoftware:VolmLib:cdf7e8bb880199734dacd386a6616bda799fcde1'))
Closure<String> loaderDisplayVersion = { String loaderVersion ->
String coordinatePrefix = "${minecraftVersion}-"
if (loaderVersion.startsWith(coordinatePrefix)) {
@@ -134,7 +135,7 @@ dependencies {
List<Object> shared = [
"art.arcane:core:${irisVersion}".toString(),
"art.arcane:spi:${irisVersion}".toString(),
'com.github.VolmitSoftware:VolmLib:master-SNAPSHOT',
volmLibCoordinate,
libs.paralithic,
libs.lru,
libs.kotlin.stdlib,
@@ -62,6 +62,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemp
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
import java.util.Optional;
@@ -368,8 +369,8 @@ public final class IrisModdedChunkGenerator extends ChunkGenerator {
for (int blockY = y; blockY < sectionEnd; blockY++) {
int bufferY = blockY - dimMinY;
int localY = blockY & 15;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
for (int z = 0; z < 16; z++) {
for (int x = 0; x < 16; x++) {
if (blocks.isAir(x, bufferY, z)) {
continue;
}
@@ -445,7 +446,7 @@ public final class IrisModdedChunkGenerator extends ChunkGenerator {
@Override
public int getSeaLevel() {
Engine current = engineOrNull();
return current == null ? 63 : current.getDimension().getFluidHeight();
return current == null ? 63 : current.getMinHeight() + current.getDimension().getFluidHeight();
}
@Override
@@ -471,25 +472,18 @@ public final class IrisModdedChunkGenerator extends ChunkGenerator {
Engine current = engineOrNull();
BlockState airState = Blocks.AIR.defaultBlockState();
if (current == null) {
for (int i = 0; i < states.length; i++) {
states[i] = airState;
}
Arrays.fill(states, airState);
return new NoiseColumn(minY, states);
}
int surface = current.getMinHeight() + current.getHeight(x, z, true);
int fluid = current.getDimension().getFluidHeight();
int fluid = current.getMinHeight() + current.getDimension().getFluidHeight();
BlockState stone = Blocks.STONE.defaultBlockState();
BlockState water = Blocks.WATER.defaultBlockState();
for (int i = 0; i < states.length; i++) {
int y = minY + i;
if (y <= surface) {
states[i] = stone;
} else if (y <= fluid) {
states[i] = water;
} else {
states[i] = airState;
}
}
int solidEnd = Math.max(0, Math.min(states.length, surface - minY + 1));
int fluidEnd = Math.max(solidEnd, Math.max(0, Math.min(states.length, fluid - minY + 1)));
Arrays.fill(states, 0, solidEnd, stone);
Arrays.fill(states, solidEnd, fluidEnd, water);
Arrays.fill(states, fluidEnd, states.length, airState);
return new NoiseColumn(minY, states);
}
@@ -77,6 +77,9 @@ public final class ModdedProtocolHandler {
transport = serverTransport;
protocolServer = protocol;
IrisServices.register(IrisProtocolServer.class, protocol);
if (server.getPlayerList() == null) {
return;
}
for (ServerPlayer player : server.getPlayerList().getPlayers()) {
sessionRegistry.register(new IrisSession(player.getUUID().toString(), serverTransport));
}
@@ -74,7 +74,7 @@ public final class ModdedGoldenHash {
engineMode,
true,
false,
"minecraft:plains");
GoldenHashEngine.FALLBACK_BIOME_KEY);
this.hashEngine = new GoldenHashEngine(engine, request, goldenDir, this::snapshot, feedback(), progress());
}
@@ -386,7 +386,7 @@ public final class ModdedObjectCommands {
IrisObjectPlacement placement = new IrisObjectPlacement();
placement.setRotation(IrisObjectRotation.of(0, rotation, 0));
ModdedObjectPlacer placer = new ModdedObjectPlacer(level);
ModdedObjectPlacer placer = new ModdedObjectPlacer(level, engine);
try {
object.place(target.getX(), target.getY() + object.getCenter().getY(), target.getZ(), placer, placement, new RNG(), null);
} catch (Throwable e) {
@@ -35,6 +35,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.Heightmap;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,14 +46,16 @@ final class ModdedObjectPlacer implements IObjectPlacer {
private static final Logger LOGGER = LoggerFactory.getLogger("Iris");
private final ServerLevel level;
private final Engine engine;
private final Map<BlockPos, BlockState> undo = new HashMap<>();
private int writes = 0;
private int nonAirWrites = 0;
private int skippedTiles = 0;
private int restoredTiles = 0;
ModdedObjectPlacer(ServerLevel level) {
ModdedObjectPlacer(ServerLevel level, @Nullable Engine engine) {
this.level = level;
this.engine = engine;
}
Map<BlockPos, BlockState> undoSnapshot() {
@@ -183,6 +186,6 @@ final class ModdedObjectPlacer implements IObjectPlacer {
@Override
public Engine getEngine() {
return null;
return engine;
}
}
@@ -186,6 +186,7 @@ public final class ModdedPregenMethod implements PregeneratorMethod {
listener.onChunkFailed(x, z);
return;
}
markCompleted();
listener.onChunkGenerated(x, z);
cleanupMantleChunk(x, z);
listener.onChunkCleaned(x, z);
@@ -236,6 +237,7 @@ public final class ModdedPregenMethod implements PregeneratorMethod {
return;
}
onSuccess();
markCompleted();
listener.onChunkGenerated(x, z);
cleanupMantleChunk(x, z);
listener.onChunkCleaned(x, z);
@@ -253,12 +255,15 @@ public final class ModdedPregenMethod implements PregeneratorMethod {
private void markFinished() {
inFlight.decrementAndGet();
completed.incrementAndGet();
synchronized (permitMonitor) {
permitMonitor.notifyAll();
}
}
private void markCompleted() {
completed.incrementAndGet();
}
private void onTimeout() {
if (timeoutStreak.incrementAndGet() % ADAPTIVE_TIMEOUT_STEP == 0) {
adjustAdaptiveLimit(-1);
@@ -161,6 +161,7 @@ public final class ModdedStructureCommands {
return 0;
}
ServerLevel level = source.getLevel();
Engine engine = IrisModdedCommands.engineFor(level);
IrisData data = dataFor(source);
if (data == null) {
return 0;
@@ -181,7 +182,7 @@ public final class ModdedStructureCommands {
IrisModdedCommands.fail(source, "Structure '" + key + "' assembled 0 pieces");
return 0;
}
ModdedObjectPlacer placer = new ModdedObjectPlacer(level);
ModdedObjectPlacer placer = new ModdedObjectPlacer(level, engine);
UUID owner = player.getUUID();
try {
for (PlacedStructurePiece piece : pieces) {
+2 -1
View File
@@ -31,6 +31,7 @@ file('../../gradle.properties').withInputStream { InputStream stream -> rootProp
String irisVersion = providers.gradleProperty('irisVersion').getOrElse(rootProperties.getProperty('irisVersion', '4.0.0-26.2'))
String minecraftVersion = providers.gradleProperty('minecraftVersion').getOrElse(rootProperties.getProperty('minecraftVersion', '26.2'))
String neoForgeVersion = providers.gradleProperty('neoForgeVersion').getOrElse(rootProperties.getProperty('neoForgeVersion', '26.2.0.6-beta'))
String volmLibCoordinate = providers.gradleProperty('volmLibCoordinate').getOrElse(rootProperties.getProperty('volmLibCoordinate', 'com.github.VolmitSoftware:VolmLib:cdf7e8bb880199734dacd386a6616bda799fcde1'))
Closure<String> irisArtifactName = { String platform, String targetVersion ->
return "Iris v${project.version} [${platform}] ${targetVersion}.jar"
}
@@ -103,7 +104,7 @@ dependencies {
List<Object> shared = [
"art.arcane:core:${irisVersion}".toString(),
"art.arcane:spi:${irisVersion}".toString(),
'com.github.VolmitSoftware:VolmLib:master-SNAPSHOT',
volmLibCoordinate,
libs.paralithic,
libs.lru,
libs.kotlin.stdlib,
@@ -35,8 +35,9 @@ public final class IrisNeoForgeClient {
private IrisNeoForgeClient() {
}
public static void registerClientbound(PayloadRegistrar registrar) {
registrar.playToClient(ModdedIrisPayload.TYPE, ModdedIrisPayload.STREAM_CODEC,
public static void registerBidirectional(PayloadRegistrar registrar) {
registrar.playBidirectional(ModdedIrisPayload.TYPE, ModdedIrisPayload.STREAM_CODEC,
NeoForgeProtocolNetworking::onInbound,
(payload, context) -> context.enqueueWork(() -> IrisClient.onInbound(payload.data())));
}
@@ -55,14 +55,14 @@ public final class NeoForgeProtocolNetworking {
private static void onRegisterPayloads(RegisterPayloadHandlersEvent event) {
PayloadRegistrar registrar = event.registrar("1").optional();
if (FMLEnvironment.getDist() == Dist.CLIENT) {
IrisNeoForgeClient.registerClientbound(registrar);
IrisNeoForgeClient.registerBidirectional(registrar);
} else {
registrar.playToClient(ModdedIrisPayload.TYPE, ModdedIrisPayload.STREAM_CODEC);
registrar.playBidirectional(ModdedIrisPayload.TYPE, ModdedIrisPayload.STREAM_CODEC,
NeoForgeProtocolNetworking::onInbound);
}
registrar.playToServer(ModdedIrisPayload.TYPE, ModdedIrisPayload.STREAM_CODEC, NeoForgeProtocolNetworking::onInbound);
}
private static void onInbound(ModdedIrisPayload payload, IPayloadContext context) {
static void onInbound(ModdedIrisPayload payload, IPayloadContext context) {
if (context.player() instanceof ServerPlayer player) {
ModdedProtocolHandler.onInbound(player, payload.data());
}