mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-25 21:40:05 +00:00
Labeled world rows by dimension
- /iris worlds and /iris info label each row with its own dimension key instead of the shared generator identity - Dropped the redundant world= field now that the row label carries the dimension key - Rows for worlds whose engine has not started use the same dimension key label - Listing tests assert per-world row labels, including an unstarted engine row
This commit is contained in:
2 files changed
+41
-10
No files matched your search
+2
-4
@@ -294,13 +294,11 @@ public final class IrisModdedCommands {
|
|||||||
}
|
}
|
||||||
Engine engine = irisGenerator.engineIfBound();
|
Engine engine = irisGenerator.engineIfBound();
|
||||||
if (engine == null) {
|
if (engine == null) {
|
||||||
lines.add(irisIdentity + ": pack=" + irisGenerator.dimensionKey()
|
lines.add(dimensionId + ": pack=" + irisGenerator.dimensionKey() + " (engine not started yet)");
|
||||||
+ " world=" + dimensionId + " (engine not started yet)");
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String featureStatus = irisGenerator.importedFeaturesStatus();
|
String featureStatus = irisGenerator.importedFeaturesStatus();
|
||||||
lines.add(irisIdentity + ": pack=" + engine.getDimension().getLoadKey()
|
lines.add(dimensionId + ": pack=" + engine.getDimension().getLoadKey()
|
||||||
+ " world=" + dimensionId
|
|
||||||
+ (showSeed ? " seed=" + engine.getWorld().getRawWorldSeed() : "")
|
+ (showSeed ? " seed=" + engine.getWorld().getRawWorldSeed() : "")
|
||||||
+ " height=" + engine.getMinHeight() + ".." + engine.getMaxHeight()
|
+ " height=" + engine.getMinHeight() + ".." + engine.getMaxHeight()
|
||||||
+ " generated=" + engine.getEngineData().getStatistics().getChunksGenerated()
|
+ " generated=" + engine.getEngineData().getStatistics().getChunksGenerated()
|
||||||
|
|||||||
+39
-6
@@ -67,8 +67,8 @@ public class IrisModdedWorldListingTest {
|
|||||||
assertEquals(1, IrisModdedCommands.info(source, null));
|
assertEquals(1, IrisModdedCommands.info(source, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
String alphaRow = row(output, "world=iris:alpha");
|
String alphaRow = row(output, "iris:alpha");
|
||||||
String betaRow = row(output, "world=iris:beta");
|
String betaRow = row(output, "iris:beta");
|
||||||
assertTrue(alphaRow, alphaRow.contains(" seed=424242 "));
|
assertTrue(alphaRow, alphaRow.contains(" seed=424242 "));
|
||||||
assertTrue(alphaRow, alphaRow.contains(" generated=1089 "));
|
assertTrue(alphaRow, alphaRow.contains(" generated=1089 "));
|
||||||
assertTrue(betaRow, betaRow.contains(" seed=-77 "));
|
assertTrue(betaRow, betaRow.contains(" seed=-77 "));
|
||||||
@@ -78,6 +78,39 @@ public class IrisModdedWorldListingTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void worldsLabelsEachRowWithItsOwnWorldKey() {
|
||||||
|
NativeWorld alpha = level("iris:alpha");
|
||||||
|
NativeWorld beta = level("iris:beta");
|
||||||
|
NativeWorld gamma = level("iris:gamma");
|
||||||
|
NativeModdedServer server = mock(NativeModdedServer.class);
|
||||||
|
when(server.worlds()).thenReturn(List.of(alpha, beta, gamma));
|
||||||
|
List<String> output = new ArrayList<>();
|
||||||
|
NativeCommandSource source = source(server, null, true, output);
|
||||||
|
IrisModdedChunkGenerator alphaGenerator = generator("overworld:overworld", engine(424242L, 1089));
|
||||||
|
IrisModdedChunkGenerator betaGenerator = generator("overworld:overworld", engine(-77L, 0));
|
||||||
|
IrisModdedChunkGenerator gammaGenerator = generator("overworld:overworld", null);
|
||||||
|
|
||||||
|
try (MockedStatic<NativeWorldGenerators> generators = mockStatic(NativeWorldGenerators.class)) {
|
||||||
|
generators.when(() -> NativeWorldGenerators.find(alpha, IrisModdedChunkGenerator.class))
|
||||||
|
.thenReturn(alphaGenerator);
|
||||||
|
generators.when(() -> NativeWorldGenerators.find(beta, IrisModdedChunkGenerator.class))
|
||||||
|
.thenReturn(betaGenerator);
|
||||||
|
generators.when(() -> NativeWorldGenerators.find(gamma, IrisModdedChunkGenerator.class))
|
||||||
|
.thenReturn(gammaGenerator);
|
||||||
|
|
||||||
|
assertEquals(1, IrisModdedCommands.info(source, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
assertTrue(row(output, "iris:alpha").startsWith("iris:alpha: pack=overworld "));
|
||||||
|
assertTrue(row(output, "iris:beta").startsWith("iris:beta: pack=overworld "));
|
||||||
|
assertEquals("iris:gamma: pack=overworld:overworld (engine not started yet)", row(output, "iris:gamma"));
|
||||||
|
for (String line : output) {
|
||||||
|
assertFalse(line, line.startsWith("iris:overworld"));
|
||||||
|
assertFalse(line, line.contains(" world="));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void worldsOmitsTheSeedForPlayersBelowGamemaster() {
|
public void worldsOmitsTheSeedForPlayersBelowGamemaster() {
|
||||||
NativeWorld alpha = level("iris:alpha");
|
NativeWorld alpha = level("iris:alpha");
|
||||||
@@ -94,7 +127,7 @@ public class IrisModdedWorldListingTest {
|
|||||||
assertEquals(1, IrisModdedCommands.info(source, null));
|
assertEquals(1, IrisModdedCommands.info(source, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
String alphaRow = row(output, "world=iris:alpha");
|
String alphaRow = row(output, "iris:alpha");
|
||||||
assertFalse(alphaRow, alphaRow.contains("seed="));
|
assertFalse(alphaRow, alphaRow.contains("seed="));
|
||||||
assertTrue(alphaRow, alphaRow.contains(" generated=1089 "));
|
assertTrue(alphaRow, alphaRow.contains(" generated=1089 "));
|
||||||
}
|
}
|
||||||
@@ -170,12 +203,12 @@ public class IrisModdedWorldListingTest {
|
|||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String row(List<String> output, String marker) {
|
private static String row(List<String> output, String label) {
|
||||||
for (String line : output) {
|
for (String line : output) {
|
||||||
if (line.contains(marker + " ")) {
|
if (line.startsWith(label + ": ")) {
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
throw new AssertionError("No row containing '" + marker + "' in " + output);
|
throw new AssertionError("No row labeled '" + label + "' in " + output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user