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

@@ -644,7 +644,7 @@ public class CommandFind implements DirectorExecutor {
}
}
if (e.hasObjectPlacement(object)) {
if (!ModuleServices.objectPlacers(e, object).isEmpty()) {
EngineBukkitOps.gotoObject(e, object, player(), teleport);
return;
}
@@ -18,8 +18,6 @@
package art.arcane.iris.core.commands;
import art.arcane.iris.builtin.objects.ObjectPlacement;
import art.arcane.iris.engine.object.placement.ObjectPlacements;
import art.arcane.iris.Iris;
import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.IrisSettings;
@@ -38,20 +36,17 @@ import art.arcane.iris.core.structure.StructureImporter;
import art.arcane.iris.core.tools.IrisToolbelt;
import art.arcane.iris.engine.framework.Engine;
import art.arcane.iris.engine.object.world.biome.IrisBiome;
import art.arcane.iris.core.modules.IrisValues;
import art.arcane.iris.engine.object.world.dimension.IrisDimension;
import art.arcane.iris.engine.platform.BukkitEntitySpawner;
import art.arcane.iris.engine.object.terrain.IrisGenerator;
import art.arcane.iris.engine.object.noise.IrisInterpolator;
import art.arcane.iris.engine.object.noise.IrisNoiseGenerator;
import art.arcane.iris.engine.object.prefab.IrisObject;
import art.arcane.iris.engine.object.world.region.IrisRegion;
import art.arcane.iris.engine.object.noise.NoiseStyle;
import art.arcane.iris.engine.platform.EngineBukkitOps;
import art.arcane.iris.engine.platform.PlatformChunkGenerator;
import art.arcane.volmlib.util.collection.KList;
import art.arcane.volmlib.util.collection.KMap;
import art.arcane.volmlib.util.collection.KSet;
import art.arcane.iris.util.common.director.DirectorExecutor;
import art.arcane.iris.util.common.director.handlers.DimensionHandler;
import art.arcane.iris.util.common.director.specialhandlers.NullableDimensionHandler;
@@ -423,12 +418,10 @@ public class CommandStudio implements DirectorExecutor {
public void pkg(
@Param(name = "dimension", description = "The dimension pack to compress", descriptionKey = "iris.director.commandstudio.param.dimension_pack_compress", contextual = true, contextualOverride = true, defaultValue = "default", customHandler = DimensionHandler.class)
IrisDimension dimension,
@Param(name = "obfuscate", description = "Whether or not to obfuscate the pack", descriptionKey = "iris.director.commandstudio.param.whether_not_obfuscate_pack", defaultValue = "false")
boolean obfuscate,
@Param(name = "minify", description = "Whether or not to minify the pack", descriptionKey = "iris.director.commandstudio.param.whether_not_minify_pack", defaultValue = "true")
boolean minify
) {
Iris.service(StudioSVC.class).compilePackage(sender(), dimension.getLoadKey(), obfuscate, minify);
Iris.service(StudioSVC.class).compilePackage(sender(), dimension.getLoadKey(), minify);
}
@Director(description = "Profiles the performance of a dimension", descriptionKey = "iris.director.commandstudio.director.profiles_performance_dimension", origin = DirectorOrigin.PLAYER)
@@ -554,13 +547,6 @@ public class CommandStudio implements DirectorExecutor {
IrisBiome b = data.getBiomeLoader().load(i);
double score = 0;
int m = 0;
for (NoiseStyle layerStyle : IrisValues.layerStyles(b)) {
m++;
score += styleTimings.get(layerStyle);
vv.add("Palette Layer " + m + ": " + styleTimings.get(layerStyle));
}
score += styleTimings.get(b.getBiomeStyle().getStyle());
vv.add("Biome Style: " + styleTimings.get(b.getBiomeStyle().getStyle()));
score += styleTimings.get(b.getChildStyle().getStyle());
@@ -796,7 +782,6 @@ public class CommandStudio implements DirectorExecutor {
KList<String> biomes = new KList<>();
KList<String> caveBiomes = new KList<>();
KMap<String, KMap<String, KList<String>>> objects = new KMap<>();
for (Chunk i : chunks) {
for (int j = 0; j < 16; j += 3) {
@@ -808,8 +793,6 @@ public class CommandStudio implements DirectorExecutor {
IrisBiome bxf = engine().getCaveBiome((i.getX() * 16) + j, (i.getZ() * 16) + k);
biomes.addIfMissing(bb.getName() + " [" + Form.capitalize(bb.getInferredType().name().toLowerCase()) + "] " + " (" + bb.getLoadFile().getName() + ")");
caveBiomes.addIfMissing(bxf.getName() + " (" + bxf.getLoadFile().getName() + ")");
exportObjects(bb, pw, engine(), objects);
exportObjects(bxf, pw, engine(), objects);
}
}
}
@@ -834,59 +817,12 @@ public class CommandStudio implements DirectorExecutor {
}
pw.println();
pw.println("== Object Info ==");
for (String i : objects.k()) {
pw.println("- " + i);
for (String j : objects.get(i).k()) {
pw.println(" @ " + j);
for (String k : objects.get(i).get(j)) {
pw.println(" * " + k);
}
}
}
pw.println();
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_REPORTED, MessageArgument.untrusted("value", ff.getPath())));
} catch (Throwable e) {
Iris.reportError(e);
}
}
private void exportObjects(IrisBiome bb, PrintWriter pw, Engine g, KMap<String, KMap<String, KList<String>>> objects) {
String n1 = bb.getName() + " [" + Form.capitalize(bb.getInferredType().name().toLowerCase()) + "] " + " (" + bb.getLoadFile().getName() + ")";
int m = 0;
KSet<String> stop = new KSet<>();
for (ObjectPlacement f : ObjectPlacements.all(bb)) {
m++;
String n2 = "Placement #" + m + " (" + f.place().size() + " possible objects)";
for (String i : f.place()) {
String nn3 = i + ": [ERROR] Failed to find object!";
try {
if (stop.contains(i)) {
continue;
}
File ff = g.getData().getObjectLoader().findFile(i);
art.arcane.volmlib.util.math.IrisBlockVector sz = IrisObject.sampleSize(ff);
nn3 = i + ": size=[" + sz.getBlockX() + "," + sz.getBlockY() + "," + sz.getBlockZ() + "] location=[" + ff.getPath() + "]";
stop.add(i);
} catch (Throwable e) {
Iris.reportError(e);
}
String n3 = nn3;
objects.computeIfAbsent(n1, (k1) -> new KMap<>())
.computeIfAbsent(n2, (k) -> new KList<>()).addIfMissing(n3);
}
}
}
/**
* @return true if server GUIs are not enabled
*/
@@ -318,7 +318,7 @@ public final class BukkitVisionOverlay implements GuiOverlay {
public String openInEditor(double worldX, double worldZ, RenderType type) {
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();
@@ -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"));