mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 22:10:18 +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
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user