mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 08:14:45 +00:00
Show each Iris world's own seed and persisted chunk count in the modded listing
/iris worlds, /iris info and /iris seed printed the server level seed and a per-session chunk counter. They now read the engine's world seed and persisted chunk total, and each row is labeled by its own dimension id. Upstream:0c9ae9ed49a241b85c
This commit is contained in:
1 parent
149a257a4c
commit
898148fade
2 files changed
+76
-15
No files matched your search
+22
-15
@@ -294,20 +294,7 @@ public final class IrisModdedCommands {
|
||||
&& !irisGenerator.dimensionKey().contains(filter)) {
|
||||
continue;
|
||||
}
|
||||
Engine engine = irisGenerator.engineIfBound();
|
||||
if (engine == null) {
|
||||
lines.add(irisIdentity + ": pack=" + irisGenerator.dimensionKey()
|
||||
+ " world=" + dimensionId + " (engine not started yet)");
|
||||
continue;
|
||||
}
|
||||
String featureStatus = irisGenerator.importedFeaturesStatus();
|
||||
lines.add(irisIdentity + ": pack=" + engine.getDimension().getLoadKey()
|
||||
+ " world=" + dimensionId
|
||||
+ (showSeed ? " seed=" + level.getSeed() : "")
|
||||
+ " height=" + engine.getMinHeight() + ".." + engine.getMaxHeight()
|
||||
+ " generated=" + engine.getGenerated()
|
||||
+ (featureStatus == null ? "" : " importedFeatures=" + featureStatus)
|
||||
+ " data=" + engine.getData().getDataFolder().getName());
|
||||
lines.add(worldRow(dimensionId, irisGenerator.dimensionKey(), irisGenerator.engineIfBound(), showSeed, irisGenerator.importedFeaturesStatus()));
|
||||
}
|
||||
ok(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_LOADED_DIMENSIONS_IRIS, MessageArgument.untrusted("total", total), MessageArgument.untrusted("iris", iris)));
|
||||
if (lines.isEmpty()) {
|
||||
@@ -324,6 +311,26 @@ public final class IrisModdedCommands {
|
||||
return 1;
|
||||
}
|
||||
|
||||
record WorldRow(String dimensionId, String packKey, long seed, int minHeight, int maxHeight, int generated, String dataName) {
|
||||
String format(boolean showSeed, String featureStatus) {
|
||||
return dimensionId + ": pack=" + packKey
|
||||
+ (showSeed ? " seed=" + seed : "")
|
||||
+ " height=" + minHeight + ".." + maxHeight
|
||||
+ " generated=" + generated
|
||||
+ (featureStatus == null ? "" : " importedFeatures=" + featureStatus)
|
||||
+ " data=" + dataName;
|
||||
}
|
||||
}
|
||||
|
||||
static String worldRow(String dimensionId, String dimensionKey, Engine engine, boolean showSeed, String featureStatus) {
|
||||
if (engine == null) {
|
||||
return dimensionId + ": pack=" + dimensionKey + " (engine not started yet)";
|
||||
}
|
||||
return new WorldRow(dimensionId, engine.getDimension().getLoadKey(), engine.getWorld().getRawWorldSeed(),
|
||||
engine.getMinHeight(), engine.getMaxHeight(), engine.getEngineData().getStatistics().getChunksGenerated(),
|
||||
engine.getData().getDataFolder().getName()).format(showSeed, featureStatus);
|
||||
}
|
||||
|
||||
static int seed(CommandSourceStack source) {
|
||||
ServerLevel level = source.getLevel();
|
||||
Engine engine = engineFor(level);
|
||||
@@ -331,7 +338,7 @@ public final class IrisModdedCommands {
|
||||
fail(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_THIS_DIMENSION_IS_NOT_GENERATED_BY_IRIS_14));
|
||||
return 0;
|
||||
}
|
||||
ok(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_WORLD_SEED, MessageArgument.untrusted("value", level.getSeed())));
|
||||
ok(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_WORLD_SEED, MessageArgument.untrusted("value", engine.getWorld().getRawWorldSeed())));
|
||||
ok(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_ENGINE_SEED_MIXED, MessageArgument.untrusted("value", engine.getSeedManager().getSeed()), MessageArgument.untrusted("value2", engine.getSeedManager().getFullMixedSeed())));
|
||||
return 1;
|
||||
}
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package art.arcane.iris.modded.command;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class IrisModdedWorldListingTest {
|
||||
private static final String ALPHA = "iris:alpha";
|
||||
private static final String BETA = "iris:beta";
|
||||
private static final long ALPHA_SEED = 424242L;
|
||||
private static final long BETA_SEED = -77L;
|
||||
private static final int ALPHA_CHUNKS = 1089;
|
||||
|
||||
@Test
|
||||
public void rowShowsTheIrisWorldSeedAndPersistedChunkCount() {
|
||||
String alpha = row(ALPHA, ALPHA_SEED, ALPHA_CHUNKS).format(true, null);
|
||||
String beta = row(BETA, BETA_SEED, 0).format(true, null);
|
||||
|
||||
assertTrue(alpha, alpha.startsWith(ALPHA + ": pack=overworld "));
|
||||
assertTrue(alpha, alpha.contains(" seed=424242 "));
|
||||
assertTrue(alpha, alpha.contains(" generated=1089 "));
|
||||
assertTrue(beta, beta.startsWith(BETA + ": pack=overworld "));
|
||||
assertTrue(beta, beta.contains(" seed=-77 "));
|
||||
assertTrue(beta, beta.contains(" generated=0 "));
|
||||
assertFalse(alpha, alpha.contains(" world="));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rowOmitsTheSeedWhenItIsNotShown() {
|
||||
String row = row(ALPHA, ALPHA_SEED, ALPHA_CHUNKS).format(false, null);
|
||||
|
||||
assertFalse(row, row.contains("seed="));
|
||||
assertTrue(row, row.contains(" generated=1089 "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rowAppendsImportedFeatureStatus() {
|
||||
String row = row(ALPHA, ALPHA_SEED, ALPHA_CHUNKS).format(true, "ready");
|
||||
|
||||
assertTrue(row, row.contains(" importedFeatures=ready "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rowForAnUnstartedEngineIsLabeledByItsDimension() {
|
||||
assertEquals("iris:gamma: pack=overworld:overworld (engine not started yet)",
|
||||
IrisModdedCommands.worldRow("iris:gamma", "overworld:overworld", null, true, null));
|
||||
}
|
||||
|
||||
private static IrisModdedCommands.WorldRow row(String dimensionId, long seed, int generated) {
|
||||
return new IrisModdedCommands.WorldRow(dimensionId, "overworld", seed, -64, 320, generated, "overworld");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user