mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-08-27 04:37:47 +00:00
dwa
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
[10:47:09] [Test worker/INFO]: [STDERR]: [Iris/WARN] Native structure terrain envelope at 0,0 was clipped to Minecraft's 8-chunk structure reference range
|
||||
[10:47:09] [Test worker/INFO]: [STDERR]: [Iris/WARN] Native structure burial at 0,0 clamped to world floor: wanted -19, used -4
|
||||
[10:47:09] [Test worker/INFO]: [STDERR]: [Iris/WARN] Native structure burial at 0,0 clamped to world floor: wanted -5, used -2
|
||||
@@ -975,8 +975,7 @@ public class CommandIris implements DirectorExecutor {
|
||||
try {
|
||||
IrisData data = IrisData.get(pack);
|
||||
for (String key : data.getDimensionLoader().getPossibleKeys()) {
|
||||
options.add(key);
|
||||
options.add(pack.getName() + ":" + key);
|
||||
options.add(packDimensionOption(pack.getName(), key));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Iris.warn("Failed to read dimension keys from pack %s: %s%s",
|
||||
@@ -990,6 +989,12 @@ public class CommandIris implements DirectorExecutor {
|
||||
return new KList<>(options);
|
||||
}
|
||||
|
||||
static String packDimensionOption(String packName, String dimensionKey) {
|
||||
return packName.equalsIgnoreCase(dimensionKey)
|
||||
? packName
|
||||
: packName + ":" + dimensionKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(String value) {
|
||||
return value == null ? "" : value;
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package art.arcane.iris.core.commands;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class CommandIrisPackDimensionTypeHandlerTest {
|
||||
@Test
|
||||
public void matchingPackAndDimensionUsesBarePackName() {
|
||||
assertEquals("overworld",
|
||||
CommandIris.PackDimensionTypeHandler.packDimensionOption("overworld", "overworld"));
|
||||
assertEquals("OverWorld",
|
||||
CommandIris.PackDimensionTypeHandler.packDimensionOption("OverWorld", "overworld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void differingDimensionUsesExplicitPackReference() {
|
||||
assertEquals("custom_pack:dimensions/sky",
|
||||
CommandIris.PackDimensionTypeHandler.packDimensionOption("custom_pack", "dimensions/sky"));
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,9 @@ public class IrisToolbelt {
|
||||
}
|
||||
String pack = requested.substring(0, separator).trim();
|
||||
String dimension = requested.substring(separator + 1).trim();
|
||||
if (!isSafePackDescriptor(pack) || !isSafeDimensionKey(dimension)) {
|
||||
if (!isSafePackDescriptor(pack)
|
||||
|| !isSafeDimensionKey(dimension)
|
||||
|| pack.equalsIgnoreCase(dimension)) {
|
||||
return null;
|
||||
}
|
||||
return new PackReference(pack, dimension, true);
|
||||
|
||||
@@ -37,6 +37,12 @@ public class IrisToolbeltPackReferenceTest {
|
||||
assertTrue(reference.explicitDimension());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void redundantExplicitDimensionIsRejected() {
|
||||
assertNull(IrisToolbelt.parsePackReference("overworld:overworld"));
|
||||
assertNull(IrisToolbelt.parsePackReference("OverWorld:overworld"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void repositoryShorthandUsesRepositoryAsDefaultDimension() {
|
||||
IrisToolbelt.PackReference reference = IrisToolbelt.parsePackReference("IrisDimensions/overworld/stable");
|
||||
|
||||
Reference in New Issue
Block a user