Cut dead and duplicate tooling found by the tooling audit

Map modes OBJECT_LOAD, DECORATOR_LOAD and LAYER_LOAD with BiomeMaxes and the
runtime and hotloader code that fed them; the placement scans in
Engine.getObjectPlacement and the PlacedObject.placement field nobody read;
Engine.hasObjectPlacement (find uses ModuleServices.objectPlacers); the object
section of /iris studio objects and the layer lines of /iris studio profile;
the package obfuscation, which wrote object names the exported JSON never used;
the modded packager and its command; the removed-field nags for fluidBodies,
surfaceOpeningClearance and caveProfile water fields; the IrisMod resource
family and the Gson reader only it needed; the test-only ObjectPlacements
helpers; WorldObjectPlacer; Interpolated.CAVE_RESULTS; DeserializationProbe.
This commit is contained in:
piexel committed 2026-10-28 03:29:56 +01:00
1 parent 3e8c22422f
commit 3022c54a43
63 files changed
+62 -871

No files matched your search

@@ -141,7 +141,6 @@ final class ModdedCommandHelp {
SECTIONS.put("o", SECTIONS.get("object"));
SECTIONS.put("studio", List.of(
Entry.command("create", "[name] [template]", ModdedHelpMessages.COMMAND_CREATE_CREATE_A_NEW_PACK_PROJECT, "+"),
Entry.command("package", "[pack]", ModdedHelpMessages.COMMAND_PACKAGE_PACKAGE_A_DIMENSION_INTO_A_COMPRESSED_FORMAT, "pkg"),
Entry.command("version", "[pack]", ModdedHelpMessages.COMMAND_VERSION_PRINT_A_PACK_VERSION),
Entry.command("regions", "[radius]", ModdedHelpMessages.COMMAND_REGIONS_CALCULATE_NEARBY_REGION_DISTRIBUTION),
Entry.command("open", "<pack> [seed]", ModdedHelpMessages.COMMAND_OPEN_OPEN_A_TEMPORARY_STUDIO_DIMENSION_FOR_A_PACK, "o"),
@@ -123,7 +123,7 @@ final class ModdedLocateCommands {
return 0;
}
String key = keyRaw.trim();
if (!engine.hasObjectPlacement(key)) {
if (ModuleServices.objectPlacers(engine, key).isEmpty()) {
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_IS_NOT_CONFIGURED_ANY_REGION_BIOME_OBJECT_PLACEMENTS_OBJECT_KEYS, MessageArgument.untrusted("key", key), MessageArgument.untrusted("value", engine.getData().getObjectLoader().getPossibleKeys().length)));
return 0;
}
@@ -25,21 +25,11 @@ import art.arcane.iris.core.gui.ImageMapStudioGUI;
import art.arcane.iris.core.gui.NoiseExplorerGUI;
import art.arcane.iris.core.gui.VisionGUI;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.pack.StructurePackageClosure;
import art.arcane.iris.core.pack.ImageMapPackageClosure;
import art.arcane.iris.core.pack.PackValidationResult;
import art.arcane.iris.core.pack.PackValidator;
import art.arcane.iris.core.project.IrisProjectCopier;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.placement.ObjectPlacements;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.engine.object.world.biome.IrisBiomeGeneratorLink;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.engine.object.terrain.IrisGenerator;
import art.arcane.iris.core.pack.ModuleResourceClosure;
import art.arcane.iris.core.pack.PackExportClosure;
import art.arcane.iris.engine.object.world.region.IrisRegion;
import art.arcane.iris.engine.object.structure.IrisStructure;
import art.arcane.iris.modded.ModdedDimensionManager;
import art.arcane.iris.modded.ModdedEngineBootstrap;
import art.arcane.iris.modded.ModdedScheduler;
@@ -48,9 +38,6 @@ import art.arcane.iris.util.common.parallel.BurstExecutor;
import art.arcane.iris.util.common.parallel.MultiBurst;
import art.arcane.volmlib.util.collection.KMap;
import art.arcane.volmlib.util.format.Form;
import art.arcane.volmlib.util.io.IO;
import art.arcane.volmlib.util.json.JSONObject;
import art.arcane.volmlib.util.math.M;
import art.arcane.volmlib.util.math.Spiraler;
import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.arguments.LongArgumentType;
@@ -65,13 +52,11 @@ import net.minecraft.commands.SharedSuggestionProvider;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import org.zeroturnaround.zip.ZipUtil;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -120,8 +105,6 @@ public final class ModdedStudioCommands {
root.then(createTree("create"));
root.then(createTree("+"));
root.then(packageTree("package"));
root.then(packageTree("pkg"));
root.then(Commands.literal("version")
.executes((CommandContext<CommandSourceStack> context) -> version(context.getSource(), null))
@@ -182,15 +165,6 @@ public final class ModdedStudioCommands {
StringArgumentType.getString(context, "template")))));
}
private static LiteralArgumentBuilder<CommandSourceStack> packageTree(String name) {
return Commands.literal(name)
.executes((CommandContext<CommandSourceStack> context) -> pkg(context.getSource(), null))
.then(Commands.argument("pack", StringArgumentType.word())
.suggests(IrisModdedCommands.PACK_NAMES)
.executes((CommandContext<CommandSourceStack> context) ->
pkg(context.getSource(), StringArgumentType.getString(context, "pack"))));
}
public static void clear() {
TRANSITIONS.clear();
STUDIOS.clear();
@@ -841,146 +815,6 @@ public final class ModdedStudioCommands {
return 1;
}
private static int pkg(CommandSourceStack source, String pack) {
File folder = resolvePack(source, pack);
if (folder == null) {
return 0;
}
MinecraftServer server = source.getServer();
String dimKey = folder.getName();
IrisModdedCommands.ok(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STUDIO_COMMANDS_PACKAGING_DIMENSION, MessageArgument.untrusted("dimKey", dimKey)));
Thread thread = new Thread(() -> {
try {
File result = compilePackage(folder, dimKey);
server.execute(() -> IrisModdedCommands.ok(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STUDIO_COMMANDS_PACKAGE_COMPILED, MessageArgument.untrusted("value", result.getAbsolutePath()))));
} catch (Throwable e) {
ModdedIrisLog.error("Iris package failed for {}", dimKey, e);
server.execute(() -> IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STUDIO_COMMANDS_PACKAGING_FAILED, MessageArgument.untrusted("value", e.getClass().getSimpleName()), MessageArgument.trusted("errorMessage", IrisLanguage.errorDetail(e)))));
}
}, "Iris Studio Package");
thread.setDaemon(true);
thread.start();
return 1;
}
private static File compilePackage(File packFolder, String dimKey) throws IOException {
PackValidationResult validation = PackValidator.validateForPackaging(packFolder);
if (!validation.isLoadable()) {
throw new IOException("Pack validation failed before packaging: "
+ String.join("; ", validation.getBlockingErrors()));
}
IrisData dm = IrisData.get(packFolder);
IrisDimension dimension = dm.getDimensionLoader().load(dimKey);
if (dimension == null) {
throw new IOException("Pack '" + dimKey + "' has no dimensions/" + dimKey + ".json");
}
File exports = ModdedEngineBootstrap.loader().configDir().resolve("irisworldgen").resolve("exports").toFile();
File folder = new File(exports, dimension.getLoadKey());
IO.delete(folder);
folder.mkdirs();
LinkedHashSet<String> regionKeys = new LinkedHashSet<>();
LinkedHashSet<String> biomeKeys = new LinkedHashSet<>();
LinkedHashSet<String> generatorKeys = new LinkedHashSet<>();
ModuleResourceClosure moduleResources = new ModuleResourceClosure(dm).exportingElsewhere(IrisStructure.class);
LinkedHashSet<String> objectKeys = new LinkedHashSet<>();
dimension.getAllRegions(() -> dm).forEach((IrisRegion region) -> {
if (region != null && region.getLoadKey() != null) {
regionKeys.add(region.getLoadKey());
}
});
dimension.getReachableBiomes(() -> dm).forEach((IrisBiome biome) -> {
if (biome != null && biome.getLoadKey() != null) {
biomeKeys.add(biome.getLoadKey());
}
});
moduleResources.followSettingsOf(dimension);
for (String regionKey : regionKeys) {
IrisRegion region = dm.getRegionLoader().load(regionKey);
if (region == null) {
continue;
}
region.getAllBiomes(() -> dm).forEach((IrisBiome biome) -> {
if (biome != null && biome.getLoadKey() != null) {
biomeKeys.add(biome.getLoadKey());
}
});
moduleResources.followSettingsOf(region);
moduleResources.follow(ObjectPlacements.all(region));
objectKeys.addAll(PackExportClosure.collectObjectKeys(ObjectPlacements.all(region)));
}
for (String biomeKey : biomeKeys) {
IrisBiome biome = dm.getBiomeLoader().load(biomeKey);
if (biome == null) {
continue;
}
biome.getGenerators().forEach((IrisBiomeGeneratorLink link) -> generatorKeys.add(link.getGenerator()));
moduleResources.followSettingsOf(biome);
moduleResources.follow(ObjectPlacements.all(biome));
objectKeys.addAll(PackExportClosure.collectObjectKeys(ObjectPlacements.all(biome)));
}
StringBuilder hashes = new StringBuilder();
List<String> structureKeys = moduleResources.keysOf(IrisStructure.class);
StructurePackageClosure structureClosure = StructurePackageClosure.collect(packFolder, structureKeys);
if (!structureClosure.isValid()) {
throw new IOException("Structure package closure is invalid: " + String.join("; ", structureClosure.errors()));
}
hashes.append(structureClosure.writeTo(folder, true));
hashes.append(ImageMapPackageClosure.writeAll(dm, folder, true));
for (String objectKey : objectKeys) {
try {
File objectFile = dm.getObjectLoader().findFile(objectKey);
IO.copyFile(objectFile, new File(folder, "objects/" + objectKey + ".iob"));
hashes.append(IO.hash(objectFile));
} catch (Throwable e) {
ModdedIrisLog.error("Iris package failed to copy object {}", objectKey, e);
}
}
hashes.append(copyJson(folder, "dimensions", dimension.getLoadKey(), dm.getDimensionLoader().findFile(dimension.getLoadKey())));
for (String key : generatorKeys) {
hashes.append(copyJson(folder, "generators", key, dm.getGeneratorLoader().findFile(key)));
}
for (String key : regionKeys) {
hashes.append(copyJson(folder, "regions", key, dm.getRegionLoader().findFile(key)));
}
for (String key : dm.getBlockLoader().getPossibleKeys()) {
hashes.append(copyJson(folder, "blocks", key, dm.getBlockLoader().findFile(key)));
}
for (String key : biomeKeys) {
hashes.append(copyJson(folder, "biomes", key, dm.getBiomeLoader().findFile(key)));
}
hashes.append(moduleResources.writeTo(folder, true));
JSONObject meta = new JSONObject();
meta.put("hash", IO.hash(hashes.toString()));
meta.put("time", M.ms());
meta.put("version", dimension.getVersion());
IO.writeAll(new File(folder, "package.json"), meta.toString(0));
File output = new File(exports, dimension.getLoadKey() + ".iris");
ZipUtil.pack(folder, output, 9);
IO.delete(folder);
return output;
}
private static String copyJson(File folder, String category, String key, File file) {
if (file == null || !file.isFile()) {
return "";
}
try {
String json = new JSONObject(IO.readAll(file)).toString(0);
IO.writeAll(new File(folder, category + "/" + key + ".json"), json);
return IO.hash(json);
} catch (Throwable e) {
ModdedIrisLog.error("Iris package failed to write {}/{}", category, key, e);
return "";
}
}
private static int regions(CommandSourceStack source, int radius) {
ServerPlayer player = source.getPlayer();
if (player == null) {
@@ -126,7 +126,7 @@ public final class ModdedVisionOverlay implements GuiOverlay {
}
IrisComplex complex = engine.getComplex();
File file = switch (type) {
case BIOME, LAYER_LOAD, DECORATOR_LOAD, OBJECT_LOAD, HEIGHT ->
case BIOME, HEIGHT ->
complex.getTrueBiomeStream().get(worldX, worldZ).openInVSCode();
case BIOME_LAND -> complex.getLandBiomeStream().get(worldX, worldZ).openInVSCode();
case BIOME_SEA -> complex.getSeaBiomeStream().get(worldX, worldZ).openInVSCode();
@@ -52,9 +52,6 @@ public class IrisModdedCommandParityTest {
child(edit, "b");
child(edit, "r");
child(edit, "d");
CommandNode<CommandSourceStack> studio = child(iris, "studio");
child(studio, "package");
child(studio, "pkg");
CommandNode<CommandSourceStack> download = child(iris, "download");
CommandNode<CommandSourceStack> source = child(download, "source");
@@ -145,7 +142,6 @@ public class IrisModdedCommandParityTest {
assertTrue(ModdedCommandHelp.documents("", "teleport"));
assertTrue(ModdedCommandHelp.documents("", "c"));
assertTrue(ModdedCommandHelp.documents("edit", "b"));
assertTrue(ModdedCommandHelp.documents("studio", "pkg"));
assertTrue(ModdedCommandHelp.documents("object", "we"));
assertTrue(ModdedCommandHelp.documents("world", "mainworld"));
assertTrue(ModdedCommandHelp.documents("goto", "unregistered"));