mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-25 13:30:08 +00:00
Merged 1.21.1 mod targets
- Merge feature/modded-versions into the modded fix integration - Take loader pins from gradle/mod-targets.json for every target - Pin the 26.3 NeoForge target to 26.3.0.83
This commit is contained in:
commit
b8aa00b70e
58 files changed
+3279
-133
No files matched your search
+39
-4
@@ -1,4 +1,5 @@
|
||||
import io.github.slimjar.resolver.data.Mirror
|
||||
import org.gradle.api.attributes.java.TargetJvmVersion
|
||||
import org.gradle.api.file.FileTreeElement
|
||||
import org.gradle.api.tasks.Copy
|
||||
import org.gradle.api.tasks.TaskProvider
|
||||
@@ -197,6 +198,11 @@ slimJar {
|
||||
}
|
||||
|
||||
def embeddedAgentJar = project(':core:agent').tasks.named('jar', Jar)
|
||||
tasks.named('processResources').configure {
|
||||
from(embeddedAgentJar.map { it.archiveFile }) {
|
||||
rename { String ignored -> 'agent.jar' }
|
||||
}
|
||||
}
|
||||
def templateSource = file('src/main/templates')
|
||||
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
|
||||
def generateTemplates = tasks.register('generateTemplates', Copy) {
|
||||
@@ -263,7 +269,35 @@ tasks.named('compileJava', JavaCompile).configure {
|
||||
tasks.named('test', Test).configure {
|
||||
jvmArgs('--add-modules', 'jdk.incubator.vector')
|
||||
dependsOn(languageSourceManifestTask)
|
||||
classpath = files(layout.buildDirectory.dir('generated/language-source')) + files('src/main/resources') + sourceSets.main.output + classpath
|
||||
classpath = (files(layout.buildDirectory.dir('generated/language-source')) + files('src/main/resources')
|
||||
+ sourceSets.main.output + classpath) - files(tasks.named('shadowJar'))
|
||||
}
|
||||
|
||||
if (providers.gradleProperty('irisRuntimeJava').getOrElse(rootProject.irisModTarget.java.toString()) == '21') {
|
||||
configurations.configureEach {
|
||||
if (name == 'compileClasspath' || name.endsWith('CompileClasspath')
|
||||
|| name in ['testRuntimeClasspath', 'externalProviderTestRuntimeClasspath']) {
|
||||
attributes.attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 25)
|
||||
}
|
||||
}
|
||||
tasks.register('java21RuntimeTest', Test) {
|
||||
group = 'verification'
|
||||
description = 'Verifies generation kernels and pack updates on the Minecraft 1.21.1 Java runtime.'
|
||||
testClassesDirs = sourceSets.test.output.classesDirs
|
||||
classpath = (files(layout.buildDirectory.dir('generated/language-source')) + files('src/main/resources')
|
||||
+ sourceSets.main.output + sourceSets.test.runtimeClasspath) - files(tasks.named('shadowJar'))
|
||||
javaLauncher.set(javaToolchains.launcherFor {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
})
|
||||
jvmArgs('--add-modules', 'jdk.incubator.vector')
|
||||
filter {
|
||||
includeTestsMatching('art.arcane.iris.generation.simd.*')
|
||||
includeTestsMatching('art.arcane.iris.pack.BuiltInPackUpdatesTest')
|
||||
}
|
||||
}
|
||||
tasks.named('check').configure {
|
||||
dependsOn('java21RuntimeTest')
|
||||
}
|
||||
}
|
||||
|
||||
configurations.matching { it.name.startsWith('slim') }.all { }
|
||||
@@ -417,6 +451,10 @@ tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.Shadow
|
||||
inputs.property('languageTomlSupportClassPattern', languageTomlSupportClassPattern)
|
||||
dependsOn(embeddedAgentJar)
|
||||
mergeServiceFiles()
|
||||
if (providers.gradleProperty('irisRuntimeJava').getOrElse(rootProject.irisModTarget.java.toString()) == '21') {
|
||||
exclude('art/arcane/volmlib/util/noise/NativeBillowLoader*.class')
|
||||
exclude('art/arcane/volmlib/util/noise/BillowBatch*.class')
|
||||
}
|
||||
// minimize() stays off. Caffeine reaches its 520 generated cache and node classes through
|
||||
// MethodHandles.Lookup.findClass on a computed name, and the VolmLib command, GUI and hotload
|
||||
// surfaces are only referenced from :adapters:bukkit:plugin, which is merged into the artifact
|
||||
@@ -434,9 +472,6 @@ tasks.named('shadowJar', com.github.jengelman.gradle.plugins.shadow.tasks.Shadow
|
||||
exclude(unusedVolmLibClassEntries)
|
||||
exclude(annotationOnlyArtifacts)
|
||||
exclude(dependencyBuildMetadata)
|
||||
from(embeddedAgentJar.map { it.archiveFile }) {
|
||||
rename { String ignored -> 'agent.jar' }
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.tasks.matching {
|
||||
|
||||
@@ -22,7 +22,6 @@ import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockState;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.Strictness;
|
||||
import art.arcane.iris.platform.bukkit.BukkitPlatform;
|
||||
import art.arcane.iris.platform.reflect.KeyedType;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
@@ -51,7 +50,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor(access = AccessLevel.PROTECTED)
|
||||
public class TileData implements Cloneable {
|
||||
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().setStrictness(Strictness.LENIENT).setObjectToNumberStrategy(com.google.gson.ToNumberPolicy.LONG_OR_DOUBLE).create();
|
||||
private static final Gson gson = new GsonBuilder().disableHtmlEscaping().setLenient().setObjectToNumberStrategy(com.google.gson.ToNumberPolicy.LONG_OR_DOUBLE).create();
|
||||
/**
|
||||
* Memoized {@link #resolveMaterial()}. Pasting one tile resolves its material at least twice
|
||||
* ({@link #isApplicable(BlockData)} then {@link #toBukkit(Block)}), and matchMaterial normalizes the string and
|
||||
|
||||
@@ -1360,11 +1360,12 @@ public class IrisDimension extends IrisRegistrant {
|
||||
"pack": {
|
||||
"description": "Iris Data Pack. This pack contains all installed Iris Packs' resources.",
|
||||
"pack_format": %d,
|
||||
"supported_formats": [%d, %d],
|
||||
"min_format": %d,
|
||||
"max_format": %d
|
||||
}
|
||||
}
|
||||
""".formatted(maxFormat, minFormat, maxFormat);
|
||||
""".formatted(maxFormat, minFormat, maxFormat, minFormat, maxFormat);
|
||||
|
||||
for (File datapackRoot : datapackRoots) {
|
||||
File mcm = new File(datapackRoot, "pack.mcmeta");
|
||||
|
||||
@@ -467,7 +467,7 @@ public class IrisRegion extends IrisRegistrant implements Rarity {
|
||||
}
|
||||
|
||||
/**
|
||||
* Cascade: a region that lost every land biome to the gate cannot generate, so it leaves the dimension's region
|
||||
* Cascade: a region that lost every biome in a declared surface pool cannot generate, so it leaves the dimension's region
|
||||
* pool too. Loading biomes here is safe - biomes never load regions.
|
||||
*/
|
||||
@Override
|
||||
@@ -489,17 +489,9 @@ public class IrisRegion extends IrisRegistrant implements Rarity {
|
||||
"structures[" + index + "].caveBiomes");
|
||||
}
|
||||
|
||||
if (getLandBiomes().isEmpty()) {
|
||||
return base;
|
||||
}
|
||||
|
||||
List<CompatFinding> drops = new ArrayList<>();
|
||||
|
||||
if (!resolvePool(() -> data, getLandBiomes(), "landBiomes", drops).isEmpty()) {
|
||||
return base;
|
||||
}
|
||||
|
||||
return CompatPools.cascade(data, base, drops, "region", getLoadKey(), "no land biomes remain");
|
||||
base = evaluateSurfacePoolCompat(data, base, getLandBiomes(), "land");
|
||||
base = evaluateSurfacePoolCompat(data, base, getSeaBiomes(), "sea");
|
||||
return evaluateSurfacePoolCompat(data, base, getShoreBiomes(), "shore");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -511,4 +503,17 @@ public class IrisRegion extends IrisRegistrant implements Rarity {
|
||||
public String getTypeName() {
|
||||
return "Region";
|
||||
}
|
||||
|
||||
private CompatStatus evaluateSurfacePoolCompat(IrisData data, CompatStatus base, KList<String> keys, String role) {
|
||||
if (base.excluded() || keys.isEmpty()) {
|
||||
return base;
|
||||
}
|
||||
|
||||
List<CompatFinding> drops = new ArrayList<>();
|
||||
if (!resolvePool(() -> data, keys, role + "Biomes", drops).isEmpty()) {
|
||||
return base;
|
||||
}
|
||||
|
||||
return CompatPools.cascade(data, base, drops, "region", getLoadKey(), "no " + role + " biomes remain");
|
||||
}
|
||||
}
|
||||
@@ -4,16 +4,20 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.time.Duration;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionStage;
|
||||
import java.util.concurrent.Flow;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -48,7 +52,7 @@ public final class BuiltInPackUpdates {
|
||||
.GET()
|
||||
.build();
|
||||
CompletableFuture<HttpResponse<String>> response = client.sendAsync(request,
|
||||
HttpResponse.BodyHandlers.limiting(HttpResponse.BodyHandlers.ofString(), 1024L * 1024L));
|
||||
info -> new ReleaseBodySubscriber(HttpResponse.BodyHandlers.ofString().apply(info)));
|
||||
requests.put(pack, response.copy().orTimeout(REQUEST_TIMEOUT.toMillis(), TimeUnit.MILLISECONDS)
|
||||
.whenComplete((result, error) -> {
|
||||
if (error != null) {
|
||||
@@ -109,4 +113,58 @@ public final class BuiltInPackUpdates {
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ReleaseBodySubscriber implements HttpResponse.BodySubscriber<String> {
|
||||
private final HttpResponse.BodySubscriber<String> body;
|
||||
private Flow.Subscription subscription;
|
||||
private int remaining = 1024 * 1024;
|
||||
private boolean complete;
|
||||
|
||||
private ReleaseBodySubscriber(HttpResponse.BodySubscriber<String> body) {
|
||||
this.body = body;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletionStage<String> getBody() {
|
||||
return body.getBody();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Flow.Subscription subscription) {
|
||||
this.subscription = subscription;
|
||||
body.onSubscribe(subscription);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(List<ByteBuffer> buffers) {
|
||||
if (complete) {
|
||||
return;
|
||||
}
|
||||
for (ByteBuffer buffer : buffers) {
|
||||
if (buffer.remaining() > remaining) {
|
||||
subscription.cancel();
|
||||
onError(new IOException("Release metadata exceeds 1 MiB"));
|
||||
return;
|
||||
}
|
||||
remaining -= buffer.remaining();
|
||||
}
|
||||
body.onNext(buffers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable error) {
|
||||
if (!complete) {
|
||||
complete = true;
|
||||
body.onError(error);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
if (!complete) {
|
||||
complete = true;
|
||||
body.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package art.arcane.iris.pack.datapack;
|
||||
|
||||
import art.arcane.iris.spi.IrisPlatforms;
|
||||
import art.arcane.iris.pack.datapack.v1217.DataFixerV1217;
|
||||
import art.arcane.iris.pack.datapack.v1206.DataFixerV1206;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
@@ -13,6 +14,7 @@ import art.arcane.iris.pack.datapack.v263.DataFixerV263;
|
||||
@Getter
|
||||
public enum DataVersion {
|
||||
UNSUPPORTED("0.0.0", 0, () -> null),
|
||||
V1_21_1("1.21.1", 48, DataFixerV1206::new),
|
||||
V26_1_2("26.1.2", 101, DataFixerV1217::new),
|
||||
V26_2("26.2", 107, DataFixerV1217::new),
|
||||
V26_3("26.3", 121, DataFixerV263::new);
|
||||
@@ -41,6 +43,7 @@ public enum DataVersion {
|
||||
return UNSUPPORTED;
|
||||
}
|
||||
return switch (version) {
|
||||
case "1.21.1" -> V1_21_1;
|
||||
case "26.1.2" -> V26_1_2;
|
||||
case "26.2", "26.2.0" -> V26_2;
|
||||
case "26.3", "26.3.0" -> V26_3;
|
||||
|
||||
@@ -25,7 +25,6 @@ import com.google.gson.ExclusionStrategy;
|
||||
import com.google.gson.FieldAttributes;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.Strictness;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.TypeAdapterFactory;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
@@ -676,7 +675,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||
builder = new GsonBuilder()
|
||||
.addDeserializationExclusionStrategy(this)
|
||||
.addSerializationExclusionStrategy(this)
|
||||
.setStrictness(Strictness.LENIENT)
|
||||
.setLenient()
|
||||
.registerTypeAdapterFactory(this)
|
||||
.registerTypeAdapter(MantleFlag.class, new MantleFlagAdapter())
|
||||
.setPrettyPrinting();
|
||||
@@ -718,7 +717,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||
builder = new GsonBuilder()
|
||||
.addDeserializationExclusionStrategy(this)
|
||||
.addSerializationExclusionStrategy(this)
|
||||
.setStrictness(Strictness.LENIENT)
|
||||
.setLenient()
|
||||
.registerTypeAdapterFactory(this)
|
||||
.registerTypeAdapter(MantleFlag.class, new MantleFlagAdapter())
|
||||
.setPrettyPrinting();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package art.arcane.iris.structure.export;
|
||||
|
||||
import art.arcane.iris.structure.graph.CompiledStructureGraph;
|
||||
import art.arcane.iris.pack.datapack.DataVersion;
|
||||
import art.arcane.iris.structure.graph.PlanarJigsawWorkcellResolver;
|
||||
import art.arcane.iris.structure.graph.StructureGraphCompilation;
|
||||
import art.arcane.iris.structure.graph.StructureGraphCompiler;
|
||||
@@ -214,6 +215,12 @@ final class VanillaJigsawExportCompiler {
|
||||
"Minecraft jigsaw size must be within 0..20; Iris export requires 1..20.");
|
||||
}
|
||||
long horizontalDistance = (long) structure.getMaxSizeChunks() * 16L;
|
||||
if (DataVersion.getRuntime() == DataVersion.V1_21_1 && horizontalDistance != settings.maxDistanceVertical()) {
|
||||
addError(diagnostics,
|
||||
VanillaJigsawExportDiagnostic.Code.INVALID_MAX_DISTANCE,
|
||||
"max_distance_from_center.vertical",
|
||||
"Minecraft 1.21.1 vanilla export requires equal horizontal and vertical maximum distances.");
|
||||
}
|
||||
if (horizontalDistance < 1L || horizontalDistance > MAX_HORIZONTAL_DISTANCE) {
|
||||
addError(diagnostics,
|
||||
VanillaJigsawExportDiagnostic.Code.INVALID_MAX_DISTANCE,
|
||||
@@ -576,6 +583,12 @@ final class VanillaJigsawExportCompiler {
|
||||
private JsonObject packMetadata(VanillaJigsawExportRequest request) {
|
||||
JsonObject pack = new JsonObject();
|
||||
pack.addProperty("description", request.description());
|
||||
if (DataVersion.getRuntime() == DataVersion.V1_21_1) {
|
||||
pack.addProperty("pack_format", DataVersion.V1_21_1.getPackFormat());
|
||||
JsonObject root = new JsonObject();
|
||||
root.add("pack", pack);
|
||||
return root;
|
||||
}
|
||||
JsonArray minimum = new JsonArray();
|
||||
boolean current = VanillaStructureTemplateEncoder.targets263();
|
||||
int packFormat = current ? 121 : 107;
|
||||
|
||||
+2
-1
@@ -61,7 +61,8 @@ final class VanillaStructureTemplateEncoder {
|
||||
root.put("palette", palette(paletteStates, format));
|
||||
root.put("blocks", blocks(orderedBlocks, paletteIndexes));
|
||||
root.put("entities", new ListTag<>(CompoundTag.class));
|
||||
root.putInt("DataVersion", lowercase ? 5023 : DATA_VERSION_26_2);
|
||||
root.putInt("DataVersion", "1.21.1".equals(IrisPlatforms.get().minecraftVersion())
|
||||
? 3955 : lowercase ? 5023 : DATA_VERSION_26_2);
|
||||
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
NBTUtil.write(new NamedTag("", root), output, true);
|
||||
|
||||
@@ -7,8 +7,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.Strictness;
|
||||
import art.arcane.volmlib.util.json.StrictJsonReader;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
|
||||
@@ -229,9 +228,9 @@ public final class GenerationHistoryStore {
|
||||
throw new IOException("Generation manifest size changed while reading: " + manifestPath);
|
||||
}
|
||||
try (Reader input = new StringReader(new String(encoded, StandardCharsets.UTF_8));
|
||||
JsonReader reader = new JsonReader(input)) {
|
||||
reader.setStrictness(Strictness.STRICT);
|
||||
JsonElement parsed = JsonParser.parseReader(reader);
|
||||
JsonReader reader = new JsonReader(new StrictJsonReader(input))) {
|
||||
reader.setLenient(false);
|
||||
JsonElement parsed = GSON.getAdapter(JsonElement.class).read(reader);
|
||||
if (parsed == null || !parsed.isJsonObject()) {
|
||||
throw new IllegalArgumentException("Generation manifest must be a JSON object.");
|
||||
}
|
||||
@@ -314,9 +313,9 @@ public final class GenerationHistoryStore {
|
||||
if (Files.size(metadata) > MAX_MANIFEST_BYTES) {
|
||||
throw new IOException("Generation epoch metadata exceeds the supported size: " + metadata);
|
||||
}
|
||||
try (JsonReader reader = new JsonReader(Files.newBufferedReader(metadata, StandardCharsets.UTF_8))) {
|
||||
reader.setStrictness(Strictness.STRICT);
|
||||
JsonElement parsed = JsonParser.parseReader(reader);
|
||||
try (JsonReader reader = new JsonReader(new StrictJsonReader(Files.newBufferedReader(metadata, StandardCharsets.UTF_8)))) {
|
||||
reader.setLenient(false);
|
||||
JsonElement parsed = GSON.getAdapter(JsonElement.class).read(reader);
|
||||
if (!parsed.isJsonObject() || reader.peek() != JsonToken.END_DOCUMENT) {
|
||||
throw new IOException("Invalid generation epoch metadata: " + metadata);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import static art.arcane.iris.testsupport.PackCompatFixtures.find;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -132,6 +133,133 @@ public class IrisRegionCompatPoolTest {
|
||||
assertFalse(region.evaluateCompat(gate(report)).excluded());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evaluateCompatExcludesRegionWithNoShoreBiomesLeft() {
|
||||
PackCompatReport report = new PackCompatReport();
|
||||
IrisBiome plains = biome("land/plains");
|
||||
IrisBiome beach = PackCompatFixtures.exclude(biome("swamp/shore/beach"),
|
||||
CompatRegistry.BLOCK, "minecraft:firefly_bush");
|
||||
IrisData data = dataWith(report, plains, beach);
|
||||
IrisRegion region = PackCompatFixtures.region("swamp");
|
||||
region.setLoader(data);
|
||||
region.setLandBiomes(new KList<>("land/plains"));
|
||||
region.setShoreBiomes(new KList<>("swamp/shore/beach"));
|
||||
|
||||
CompatStatus status = region.evaluateCompat(gate(report));
|
||||
|
||||
assertTrue(status.excluded());
|
||||
assertSame(plains, region.getRealLandBiomes(() -> data).getFirst());
|
||||
CompatFinding cascade = find(report, CompatAction.EXCLUDED, "region", "swamp");
|
||||
assertNotNull(cascade);
|
||||
assertEquals("minecraft:firefly_bush", cascade.key());
|
||||
assertEquals("no shore biomes remain", cascade.detail());
|
||||
CompatFinding dropped = find(report, CompatAction.DROPPED, "region", "swamp");
|
||||
assertNotNull(dropped);
|
||||
assertEquals("shoreBiomes[0] swamp/shore/beach", dropped.detail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evaluateCompatExcludesRegionWithNoSeaBiomesLeft() {
|
||||
PackCompatReport report = new PackCompatReport();
|
||||
IrisBiome plains = biome("land/plains");
|
||||
IrisBiome sea = excludeBlock(biome("sea/sulfur"));
|
||||
IrisData data = dataWith(report, plains, sea);
|
||||
IrisRegion region = PackCompatFixtures.region("overworld");
|
||||
region.setLoader(data);
|
||||
region.setLandBiomes(new KList<>("land/plains"));
|
||||
region.setSeaBiomes(new KList<>("sea/sulfur"));
|
||||
|
||||
assertTrue(region.evaluateCompat(gate(report)).excluded());
|
||||
CompatFinding cascade = find(report, CompatAction.EXCLUDED, "region", "overworld");
|
||||
assertNotNull(cascade);
|
||||
assertEquals(MISSING_BLOCK, cascade.key());
|
||||
assertEquals("no sea biomes remain", cascade.detail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evaluateCompatPreservesSurvivingSurfacePoolOrder() {
|
||||
PackCompatReport report = new PackCompatReport();
|
||||
IrisBiome plains = biome("land/plains");
|
||||
IrisBiome sea = biome("sea/ocean");
|
||||
IrisBiome sand = biome("shore/sand");
|
||||
IrisBiome gravel = biome("shore/gravel");
|
||||
IrisBiome sulfur = excludeBlock(biome("shore/sulfur"));
|
||||
IrisData data = dataWith(report, plains, sea, sand, gravel, sulfur);
|
||||
IrisRegion region = PackCompatFixtures.region("overworld");
|
||||
region.setLoader(data);
|
||||
region.setLandBiomes(new KList<>("land/plains"));
|
||||
region.setSeaBiomes(new KList<>("shore/sulfur", "sea/ocean"));
|
||||
region.setShoreBiomes(new KList<>("shore/sand", "shore/sulfur", "shore/gravel"));
|
||||
|
||||
assertFalse(region.evaluateCompat(gate(report)).excluded());
|
||||
KList<IrisBiome> shores = region.getRealShoreBiomes(() -> data);
|
||||
assertEquals(2, shores.size());
|
||||
assertSame(sand, shores.get(0));
|
||||
assertSame(gravel, shores.get(1));
|
||||
assertSame(sea, region.getRealSeaBiomes(() -> data).getFirst());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evaluateCompatAllowsOmittedSurfacePoolsAndDepletedCavePool() {
|
||||
PackCompatReport report = new PackCompatReport();
|
||||
IrisBiome plains = biome("land/plains");
|
||||
IrisBiome sulfur = excludeBlock(biome("cave/sulfur"));
|
||||
IrisData data = dataWith(report, plains, sulfur);
|
||||
IrisRegion region = PackCompatFixtures.region("highlands");
|
||||
region.setLoader(data);
|
||||
region.setLandBiomes(new KList<>("land/plains"));
|
||||
region.setCaveBiomes(new KList<>("cave/sulfur"));
|
||||
|
||||
assertFalse(region.evaluateCompat(gate(report)).excluded());
|
||||
assertTrue(region.getRealSeaBiomes(() -> data).isEmpty());
|
||||
assertTrue(region.getRealShoreBiomes(() -> data).isEmpty());
|
||||
assertTrue(region.getRealCaveBiomes(() -> data).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evaluateCompatDoesNotMisattributeUnresolvedShorePoolToLandDrop() {
|
||||
PackCompatReport report = new PackCompatReport();
|
||||
IrisBiome plains = biome("land/plains");
|
||||
IrisBiome sulfur = excludeBlock(biome("land/sulfur"));
|
||||
IrisData data = dataWith(report, plains, sulfur);
|
||||
IrisRegion region = PackCompatFixtures.region("overworld");
|
||||
region.setLoader(data);
|
||||
region.setLandBiomes(new KList<>("land/plains", "land/sulfur"));
|
||||
region.setShoreBiomes(new KList<>("shore/missing"));
|
||||
|
||||
assertFalse(region.evaluateCompat(gate(report)).excluded());
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
public void dimensionDropsRegionWhoseDeclaredShorePoolWasExcluded() {
|
||||
PackCompatReport report = new PackCompatReport();
|
||||
IrisBiome plains = biome("land/plains");
|
||||
IrisBiome beach = excludeBlock(biome("shore/sulfur"));
|
||||
IrisData data = dataWith(report, plains, beach);
|
||||
IrisRegion swamp = PackCompatFixtures.region("swamp");
|
||||
swamp.setLoader(data);
|
||||
swamp.setLandBiomes(new KList<>("land/plains"));
|
||||
swamp.setShoreBiomes(new KList<>("shore/sulfur"));
|
||||
swamp.setCompat(swamp.evaluateCompat(gate(report)));
|
||||
IrisRegion highlands = PackCompatFixtures.region("highlands");
|
||||
ResourceLoader<IrisRegion> regions = mock(ResourceLoader.class);
|
||||
when(data.getRegionLoader()).thenReturn(regions);
|
||||
when(regions.load("swamp")).thenReturn(swamp);
|
||||
when(regions.load("highlands")).thenReturn(highlands);
|
||||
IrisDimension dimension = new IrisDimension().setRegions(new KList<>("swamp", "highlands"));
|
||||
dimension.setLoadKey("overworld");
|
||||
dimension.setLoader(data);
|
||||
|
||||
assertFalse(dimension.evaluateCompat(gate(report)).excluded());
|
||||
KList<IrisRegion> surviving = dimension.getAllRegions(() -> data);
|
||||
assertEquals(1, surviving.size());
|
||||
assertSame(highlands, surviving.getFirst());
|
||||
CompatFinding drop = find(report, CompatAction.DROPPED, "dimension", "overworld");
|
||||
assertNotNull(drop);
|
||||
assertEquals("regions[0] swamp", drop.detail());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void evaluateCompatDoesNotExcludeRegionThatNeverDeclaredLandBiomes() {
|
||||
PackCompatReport report = new PackCompatReport();
|
||||
|
||||
@@ -71,7 +71,15 @@ public class BuiltInPackUpdatesTest {
|
||||
|
||||
@Test
|
||||
public void boundsReleaseMetadataSize() throws Exception {
|
||||
assertEquals(BuiltInPackUpdates.Update.unavailable(), checkResponse(" ".repeat(1024 * 1024 + 1)));
|
||||
String release = release("4010", "overworld.zip", false);
|
||||
assertEquals(BuiltInPackUpdates.Update.unavailable(),
|
||||
checkResponse(release + " ".repeat(1024 * 1024 - release.length() + 1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void acceptsReleaseMetadataAtSizeLimit() throws Exception {
|
||||
String release = release("4010", "overworld.zip", false);
|
||||
assertEquals("4010", checkResponse(release + " ".repeat(1024 * 1024 - release.length())).version());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -58,7 +58,7 @@ public class DefaultPackBootstrapProvisionerTest {
|
||||
Path dataDirectory = root.resolve("plugins/Iris");
|
||||
writePack(dataDirectory.resolve("packs/overworld"), "overworld", "runtime");
|
||||
BukkitStartupPaths startupPaths = BukkitStartupPaths.resolve(root, new String[0]);
|
||||
for (DataVersion version : new DataVersion[]{DataVersion.V26_1_2, DataVersion.V26_2, DataVersion.V26_3}) {
|
||||
for (DataVersion version : new DataVersion[]{DataVersion.V1_21_1, DataVersion.V26_1_2, DataVersion.V26_2, DataVersion.V26_3}) {
|
||||
DefaultPackBootstrapProvisioner.ProvisionResult result = DefaultPackBootstrapProvisioner.provision(
|
||||
new DefaultPackBootstrapProvisioner.BootstrapRequest(dataDirectory, ignored -> {}, startupPaths, version));
|
||||
Path biomeRoot = result.datapackRoot().resolve("data/iris/worldgen/biome/biomes");
|
||||
|
||||
@@ -9,6 +9,7 @@ import static org.junit.Assert.assertSame;
|
||||
public class DataVersionTest {
|
||||
@Test
|
||||
public void runtimeSelectionPreservesEverySupportedVersion() {
|
||||
assertSame(DataVersion.V1_21_1, DataVersion.forMinecraftVersion("1.21.1"));
|
||||
assertSame(DataVersion.V26_1_2, DataVersion.forMinecraftVersion("26.1.2"));
|
||||
assertSame(DataVersion.V26_2, DataVersion.forMinecraftVersion("26.2"));
|
||||
assertSame(DataVersion.V26_2, DataVersion.forMinecraftVersion("26.2.0"));
|
||||
@@ -24,6 +25,7 @@ public class DataVersionTest {
|
||||
|
||||
@Test
|
||||
public void packFormatsMatchServerVersionJson() {
|
||||
assertEquals(48, DataVersion.V1_21_1.getPackFormat());
|
||||
assertEquals(101, DataVersion.V26_1_2.getPackFormat());
|
||||
assertEquals(107, DataVersion.V26_2.getPackFormat());
|
||||
assertEquals(121, DataVersion.V26_3.getPackFormat());
|
||||
@@ -31,7 +33,7 @@ public class DataVersionTest {
|
||||
|
||||
@Test
|
||||
public void minSupportedPackFormatIsTheOldestSupportedRuntime() {
|
||||
assertEquals(101, DataVersion.minSupportedPackFormat());
|
||||
assertEquals(48, DataVersion.minSupportedPackFormat());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+41
@@ -142,6 +142,47 @@ public class VanillaJigsawDatapackExporterTest {
|
||||
assertEquals("north_up", paletteEntry.getCompoundTag("Properties").getString("orientation"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exports1211RuntimeBlockStatesAndPackFormat() throws Exception {
|
||||
when(IrisPlatforms.get().minecraftVersion()).thenReturn("1.21.1");
|
||||
try {
|
||||
TestGraph graph = connectorGraph();
|
||||
Path output = temporaryFolder.getRoot().toPath().resolve("village-1211");
|
||||
VanillaJigsawExportSettings settings = VanillaJigsawExportSettings.builder()
|
||||
.maxDistanceVertical(graph.structure.getMaxSizeChunks() * 16).build();
|
||||
VanillaJigsawExportResult result = new VanillaJigsawDatapackExporter().export(
|
||||
request(graph, output).namespace("studio").resourcePath("village/test").settings(settings).build());
|
||||
assertTrue(result.diagnostics().toString(), result.isSuccess());
|
||||
JsonObject pack = json(output.resolve("pack.mcmeta")).getAsJsonObject("pack");
|
||||
assertEquals(48, pack.get("pack_format").getAsInt());
|
||||
JsonObject structure = json(output.resolve("data/studio/worldgen/structure/village/test.json"));
|
||||
assertTrue(structure.get("max_distance_from_center").isJsonPrimitive());
|
||||
CompoundTag template = (CompoundTag) NBTUtil.read(output.resolve(
|
||||
"data/studio/structure/village/test/piece/pieces/start.nbt").toFile()).getTag();
|
||||
assertEquals(3955, template.getInt("DataVersion"));
|
||||
CompoundTag palette = (CompoundTag) template.getListTag("palette").get(0);
|
||||
assertEquals("minecraft:jigsaw", palette.getString("Name"));
|
||||
} finally {
|
||||
when(IrisPlatforms.get().minecraftVersion()).thenReturn("26.2");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void rejects1211VanillaExportWithDifferentVerticalDistance() throws Exception {
|
||||
when(IrisPlatforms.get().minecraftVersion()).thenReturn("1.21.1");
|
||||
try {
|
||||
Path output = temporaryFolder.getRoot().toPath().resolve("unequal-1211");
|
||||
VanillaJigsawExportResult result = new VanillaJigsawDatapackExporter().export(
|
||||
request(connectorGraph(), output).settings(VanillaJigsawExportSettings.builder()
|
||||
.maxDistanceVertical(127).build()).build());
|
||||
assertFalse(result.isSuccess());
|
||||
assertTrue(result.diagnostics().stream().anyMatch(diagnostic ->
|
||||
diagnostic.code() == VanillaJigsawExportDiagnostic.Code.INVALID_MAX_DISTANCE));
|
||||
} finally {
|
||||
when(IrisPlatforms.get().minecraftVersion()).thenReturn("26.2");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exports26_3RuntimeBlockStatesAndPackFormat() throws Exception {
|
||||
when(IrisPlatforms.get().minecraftVersion()).thenReturn("26.3.0");
|
||||
|
||||
Reference in new issue
Block a user