diff --git a/core/src/main/java/art/arcane/iris/engine/image/IrisImageMapSourceMetadata.java b/core/src/main/java/art/arcane/iris/engine/image/IrisImageMapSourceMetadata.java new file mode 100644 index 000000000..71a9bfce4 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/image/IrisImageMapSourceMetadata.java @@ -0,0 +1,18 @@ +package art.arcane.iris.engine.image; + +import art.arcane.iris.engine.object.image.IrisImageColorMode; + +public record IrisImageMapSourceMetadata( + String format, + IrisImageColorMode colorMode, + int width, + int height, + int colorComponents, + int channels, + int bitDepth, + boolean alpha, + double minimumAlpha, + double maximumAlpha, + String decodedContentHash +) { +} diff --git a/core/src/main/java/art/arcane/iris/engine/image/IrisImageMapValidationException.java b/core/src/main/java/art/arcane/iris/engine/image/IrisImageMapValidationException.java new file mode 100644 index 000000000..9c267b4a9 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/image/IrisImageMapValidationException.java @@ -0,0 +1,35 @@ +package art.arcane.iris.engine.image; + +import java.util.List; + +public final class IrisImageMapValidationException extends IllegalArgumentException { + private final List diagnostics; + + public IrisImageMapValidationException(String diagnostic) { + this(List.of(diagnostic)); + } + + public IrisImageMapValidationException(List diagnostics) { + super(message(diagnostics)); + if (diagnostics == null || diagnostics.isEmpty()) { + throw new IllegalArgumentException("Image-map validation requires at least one diagnostic"); + } + this.diagnostics = List.copyOf(diagnostics); + } + + public IrisImageMapValidationException(String diagnostic, Throwable cause) { + super(diagnostic, cause); + this.diagnostics = List.of(diagnostic); + } + + public List getDiagnostics() { + return diagnostics; + } + + private static String message(List diagnostics) { + if (diagnostics == null || diagnostics.isEmpty()) { + return "Image-map validation failed"; + } + return String.join("; ", diagnostics); + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/DependsOn.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/DependsOn.java new file mode 100644 index 000000000..05c175a76 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/DependsOn.java @@ -0,0 +1,31 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({FIELD}) +public @interface DependsOn { + String[] value(); +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListBiome.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListBiome.java new file mode 100644 index 000000000..538c1b367 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListBiome.java @@ -0,0 +1,37 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +/** + * Marks a String field (or a list of Strings) as a live biome-registry key, so schema completion offers every + * vanilla, datapack, and mod biome instead of nothing. + */ +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListBiome { + +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListBlockType.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListBlockType.java new file mode 100644 index 000000000..9c698782d --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListBlockType.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListBlockType { + +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListEnchantment.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListEnchantment.java new file mode 100644 index 000000000..918fe7343 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListEnchantment.java @@ -0,0 +1,14 @@ +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListEnchantment { +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListEntityType.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListEntityType.java new file mode 100644 index 000000000..74473f2c5 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListEntityType.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListEntityType { + +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListFont.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListFont.java new file mode 100644 index 000000000..83a8dc660 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListFont.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListFont { + +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListItemType.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListItemType.java new file mode 100644 index 000000000..b1ff189dd --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListItemType.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListItemType { + +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListPotionEffect.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListPotionEffect.java new file mode 100644 index 000000000..9b8493c8f --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListPotionEffect.java @@ -0,0 +1,14 @@ +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListPotionEffect { +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListSpecialEntity.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListSpecialEntity.java new file mode 100644 index 000000000..528c33c47 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryListSpecialEntity.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.PARAMETER; +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +@Retention(RUNTIME) +@Target({PARAMETER, TYPE, FIELD}) +public @interface RegistryListSpecialEntity { + +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryMapBlockState.java b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryMapBlockState.java new file mode 100644 index 000000000..c313daf93 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/annotations/RegistryMapBlockState.java @@ -0,0 +1,12 @@ +package art.arcane.iris.engine.object.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface RegistryMapBlockState { + String value(); +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/entity/spawn/IrisEngineSpawnerCooldown.java b/core/src/main/java/art/arcane/iris/engine/object/entity/spawn/IrisEngineSpawnerCooldown.java new file mode 100644 index 000000000..0a1db5c1b --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/entity/spawn/IrisEngineSpawnerCooldown.java @@ -0,0 +1,36 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.entity.spawn; + +import art.arcane.volmlib.util.math.M; +import lombok.Data; + +@Data +public class IrisEngineSpawnerCooldown { + private long lastSpawn = 0; + private String spawner; + + public void spawn() { + lastSpawn = M.ms(); + } + + public boolean canSpawn(long intervalMilliseconds) { + return M.ms() - lastSpawn > intervalMilliseconds; + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/entity/spawn/IrisSpawnerCooldowns.java b/core/src/main/java/art/arcane/iris/engine/object/entity/spawn/IrisSpawnerCooldowns.java new file mode 100644 index 000000000..1f0965cec --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/entity/spawn/IrisSpawnerCooldowns.java @@ -0,0 +1,32 @@ +package art.arcane.iris.engine.object.entity.spawn; + +import art.arcane.volmlib.util.collection.KMap; +import lombok.EqualsAndHashCode; +import lombok.NonNull; + +import java.util.function.ToLongFunction; + +@EqualsAndHashCode +public class IrisSpawnerCooldowns { + private final KMap cooldowns = new KMap<>(); + + public IrisEngineSpawnerCooldown getCooldown(@NonNull String loadKey) { + return cooldowns.computeIfAbsent(loadKey, k -> { + IrisEngineSpawnerCooldown cd = new IrisEngineSpawnerCooldown(); + cd.setSpawner(loadKey); + return cd; + }); + } + + /** Forgets the cooldowns that ran out and those of spawners {@code intervalMilliseconds} does not know (a negative interval). */ + public void cleanup(ToLongFunction intervalMilliseconds) { + cooldowns.values().removeIf(cd -> { + long interval = intervalMilliseconds.applyAsLong(cd.getSpawner()); + return interval < 0 || cd.canSpawn(interval); + }); + } + + public boolean isEmpty() { + return cooldowns.isEmpty(); + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageColorMode.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageColorMode.java new file mode 100644 index 000000000..0aecfc259 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageColorMode.java @@ -0,0 +1,9 @@ +package art.arcane.iris.engine.object.image; + +public enum IrisImageColorMode { + GRAYSCALE, + RGB, + RGBA, + INDEXED, + UNSUPPORTED +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapAlpha.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapAlpha.java new file mode 100644 index 000000000..338e2cd71 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapAlpha.java @@ -0,0 +1,11 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("How alpha participates in decoded data") +public enum IrisImageMapAlpha { + IGNORE, + MASK, + TRANSPARENT_IS_FALLBACK, + ERROR +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapApplication.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapApplication.java new file mode 100644 index 000000000..d7ad2e1f6 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapApplication.java @@ -0,0 +1,13 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("The generation input controlled by an image map") +public enum IrisImageMapApplication { + TERRAIN_HEIGHT, + BIOME, + REGION, + SURFACE_BLOCK, + MASK, + CUSTOM +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapMask.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapMask.java new file mode 100644 index 000000000..43ca5de04 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapMask.java @@ -0,0 +1,33 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; +import art.arcane.iris.engine.object.annotations.MaxNumber; +import art.arcane.iris.engine.object.annotations.MinNumber; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Accessors(chain = true) +@NoArgsConstructor +@Desc("A composable reference to a named MASK image map") +@Data +public class IrisImageMapMask { + @Desc("The key of a named imageMaps entry whose application is MASK") + private String map = ""; + + @Desc("How this mask combines with masks before it") + private IrisImageMapMaskOperation operation = IrisImageMapMaskOperation.MULTIPLY; + + @Desc("Invert this mask before combining it") + private boolean inverted = false; + + @MinNumber(0) + @MaxNumber(1) + @Desc("Values below this threshold become zero") + private double threshold = 0D; + + @MinNumber(0) + @MaxNumber(1) + @Desc("Soft transition width above threshold; zero is a hard edge") + private double falloff = 0D; +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapMaskOperation.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapMaskOperation.java new file mode 100644 index 000000000..aa1708e83 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapMaskOperation.java @@ -0,0 +1,12 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("How a referenced mask combines with masks before it") +public enum IrisImageMapMaskOperation { + MULTIPLY, + MINIMUM, + MAXIMUM, + ADD, + SUBTRACT +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapOrigin.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapOrigin.java new file mode 100644 index 000000000..fc2ee68a8 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapOrigin.java @@ -0,0 +1,23 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Accessors(chain = true) +@NoArgsConstructor +@Desc("A two-dimensional image-map coordinate") +@Data +public class IrisImageMapOrigin { + @Desc("X coordinate in world blocks for origin, or source pixels for sourceOrigin") + private double x = 0D; + + @Desc("Z coordinate in world blocks for origin, or source image Y pixels for sourceOrigin") + private double z = 0D; + + public IrisImageMapOrigin(double x, double z) { + this.x = x; + this.z = z; + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapOutOfBounds.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapOutOfBounds.java new file mode 100644 index 000000000..a8bd749ae --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapOutOfBounds.java @@ -0,0 +1,12 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("How coordinates outside an image are resolved") +public enum IrisImageMapOutOfBounds { + FALLBACK, + CLAMP, + REPEAT, + MIRROR, + ERROR +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapRotation.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapRotation.java new file mode 100644 index 000000000..300c7c203 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapRotation.java @@ -0,0 +1,11 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("Clockwise image-map rotation around sourceOrigin") +public enum IrisImageMapRotation { + DEG_0, + DEG_90, + DEG_180, + DEG_270 +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapSampling.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapSampling.java new file mode 100644 index 000000000..f215ab5f4 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapSampling.java @@ -0,0 +1,10 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("The filter used between source pixels") +public enum IrisImageMapSampling { + NEAREST, + BILINEAR, + BICUBIC +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapType.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapType.java new file mode 100644 index 000000000..64ad766f9 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapType.java @@ -0,0 +1,13 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("How Iris decodes each source pixel") +public enum IrisImageMapType { + GRAYSCALE_HEIGHT, + RGB_HEIGHT, + COLOR_MAP, + BINARY_MASK, + GRAYSCALE_MASK, + ALPHA_MASK +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapUnknownColor.java b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapUnknownColor.java new file mode 100644 index 000000000..8d7e160b5 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/image/IrisImageMapUnknownColor.java @@ -0,0 +1,10 @@ +package art.arcane.iris.engine.object.image; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("How a color absent from a color-map legend is handled") +public enum IrisImageMapUnknownColor { + ERROR, + FALLBACK, + IGNORE +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/runtime/IrisEngineData.java b/core/src/main/java/art/arcane/iris/engine/object/runtime/IrisEngineData.java new file mode 100644 index 000000000..2db085788 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/runtime/IrisEngineData.java @@ -0,0 +1,53 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.runtime; + +import art.arcane.iris.engine.object.entity.spawn.IrisSpawnerCooldowns; +import art.arcane.volmlib.util.cache.CacheKey; +import art.arcane.volmlib.util.collection.KMap; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.function.ToLongFunction; + +@Data +@EqualsAndHashCode(callSuper = true) +public class IrisEngineData extends IrisSpawnerCooldowns { + private IrisEngineStatistics statistics = new IrisEngineStatistics(); + private KMap chunks = new KMap<>(); + private Long seed = null; + + public void removeChunk(int x, int z) { + chunks.remove(CacheKey.key(x, z)); + } + + public IrisSpawnerCooldowns getChunk(int x, int z) { + return chunks.computeIfAbsent(CacheKey.key(x, z), k -> new IrisSpawnerCooldowns()); + } + + @Override + public void cleanup(ToLongFunction intervalMilliseconds) { + super.cleanup(intervalMilliseconds); + + chunks.values().removeIf(chunk -> { + chunk.cleanup(intervalMilliseconds); + return chunk.isEmpty(); + }); + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/runtime/IrisEngineStatistics.java b/core/src/main/java/art/arcane/iris/engine/object/runtime/IrisEngineStatistics.java new file mode 100644 index 000000000..ae392297d --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/runtime/IrisEngineStatistics.java @@ -0,0 +1,67 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.runtime; + +import lombok.Data; + +import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + +@Data +public class IrisEngineStatistics { + private static final AtomicIntegerFieldUpdater TOTAL_HOTLOADS = + AtomicIntegerFieldUpdater.newUpdater(IrisEngineStatistics.class, "totalHotloads"); + private static final AtomicIntegerFieldUpdater CHUNKS_GENERATED = + AtomicIntegerFieldUpdater.newUpdater(IrisEngineStatistics.class, "chunksGenerated"); + + private volatile int totalHotloads = 0; + private volatile int chunksGenerated = 0; + private volatile int IrisToUpgradedVersion = 0; + private volatile int IrisCreationVersion = 0; + private volatile int MinecraftVersion = 0; + + public void generatedChunk() { + CHUNKS_GENERATED.incrementAndGet(this); + } + + public void setUpgradedVersion(int i) { + IrisToUpgradedVersion = i; + } + public int getUpgradedVersion() { + return IrisToUpgradedVersion; + } + public void setVersion(int i) { + IrisCreationVersion = i; + } + + public int getVersion() { + return IrisCreationVersion; + } + + public void setMCVersion(int i) { + MinecraftVersion = i; + } + + public int getMCVersion() { + return MinecraftVersion; + } + + public void hotloaded() { + TOTAL_HOTLOADS.incrementAndGet(this); + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/value/IrisRange.java b/core/src/main/java/art/arcane/iris/engine/object/value/IrisRange.java new file mode 100644 index 000000000..9b2a2921e --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/value/IrisRange.java @@ -0,0 +1,59 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.value; + +import art.arcane.iris.engine.object.annotations.Desc; +import art.arcane.iris.engine.object.annotations.Snippet; +import art.arcane.volmlib.util.math.RNG; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Snippet("range") +@Accessors(chain = true) +@NoArgsConstructor +@AllArgsConstructor +@Desc("Represents a range") +@Data +public class IrisRange { + @Desc("The minimum value") + private double min = 16; + + @Desc("The maximum value") + private double max = 32; + + public double get(RNG rng) { + if (min == max) { + return min; + } + + return rng.d(min, max); + } + + public boolean contains(int v) { + return v >= min && v <= max; + } + + public IrisRange merge(IrisRange other) { + min = Math.min(min, other.min); + max = Math.max(max, other.max); + return this; + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/IrisEnvironment.java b/core/src/main/java/art/arcane/iris/engine/object/world/IrisEnvironment.java new file mode 100644 index 000000000..3ec4976cd --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/IrisEnvironment.java @@ -0,0 +1,36 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.world; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("Represents a world environment") +public enum IrisEnvironment { + @Desc("The overworld environment") + NORMAL, + + @Desc("The nether environment") + NETHER, + + @Desc("The end environment") + THE_END, + + @Desc("A custom environment") + CUSTOM +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/IrisWorldBoundary.java b/core/src/main/java/art/arcane/iris/engine/object/world/IrisWorldBoundary.java new file mode 100644 index 000000000..d63855e08 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/IrisWorldBoundary.java @@ -0,0 +1,91 @@ +package art.arcane.iris.engine.object.world; + +import art.arcane.iris.engine.object.annotations.Desc; +import art.arcane.iris.engine.object.annotations.MaxNumber; +import art.arcane.iris.engine.object.annotations.MinNumber; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.util.Objects; + +@Accessors(chain = true) +@NoArgsConstructor +@Desc("The native Minecraft world border applied to worlds using this dimension") +@Data +public class IrisWorldBoundary { + public static final double DEFAULT_DAMAGE_AMOUNT = 0.2D; + public static final double DEFAULT_DAMAGE_BUFFER = 5D; + public static final double MAXIMUM_CENTER = 29_999_984D; + public static final double MAXIMUM_SIZE = 59_999_968D; + + @Desc("The center of the boundary") + private IrisWorldBoundaryCenter center = new IrisWorldBoundaryCenter(); + + @MinNumber(1) + @MaxNumber(59_999_968) + @Desc("The full border diameter in blocks, matching Minecraft world-border terminology") + private double size = 16_384D; + + @MinNumber(0) + @MaxNumber(Integer.MAX_VALUE) + @Desc("Distance from the border at which the client warning begins") + private int warningDistance = 16; + + @MinNumber(0) + @Desc("Safe distance outside the border before damage begins") + private double damageBuffer = DEFAULT_DAMAGE_BUFFER; + + @MinNumber(0) + @Desc("Damage per block beyond damageBuffer") + private double damageAmount = DEFAULT_DAMAGE_AMOUNT; + + public static IrisWorldBoundary snapshot(IrisWorldBoundary configured) { + IrisWorldBoundary source = Objects.requireNonNull(configured, "Configured worldBoundary"); + source.validate(); + return new IrisWorldBoundary() + .setCenter(new IrisWorldBoundaryCenter(source.getCenter().getX(), source.getCenter().getZ())) + .setSize(source.getSize()) + .setWarningDistance(source.getWarningDistance()) + .setDamageBuffer(source.getDamageBuffer()) + .setDamageAmount(source.getDamageAmount()); + } + + public void validate() { + if (center == null) { + throw new IllegalArgumentException("worldBoundary.center is required"); + } + if (!Double.isFinite(center.getX()) || Math.abs(center.getX()) > MAXIMUM_CENTER + || !Double.isFinite(center.getZ()) || Math.abs(center.getZ()) > MAXIMUM_CENTER) { + throw new IllegalArgumentException("worldBoundary.center must be finite and within +/-" + MAXIMUM_CENTER); + } + if (!Double.isFinite(size) || size < 1D || size > MAXIMUM_SIZE) { + throw new IllegalArgumentException("worldBoundary.size must be between 1 and " + MAXIMUM_SIZE); + } + if (warningDistance < 0) { + throw new IllegalArgumentException("worldBoundary.warningDistance cannot be negative"); + } + if (!Double.isFinite(damageBuffer) || damageBuffer < 0D) { + throw new IllegalArgumentException("worldBoundary.damageBuffer must be finite and non-negative"); + } + if (!Double.isFinite(damageAmount) || damageAmount < 0D) { + throw new IllegalArgumentException("worldBoundary.damageAmount must be finite and non-negative"); + } + } + + public double minimumX() { + return center.getX() - size / 2D; + } + + public double maximumX() { + return center.getX() + size / 2D; + } + + public double minimumZ() { + return center.getZ() - size / 2D; + } + + public double maximumZ() { + return center.getZ() + size / 2D; + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/IrisWorldBoundaryCenter.java b/core/src/main/java/art/arcane/iris/engine/object/world/IrisWorldBoundaryCenter.java new file mode 100644 index 000000000..a860a437d --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/IrisWorldBoundaryCenter.java @@ -0,0 +1,29 @@ +package art.arcane.iris.engine.object.world; + +import art.arcane.iris.engine.object.annotations.Desc; +import art.arcane.iris.engine.object.annotations.MaxNumber; +import art.arcane.iris.engine.object.annotations.MinNumber; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Accessors(chain = true) +@NoArgsConstructor +@Desc("The world-border center in block coordinates") +@Data +public class IrisWorldBoundaryCenter { + @MinNumber(-29_999_984) + @MaxNumber(29_999_984) + @Desc("The world-border center X coordinate") + private double x = 0D; + + @MinNumber(-29_999_984) + @MaxNumber(29_999_984) + @Desc("The world-border center Z coordinate") + private double z = 0D; + + public IrisWorldBoundaryCenter(double x, double z) { + this.x = x; + this.z = z; + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/biome/InferredType.java b/core/src/main/java/art/arcane/iris/engine/object/world/biome/InferredType.java new file mode 100644 index 000000000..8256e91e4 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/biome/InferredType.java @@ -0,0 +1,36 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.world.biome; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("Represents a biome type") +public enum InferredType { + @Desc("Represents any shore biome type") + SHORE, + + @Desc("Represents any land biome type") + LAND, + + @Desc("Represents any sea biome type") + SEA, + + @Desc("Represents any cave biome type") + CAVE +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomCategory.java b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomCategory.java new file mode 100644 index 000000000..a9727d366 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomCategory.java @@ -0,0 +1,75 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.world.biome.custom; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("The custom biome category. Vanilla asks for this, basically what represents your biome closest?") +public enum IrisBiomeCustomCategory { + @Desc("Tags the generated datapack biome as vanilla category 'beach' (shoreline biomes).") + beach, + + @Desc("Tags the generated datapack biome as vanilla category 'desert' (hot, dry sand biomes).") + desert, + + @Desc("Tags the generated datapack biome as vanilla category 'extreme_hills' (mountain biomes).") + extreme_hills, + + @Desc("Tags the generated datapack biome as vanilla category 'forest' (tree-dense temperate biomes).") + forest, + + @Desc("Tags the generated datapack biome as vanilla category 'icy' (snow and ice biomes).") + icy, + + @Desc("Tags the generated datapack biome as vanilla category 'jungle'.") + jungle, + + @Desc("Tags the generated datapack biome as vanilla category 'mesa' (badlands).") + mesa, + + @Desc("Tags the generated datapack biome as vanilla category 'mushroom' (mushroom fields).") + mushroom, + + @Desc("Tags the generated datapack biome as vanilla category 'nether'.") + nether, + + @Desc("Tags the generated datapack biome as vanilla category 'none' (no classification).") + none, + + @Desc("Tags the generated datapack biome as vanilla category 'ocean'.") + ocean, + + @Desc("Tags the generated datapack biome as vanilla category 'plains'. This is the default when category is omitted.") + plains, + + @Desc("Tags the generated datapack biome as vanilla category 'river'.") + river, + + @Desc("Tags the generated datapack biome as vanilla category 'savanna'.") + savanna, + + @Desc("Tags the generated datapack biome as vanilla category 'swamp'.") + swamp, + + @Desc("Tags the generated datapack biome as vanilla category 'taiga'.") + taiga, + + @Desc("Tags the generated datapack biome as vanilla category 'the_end'.") + the_end +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomPrecipType.java b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomPrecipType.java new file mode 100644 index 000000000..d54a7e1fe --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomPrecipType.java @@ -0,0 +1,33 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.world.biome.custom; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("Snow, rain, or nothing") +public enum IrisBiomeCustomPrecipType { + @Desc("No downfall") + none, + + @Desc("Rain downfall") + rain, + + @Desc("Snow downfall") + snow +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomSpawnType.java b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomSpawnType.java new file mode 100644 index 000000000..afeb577ea --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisBiomeCustomSpawnType.java @@ -0,0 +1,48 @@ +/* + * Iris is a World Generator for Minecraft Bukkit Servers + * Copyright (c) 2022 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.world.biome.custom; + +import art.arcane.iris.engine.object.annotations.Desc; + +@Desc("The mob spawn group") +public enum IrisBiomeCustomSpawnType { + @Desc("Typical monsters that spawn at night, like zombies and skeletons") + MONSTER, + + @Desc("Typical creatures like sheep, pigs, cows") + CREATURE, + + @Desc("Eg bats") + AMBIENT, + + @Desc("Axolotls") + AXOLOTLS, + + @Desc("Odd spawn group but ok") + UNDERGROUND_WATER_CREATURE, + + @Desc("Water mobs like squid, dolphins") + WATER_CREATURE, + + @Desc("Fish") + WATER_AMBIENT, + + @Desc("Unknown") + MISC +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisVanillaBiomeTags.java b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisVanillaBiomeTags.java new file mode 100644 index 000000000..40eb0ea02 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/biome/custom/IrisVanillaBiomeTags.java @@ -0,0 +1,185 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.world.biome.custom; + +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** + * Direct vanilla biome tag membership, generated from the MC 26.2 built-in datapack + * (data/minecraft/tags/worldgen/biome). Used to give Iris custom biomes the tag membership of the vanilla + * biome they derive from, so tag selectors written by vanilla and by mods (#minecraft:is_overworld and + * friends) resolve against Iris terrain. + * + *

Only DIRECT membership is listed. Vanilla's derived tags reference other tags rather than repeating + * biomes (#minecraft:is_ocean includes #minecraft:is_deep_ocean, water_on_map_outlines includes + * #minecraft:is_river, and so on), so adding a custom biome to the direct tags carries it into the derived + * tags for free. + * + *

The has_structure/* tags are deliberately absent. Iris resolves native structure placement through the + * biome's structure derivative, never through the custom biome, so injecting custom biomes there would place + * a structure twice. + * + *

{@code stronghold_biased_to} is absent for the same reason, even though it is not a has_structure tag. + * It is a structure-placement input: {@code worldgen/structure_set/strongholds.json} reads it as + * {@code preferred_biomes} when it rings strongholds around spawn. Inheriting it would enter every Iris biome + * derived from a tagged vanilla biome into that ring - which is the entire overworld surface of a typical pack - + * and let vanilla place strongholds where the pack's own structure configuration did not ask for them. + * + *

An unknown key (a mod biome, a datapack biome, or a vanilla biome added after 26.2) contributes nothing; + * the pack author's explicit tags still apply. + */ +public final class IrisVanillaBiomeTags { + private static final String TAG_NAMESPACE = "minecraft:"; + private static final Map> DIRECT_TAGS = new HashMap<>(96); + + private IrisVanillaBiomeTags() { + } + + /** + * Tags the given vanilla biome key belongs to directly. Never null; empty for unknown keys. Keys are + * returned fully namespaced and lowercase. + */ + public static List tagsFor(String biomeKey) { + if (biomeKey == null || biomeKey.isBlank()) { + return List.of(); + } + String normalized = biomeKey.trim().toLowerCase(Locale.ROOT); + if (normalized.indexOf(':') < 0) { + normalized = TAG_NAMESPACE + normalized; + } + List tags = DIRECT_TAGS.get(normalized); + return tags == null ? List.of() : tags; + } + + static int knownBiomeCount() { + return DIRECT_TAGS.size(); + } + + private static void put(String biomeKey, String... tagPaths) { + String[] namespaced = new String[tagPaths.length]; + for (int i = 0; i < tagPaths.length; i++) { + namespaced[i] = TAG_NAMESPACE + tagPaths[i]; + } + DIRECT_TAGS.put(biomeKey, List.of(namespaced)); + } + + static { + put("minecraft:badlands", "is_badlands", "is_overworld"); + put("minecraft:bamboo_jungle", "is_jungle", "is_overworld"); + put("minecraft:basalt_deltas", "is_nether"); + put("minecraft:beach", "is_beach", "is_overworld"); + put("minecraft:birch_forest", "is_forest", "is_overworld"); + put("minecraft:cherry_grove", "is_mountain", "is_overworld"); + put("minecraft:cold_ocean", "is_ocean", "is_overworld", "spawns_cold_variant_farm_animals"); + put("minecraft:crimson_forest", "is_nether"); + put("minecraft:dark_forest", "is_forest", "is_overworld"); + put("minecraft:deep_cold_ocean", "is_deep_ocean", "is_overworld", "spawns_cold_variant_farm_animals"); + put("minecraft:deep_dark", + "is_overworld", "mineshaft_blocking", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs"); + put("minecraft:deep_frozen_ocean", + "is_deep_ocean", "is_overworld", "polar_bears_spawn_on_alternate_blocks", "spawns_cold_variant_farm_animals", + "spawns_cold_variant_frogs"); + put("minecraft:deep_lukewarm_ocean", "is_deep_ocean", "is_overworld", "spawns_warm_variant_farm_animals"); + put("minecraft:deep_ocean", "is_deep_ocean", "is_overworld"); + put("minecraft:desert", + "is_overworld", "spawns_gold_rabbits", "spawns_warm_variant_farm_animals", "spawns_warm_variant_frogs"); + put("minecraft:dripstone_caves", "is_overworld"); + put("minecraft:end_barrens", "is_end"); + put("minecraft:end_highlands", "is_end"); + put("minecraft:end_midlands", "is_end"); + put("minecraft:eroded_badlands", "is_badlands", "is_overworld"); + put("minecraft:flower_forest", "is_forest", "is_overworld"); + put("minecraft:forest", "is_forest", "is_overworld"); + put("minecraft:frozen_ocean", + "is_ocean", "is_overworld", "polar_bears_spawn_on_alternate_blocks", "spawns_cold_variant_farm_animals", + "spawns_cold_variant_frogs", "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:frozen_peaks", + "is_mountain", "is_overworld", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", + "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:frozen_river", + "is_overworld", "is_river", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", + "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:grove", + "is_forest", "is_overworld", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", + "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:ice_spikes", + "is_overworld", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", "spawns_snow_foxes", + "spawns_white_rabbits"); + put("minecraft:jagged_peaks", + "is_mountain", "is_overworld", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", + "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:jungle", "is_jungle", "is_overworld"); + put("minecraft:lukewarm_ocean", "is_ocean", "is_overworld", "spawns_warm_variant_farm_animals"); + put("minecraft:lush_caves", "allows_tropical_fish_spawns_at_any_height", "is_overworld"); + put("minecraft:mangrove_swamp", + "allows_surface_slime_spawns", "is_overworld", "spawns_warm_variant_farm_animals", + "spawns_warm_variant_frogs", "water_on_map_outlines"); + put("minecraft:meadow", "is_mountain", "is_overworld"); + put("minecraft:mushroom_fields", "is_overworld", "without_zombie_sieges"); + put("minecraft:nether_wastes", "is_nether"); + put("minecraft:ocean", "is_ocean", "is_overworld"); + put("minecraft:old_growth_birch_forest", "is_forest", "is_overworld"); + put("minecraft:old_growth_pine_taiga", + "is_overworld", "is_taiga", "spawns_cold_variant_farm_animals"); + put("minecraft:old_growth_spruce_taiga", + "is_overworld", "is_taiga", "spawns_cold_variant_farm_animals"); + put("minecraft:pale_garden", "is_forest", "is_overworld"); + put("minecraft:plains", "is_overworld"); + put("minecraft:river", "is_overworld", "is_river"); + put("minecraft:savanna", "is_overworld", "is_savanna"); + put("minecraft:savanna_plateau", "is_overworld", "is_savanna"); + put("minecraft:small_end_islands", "is_end"); + put("minecraft:snowy_beach", + "is_beach", "is_overworld", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", + "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:snowy_plains", + "is_overworld", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", "spawns_snow_foxes", + "spawns_white_rabbits"); + put("minecraft:snowy_slopes", + "is_mountain", "is_overworld", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", + "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:snowy_taiga", + "is_overworld", "is_taiga", "spawns_cold_variant_farm_animals", "spawns_cold_variant_frogs", + "spawns_snow_foxes", "spawns_white_rabbits"); + put("minecraft:soul_sand_valley", "is_nether"); + put("minecraft:sparse_jungle", "is_jungle", "is_overworld"); + put("minecraft:stony_peaks", "is_mountain", "is_overworld", "spawns_cold_variant_farm_animals"); + put("minecraft:stony_shore", "is_overworld"); + put("minecraft:sulfur_caves", "is_overworld"); + put("minecraft:sunflower_plains", "is_overworld"); + put("minecraft:swamp", "allows_surface_slime_spawns", "is_overworld", "water_on_map_outlines"); + put("minecraft:taiga", "is_overworld", "is_taiga", "spawns_cold_variant_farm_animals"); + put("minecraft:the_end", "is_end"); + put("minecraft:the_void", "without_wandering_trader_spawns"); + put("minecraft:warm_ocean", + "is_ocean", "is_overworld", "produces_corals_from_bonemeal", "spawns_coral_variant_zombie_nautilus", + "spawns_warm_variant_farm_animals", "spawns_warm_variant_frogs"); + put("minecraft:warped_forest", "is_nether"); + put("minecraft:windswept_forest", + "is_hill", "is_overworld", "spawns_cold_variant_farm_animals"); + put("minecraft:windswept_gravelly_hills", + "is_hill", "is_overworld", "spawns_cold_variant_farm_animals"); + put("minecraft:windswept_hills", "is_hill", "is_overworld", "spawns_cold_variant_farm_animals"); + put("minecraft:windswept_savanna", "is_overworld", "is_savanna"); + put("minecraft:wooded_badlands", "is_badlands", "is_overworld"); + } +} diff --git a/core/src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimensionContractException.java b/core/src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimensionContractException.java new file mode 100644 index 000000000..d23bd3d54 --- /dev/null +++ b/core/src/main/java/art/arcane/iris/engine/object/world/dimension/IrisDimensionContractException.java @@ -0,0 +1,25 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.engine.object.world.dimension; + +public final class IrisDimensionContractException extends IllegalStateException { + public IrisDimensionContractException(String message) { + super(message); + } +}