mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-29 09:15:27 +00:00
Cut structure place commands, importvanilla structures and transform nags
Batch 9 stage 1 cuts S9, S10, S11 and S14: - /iris structure place (Bukkit and modded) is gone; placing an Iris structure in-world is studio tooling that moves with the module. - /iris studio importvanilla no longer takes structures; the structure import commands are the one entry point. - The rotation/translate/scale nag on structure placements is gone. A parse-only pass keeps reporting dimension, region and biome files that are not JSON. - Their message keys leave the catalog and every locale.
This commit is contained in:
1 parent
949157fd26
commit
d1a9c2c68b
30 files changed
+57
-530
No files matched your search
@@ -0,0 +1,47 @@
|
||||
package art.arcane.iris.core.pack;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PackValidatorHostFilesParseTest {
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
|
||||
@Test
|
||||
public void reportsEachDimensionRegionAndBiomeFileThatIsNotJson() throws Exception {
|
||||
File pack = temporaryFolder.newFolder("pack");
|
||||
write(pack, "dimensions/main.json", "{");
|
||||
write(pack, "regions/nested/region.json", "{\"landBiomes\":[\"biome\"]}");
|
||||
write(pack, "biomes/nested/biome.json", "not json");
|
||||
|
||||
List<String> errors = PackObjectSurfaceValidator.validateHostFilesParse(pack);
|
||||
|
||||
assertEquals(2, errors.size());
|
||||
assertTrue(errors.get(0), errors.get(0).startsWith("Dimension 'main' has invalid JSON: "));
|
||||
assertTrue(errors.get(1), errors.get(1).startsWith("Biome 'nested/biome' has invalid JSON: "));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void structureTransformFieldsAreNoLongerSpecialCased() throws Exception {
|
||||
File pack = temporaryFolder.newFolder("pack");
|
||||
write(pack, "dimensions/main.json", "{\"structures\":[{\"structures\":[\"test\"],\"rotation\":{}}]}");
|
||||
|
||||
assertTrue(PackObjectSurfaceValidator.validateHostFilesParse(pack).isEmpty());
|
||||
}
|
||||
|
||||
private void write(File root, String relative, String content) throws Exception {
|
||||
Path path = root.toPath().resolve(relative);
|
||||
Files.createDirectories(path.getParent());
|
||||
Files.writeString(path, content, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package art.arcane.iris.core.pack;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class PackValidatorStructureTransformTest {
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
|
||||
@Test
|
||||
public void reportsUnsupportedTransformsAcrossEveryStructureHost() throws Exception {
|
||||
File pack = temporaryFolder.newFolder("pack");
|
||||
write(pack, "dimensions/main.json", "{\"structures\":[{\"structures\":[\"test\"],\"rotation\":{}}]}");
|
||||
write(pack, "regions/nested/region.json", "{\"structures\":[{\"structures\":[\"test\"],\"translate\":{}}]}");
|
||||
write(pack, "biomes/nested/biome.json", "{\"structures\":[{\"structures\":[\"test\"],\"scale\":{}}]}");
|
||||
|
||||
List<String> errors = PackObjectSurfaceValidator.validateUnsupportedStructureTransforms(pack);
|
||||
|
||||
assertEquals(List.of(
|
||||
"Dimension 'main' structures[0] declares unsupported field 'rotation'. Structure placement transforms are not supported; remove the field.",
|
||||
"Region 'nested/region' structures[0] declares unsupported field 'translate'. Structure placement transforms are not supported; remove the field.",
|
||||
"Biome 'nested/biome' structures[0] declares unsupported field 'scale'. Structure placement transforms are not supported; remove the field."
|
||||
), errors);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ignoresTransformsOutsideStructurePlacementArrays() throws Exception {
|
||||
File pack = temporaryFolder.newFolder("pack");
|
||||
write(pack, "biomes/biome.json", "{\"objects\":[{\"rotation\":{},\"translate\":{},\"scale\":{}}],\"structures\":[{\"structures\":[\"test\"]}]}");
|
||||
|
||||
assertTrue(PackObjectSurfaceValidator.validateUnsupportedStructureTransforms(pack).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unsupportedTransformBlocksFullPackValidation() throws Exception {
|
||||
File pack = temporaryFolder.newFolder("pack");
|
||||
write(pack, "dimensions/main.json", "{\"regions\":[\"region\"],\"structures\":[{\"structures\":[\"test\"],\"rotation\":null}]}");
|
||||
write(pack, "regions/region.json", "{\"landBiomes\":[\"biome\"]}");
|
||||
write(pack, "biomes/biome.json", "{\"name\":\"Biome\"}");
|
||||
|
||||
PackValidationResult result = PackValidator.validate(pack);
|
||||
|
||||
assertFalse(result.isLoadable());
|
||||
assertTrue(result.getBlockingErrors().contains(
|
||||
"Dimension 'main' structures[0] declares unsupported field 'rotation'. Structure placement transforms are not supported; remove the field."));
|
||||
}
|
||||
|
||||
private void write(File root, String relative, String content) throws Exception {
|
||||
Path path = root.toPath().resolve(relative);
|
||||
Files.createDirectories(path.getParent());
|
||||
Files.writeString(path, content, StandardCharsets.UTF_8);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user