diff --git a/.github/modules.json b/.github/modules.json
index 6d9b6dea..51f53fac 100644
--- a/.github/modules.json
+++ b/.github/modules.json
@@ -4,15 +4,15 @@
{ "module": "config", "needs": [] },
{ "module": "integration", "needs": [] },
{ "module": "moveable-entity-block", "needs": [] },
- { "module": "network", "needs": [] },
{ "module": "rendering", "needs": [] },
{ "module": "space-select", "needs": [] },
- { "module": "font", "needs": ["rendering"] },
- { "module": "util", "needs": ["codec"] },
+ { "module": "network", "needs": ["config"] },
+ { "module": "font", "needs": ["rendering"] },
+ { "module": "util", "needs": ["codec"] },
{ "module": "explosion", "needs": ["config"] },
- { "module": "rpc", "needs": ["network"] },
+ { "module": "rpc", "needs": ["network"] },
{ "module": "multiblock", "needs": ["codec", "config", "network", "util"] },
{ "module": "recipe", "needs": ["codec", "config", "util"] },
{ "module": "registrum", "needs": ["util"] },
diff --git a/module.explosion/src/main/resources/assets/anvillib_explosion/lang/zh_cn.json b/module.explosion/src/main/resources/assets/anvillib_explosion/lang/zh_cn.json
index e9edafbb..031ba4b1 100644
--- a/module.explosion/src/main/resources/assets/anvillib_explosion/lang/zh_cn.json
+++ b/module.explosion/src/main/resources/assets/anvillib_explosion/lang/zh_cn.json
@@ -3,7 +3,7 @@
"anvillib_explosion.configuration.default_remove_blocks_per_tick.tooltip": "每 tick 内可以删除的方块的默认数量",
"anvillib_explosion.configuration.max_remove_blocks_per_tick": "最大每 tick 移除的方块数",
"anvillib_explosion.configuration.max_remove_blocks_per_tick.tooltip": "每 tick 内可以删除的方块的最大数量",
- "anvillib_explosion.configuration.section.anvillib.explosion.common.toml": "Anvillib Explosion 通用 配置",
- "anvillib_explosion.configuration.section.anvillib.explosion.common.toml.title": "Anvillib Explosion 通用 配置",
- "anvillib_explosion.configuration.title": "Anvillib Explosion 配置"
+ "anvillib_explosion.configuration.section.anvillib.explosion.common.toml": "AnvilLib Explosion 通用 配置",
+ "anvillib_explosion.configuration.section.anvillib.explosion.common.toml.title": "AnvilLib Explosion 通用 配置",
+ "anvillib_explosion.configuration.title": "AnvilLib Explosion 配置"
}
\ No newline at end of file
diff --git a/module.font/src/main/resources/assets/anvillib_font/lang/zh_cn.json b/module.font/src/main/resources/assets/anvillib_font/lang/zh_cn.json
index 0e37a159..89f260fe 100644
--- a/module.font/src/main/resources/assets/anvillib_font/lang/zh_cn.json
+++ b/module.font/src/main/resources/assets/anvillib_font/lang/zh_cn.json
@@ -1,7 +1,7 @@
{
"narration.anvillib_font.dropdown.collapsed": "折叠",
"narration.anvillib_font.dropdown.expanded": "展开",
- "screen.anvillib_font.config": "铁砧库 文字渲染 配置",
+ "screen.anvillib_font.config": "AnvilLib 文字渲染 配置",
"screen.anvillib_font.config.family": "字体系列",
"screen.anvillib_font.config.font": "字体",
"screen.anvillib_font.config.test": "文字渲染测试"
diff --git a/module.multiblock/src/main/resources/assets/anvillib_multiblock/lang/zh_cn.json b/module.multiblock/src/main/resources/assets/anvillib_multiblock/lang/zh_cn.json
index 2c745d1c..0620d532 100644
--- a/module.multiblock/src/main/resources/assets/anvillib_multiblock/lang/zh_cn.json
+++ b/module.multiblock/src/main/resources/assets/anvillib_multiblock/lang/zh_cn.json
@@ -5,9 +5,9 @@
"anvillib_multiblock.configuration.formed_multiblock_check_interval.tooltip": "已成型的多方块的检查周期(以tick为单位)",
"anvillib_multiblock.configuration.max_checks_per_tick": "每 tick 最大检查数量",
"anvillib_multiblock.configuration.max_checks_per_tick.tooltip": "每 tick 提交多方块检查的最大数量",
- "anvillib_multiblock.configuration.section.anvillib_multiblock.common.toml": "铁砧库-多方块 通用配置",
- "anvillib_multiblock.configuration.section.anvillib_multiblock.common.toml.title": "铁砧库-多方块 通用配置",
- "anvillib_multiblock.configuration.title": "铁砧库-多方块 配置",
+ "anvillib_multiblock.configuration.section.anvillib_multiblock.common.toml": "AnvilLib 多方块 通用 配置",
+ "anvillib_multiblock.configuration.section.anvillib_multiblock.common.toml.title": "AnvilLib 多方块 通用 配置",
+ "anvillib_multiblock.configuration.title": "AnvilLib 多方块 配置",
"anvillib_multiblock.configuration.unformed_multiblock_check_interval": "未成型多方块检查周期",
"anvillib_multiblock.configuration.unformed_multiblock_check_interval.tooltip": "未成型的多方块的检查周期(以tick为单位)"
}
\ No newline at end of file
diff --git a/module.network/build.gradle b/module.network/build.gradle
index 7d82dc72..5f097527 100644
--- a/module.network/build.gradle
+++ b/module.network/build.gradle
@@ -1,2 +1,8 @@
dependencies {
+ if (System.getenv("NOT_DEV") == 'true') {
+ jarJar(api("dev.anvilcraft.lib:anvillib-config-neoforge-26.1:latest.release"))
+ } else {
+ jarJar(implementation project(":anvillib-config-neoforge-26.1"))
+ }
+ jarJar(implementation("at.yawk.lz4:lz4-java:1.10.1"))
}
diff --git a/module.network/gradle.properties b/module.network/gradle.properties
index 842f5bd0..06299884 100644
--- a/module.network/gradle.properties
+++ b/module.network/gradle.properties
@@ -2,3 +2,6 @@
mod_id=anvillib_network
mod_name=AnvilLib-Network
mod_description=Network API with direction-specific packets and automatic registry
+
+anvillib.needRunConfig=true
+anvillib.needRunConfig.data=true
diff --git a/module.network/src/generated/resources/assets/anvillib_network/lang/en_us.json b/module.network/src/generated/resources/assets/anvillib_network/lang/en_us.json
new file mode 100644
index 00000000..47651f87
--- /dev/null
+++ b/module.network/src/generated/resources/assets/anvillib_network/lang/en_us.json
@@ -0,0 +1,11 @@
+{
+ "anvillib_network.configuration.default_compression_algorithm": "Default Compression Algorithm",
+ "anvillib_network.configuration.default_compression_algorithm.tooltip": "The default compression algorithm to use for network packets.\nDefault: LZ4\n- NONE No compression\n- LZ4 Extremely fast compression and decompression speed\n- GZIP Maximum compatibility\n",
+ "anvillib_network.configuration.max_decompressed_size": "Max Decompressed Size",
+ "anvillib_network.configuration.max_decompressed_size.tooltip": "The maximum decompressed size in bytes.\nDefault: 16777216\n",
+ "anvillib_network.configuration.section.anvillib.network.server.toml": "Anvillib Network Server Configuration",
+ "anvillib_network.configuration.section.anvillib.network.server.toml.title": "Anvillib Network Server Configuration",
+ "anvillib_network.configuration.threshold": "Threshold",
+ "anvillib_network.configuration.threshold.tooltip": "The threshold for compression in bytes.\nDefault: 128\n",
+ "anvillib_network.configuration.title": "Anvillib Network Configuration"
+}
\ No newline at end of file
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/AnvilLibNetwork.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/AnvilLibNetwork.java
new file mode 100644
index 00000000..7b20430f
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/AnvilLibNetwork.java
@@ -0,0 +1,13 @@
+package dev.anvilcraft.lib.v2.network;
+
+import dev.anvilcraft.lib.v2.config.ConfigManager;
+import net.neoforged.fml.common.Mod;
+
+@Mod(AnvilLibNetwork.MOD_ID)
+public class AnvilLibNetwork {
+ public static final String MOD_ID = "anvillib_network";
+ public static final AnvilLibNetworkServerConfig CONFIG = ConfigManager.register(
+ AnvilLibNetwork.MOD_ID,
+ AnvilLibNetworkServerConfig::new
+ );
+}
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/AnvilLibNetworkServerConfig.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/AnvilLibNetworkServerConfig.java
new file mode 100644
index 00000000..3d3d9a9c
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/AnvilLibNetworkServerConfig.java
@@ -0,0 +1,37 @@
+package dev.anvilcraft.lib.v2.network;
+
+import dev.anvilcraft.lib.v2.config.BoundedDiscrete;
+import dev.anvilcraft.lib.v2.config.Comment;
+import dev.anvilcraft.lib.v2.config.Config;
+import dev.anvilcraft.lib.v2.network.compression.CompressionAlgorithm;
+import net.neoforged.fml.config.ModConfig;
+
+@Config(name = "anvillib_network", group = "anvillib", type = ModConfig.Type.SERVER)
+public class AnvilLibNetworkServerConfig {
+ @Comment(
+ """
+ The default compression algorithm to use for network packets.
+ Default: LZ4
+ - NONE No compression
+ - LZ4 Extremely fast compression and decompression speed
+ - GZIP Maximum compatibility
+ """
+ )
+ public volatile CompressionAlgorithm defaultCompressionAlgorithm = CompressionAlgorithm.LZ4;
+ @Comment(
+ """
+ The threshold for compression in bytes.
+ Default: 128
+ """
+ )
+ @BoundedDiscrete(min = 1, max = 1024)
+ public volatile int threshold = 128;
+ @Comment(
+ """
+ The maximum decompressed size in bytes.
+ Default: 16777216
+ """
+ )
+ @BoundedDiscrete(min = 1048576, max = 268435456)
+ public volatile int maxDecompressedSize = 16777216;
+}
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/CompressionAlgorithm.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/CompressionAlgorithm.java
new file mode 100644
index 00000000..d5181498
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/CompressionAlgorithm.java
@@ -0,0 +1,27 @@
+package dev.anvilcraft.lib.v2.network.compression;
+
+/**
+ * Compression algorithms supported by the AnvilLib byte payload wire format.
+ */
+public enum CompressionAlgorithm {
+ NONE(0),
+ LZ4(1),
+ GZIP(2);
+
+ private final int id;
+
+ CompressionAlgorithm(int id) {
+ this.id = id;
+ }
+
+ public int id() {
+ return this.id;
+ }
+
+ static CompressionAlgorithm byId(int id) {
+ for (CompressionAlgorithm algorithm : values()) {
+ if (algorithm.id == id) return algorithm;
+ }
+ throw new IllegalArgumentException("Unknown payload compression algorithm id: " + id);
+ }
+}
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/PayloadCompression.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/PayloadCompression.java
new file mode 100644
index 00000000..a6feee13
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/PayloadCompression.java
@@ -0,0 +1,184 @@
+package dev.anvilcraft.lib.v2.network.compression;
+
+import dev.anvilcraft.lib.v2.network.AnvilLibNetwork;
+import io.netty.buffer.ByteBuf;
+import net.jpountz.lz4.LZ4Factory;
+import net.minecraft.network.codec.ByteBufCodecs;
+import net.minecraft.network.codec.StreamCodec;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Objects;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+/**
+ * Shared compression envelope for opaque network payloads.
+ *
+ *
The wire format is an algorithm byte followed by the raw bytes for
+ * {@link CompressionAlgorithm#NONE}, or a VarInt uncompressed length and the
+ * compressed bytes for all other algorithms.
+ */
+public final class PayloadCompression {
+ public static final StreamCodec STREAM_CODEC = ByteBufCodecs.BYTE_ARRAY.map(
+ PayloadCompression::decode,
+ PayloadCompression::encode
+ );
+
+ private PayloadCompression() {
+ }
+
+ public static CompressionAlgorithm algorithm() {
+ return AnvilLibNetwork.CONFIG.defaultCompressionAlgorithm;
+ }
+
+ public static int threshold() {
+ return AnvilLibNetwork.CONFIG.threshold;
+ }
+
+ public static int maxDecompressedSize() {
+ return AnvilLibNetwork.CONFIG.maxDecompressedSize;
+ }
+
+ public static byte[] encode(byte[] data) {
+ Objects.requireNonNull(data, "data");
+ int threshold = threshold();
+ int maxSize = maxDecompressedSize();
+ CompressionAlgorithm algo = algorithm();
+ if (data.length > maxSize) {
+ throw new IllegalArgumentException("Payload exceeds maximum uncompressed size: " + data.length);
+ }
+
+ CompressionAlgorithm selected = data.length >= threshold ? algo : CompressionAlgorithm.NONE;
+ if (selected == CompressionAlgorithm.NONE) return uncompressed(data);
+
+ byte[] compressed = compress(selected, data);
+ int headerLength = 1 + varIntSize(data.length);
+ if (compressed.length + headerLength >= data.length + 1) return uncompressed(data);
+
+ ByteArrayOutputStream output = new ByteArrayOutputStream(headerLength + compressed.length);
+ output.write(selected.id());
+ writeVarInt(output, data.length);
+ output.writeBytes(compressed);
+ return output.toByteArray();
+ }
+
+ public static byte[] decode(byte[] envelope) {
+ Objects.requireNonNull(envelope, "envelope");
+ int maxSize = maxDecompressedSize();
+ if (envelope.length == 0) throw new IllegalArgumentException("Compressed payload envelope is empty");
+
+ CompressionAlgorithm selected = CompressionAlgorithm.byId(Byte.toUnsignedInt(envelope[0]));
+ if (selected == CompressionAlgorithm.NONE) {
+ int size = envelope.length - 1;
+ if (size > maxSize) {
+ throw new IllegalArgumentException("Payload exceeds maximum uncompressed size: " + size);
+ }
+ return Arrays.copyOfRange(envelope, 1, envelope.length);
+ }
+
+ VarInt length = readVarInt(envelope, 1);
+ if (length.value() < 0 || length.value() > maxSize) {
+ throw new IllegalArgumentException("Invalid decompressed payload size: " + length.value());
+ }
+ if (length.nextOffset() >= envelope.length) {
+ throw new IllegalArgumentException("Compressed payload has no body");
+ }
+
+ byte[] compressed = Arrays.copyOfRange(envelope, length.nextOffset(), envelope.length);
+ byte[] data = decompress(selected, compressed, length.value());
+ if (data.length != length.value()) {
+ throw new IllegalArgumentException("Decompressed payload size mismatch: expected " + length.value() + ", got " + data.length);
+ }
+ return data;
+ }
+
+ private static byte[] uncompressed(byte[] data) {
+ byte[] envelope = new byte[data.length + 1];
+ envelope[0] = (byte) CompressionAlgorithm.NONE.id();
+ System.arraycopy(data, 0, envelope, 1, data.length);
+ return envelope;
+ }
+
+ private static byte[] compress(CompressionAlgorithm selected, byte[] data) {
+ return switch (selected) {
+ case LZ4 -> LZ4Factory.fastestInstance().fastCompressor().compress(data);
+ case GZIP -> gzipCompress(data);
+ case NONE -> throw new IllegalArgumentException("NONE does not compress data");
+ };
+ }
+
+ private static byte[] decompress(CompressionAlgorithm selected, byte[] data, int originalLength) {
+ return switch (selected) {
+ case LZ4 -> LZ4Factory.fastestInstance().safeDecompressor().decompress(data, originalLength);
+ case GZIP -> gzipDecompress(data, originalLength);
+ case NONE -> throw new IllegalArgumentException("NONE does not decompress data");
+ };
+ }
+
+ private static byte[] gzipCompress(byte[] data) {
+ try {
+ ByteArrayOutputStream output = new ByteArrayOutputStream();
+ try (GZIPOutputStream gzip = new GZIPOutputStream(output)) {
+ gzip.write(data);
+ }
+ return output.toByteArray();
+ } catch (IOException e) {
+ throw new IllegalStateException("Failed to GZIP-compress payload", e);
+ }
+ }
+
+ private static byte[] gzipDecompress(byte[] data, int originalLength) {
+ try (GZIPInputStream gzip = new GZIPInputStream(new ByteArrayInputStream(data))) {
+ ByteArrayOutputStream output = new ByteArrayOutputStream(originalLength);
+ byte[] buffer = new byte[8192];
+ int total = 0;
+ int read;
+ while ((read = gzip.read(buffer)) >= 0) {
+ total += read;
+ if (total > originalLength) {
+ throw new IllegalArgumentException("GZIP payload exceeds declared decompressed size");
+ }
+ output.write(buffer, 0, read);
+ }
+ return output.toByteArray();
+ } catch (IOException e) {
+ throw new IllegalArgumentException("Failed to GZIP-decompress payload", e);
+ }
+ }
+
+ private static void writeVarInt(ByteArrayOutputStream output, int value) {
+ while ((value & -128) != 0) {
+ output.write(value & 127 | 128);
+ value >>>= 7;
+ }
+ output.write(value);
+ }
+
+ private static VarInt readVarInt(byte[] data, int offset) {
+ int value = 0;
+ int position = 0;
+ while (position < 32) {
+ if (offset >= data.length) throw new IllegalArgumentException("Truncated payload length VarInt");
+ byte current = data[offset++];
+ value |= (current & 127) << position;
+ if ((current & 128) == 0) return new VarInt(value, offset);
+ position += 7;
+ }
+ throw new IllegalArgumentException("Payload length VarInt is too large");
+ }
+
+ private static int varIntSize(int value) {
+ int size = 1;
+ while ((value & -128) != 0) {
+ size++;
+ value >>>= 7;
+ }
+ return size;
+ }
+
+ private record VarInt(int value, int nextOffset) {
+ }
+}
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/package-info.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/package-info.java
new file mode 100644
index 00000000..02042a54
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/compression/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package dev.anvilcraft.lib.v2.network.compression;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/AnvilLibDatagen.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/AnvilLibDatagen.java
new file mode 100644
index 00000000..72edd1f9
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/AnvilLibDatagen.java
@@ -0,0 +1,26 @@
+package dev.anvilcraft.lib.v2.network.data;
+
+import dev.anvilcraft.lib.v2.network.AnvilLibNetwork;
+import dev.anvilcraft.lib.v2.network.data.provider.ModLanguageProvider;
+import net.minecraft.data.DataGenerator;
+import net.minecraft.data.PackOutput;
+import net.neoforged.bus.api.SubscribeEvent;
+import net.neoforged.fml.common.EventBusSubscriber;
+import net.neoforged.neoforge.data.event.GatherDataEvent;
+
+@EventBusSubscriber(modid = AnvilLibNetwork.MOD_ID)
+public class AnvilLibDatagen {
+ @SubscribeEvent
+ public static void gatherData(GatherDataEvent.Client event) {
+ DataGenerator generator = event.getGenerator();
+ PackOutput packOutput = generator.getPackOutput();
+ generator.addProvider(true, new ModLanguageProvider(packOutput));
+ }
+
+ @SubscribeEvent
+ public static void gatherData(GatherDataEvent.Server event) {
+ DataGenerator generator = event.getGenerator();
+ PackOutput packOutput = generator.getPackOutput();
+ generator.addProvider(false, new ModLanguageProvider(packOutput));
+ }
+}
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/package-info.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/package-info.java
new file mode 100644
index 00000000..efd2f6bb
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package dev.anvilcraft.lib.v2.network.data;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/provider/ModLanguageProvider.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/provider/ModLanguageProvider.java
new file mode 100644
index 00000000..5dc512e8
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/provider/ModLanguageProvider.java
@@ -0,0 +1,18 @@
+package dev.anvilcraft.lib.v2.network.data.provider;
+
+import dev.anvilcraft.lib.v2.config.ConfigData;
+import dev.anvilcraft.lib.v2.network.AnvilLibNetwork;
+import dev.anvilcraft.lib.v2.network.AnvilLibNetworkServerConfig;
+import net.minecraft.data.PackOutput;
+import net.neoforged.neoforge.common.data.LanguageProvider;
+
+public class ModLanguageProvider extends LanguageProvider {
+ public ModLanguageProvider(PackOutput output) {
+ super(output, AnvilLibNetwork.MOD_ID, "en_us");
+ }
+
+ @Override
+ protected void addTranslations() {
+ ConfigData.readConfigClass(this, AnvilLibNetworkServerConfig.class);
+ }
+}
diff --git a/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/provider/package-info.java b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/provider/package-info.java
new file mode 100644
index 00000000..8f3117a1
--- /dev/null
+++ b/module.network/src/main/java/dev/anvilcraft/lib/v2/network/data/provider/package-info.java
@@ -0,0 +1,4 @@
+@NullMarked
+package dev.anvilcraft.lib.v2.network.data.provider;
+
+import org.jspecify.annotations.NullMarked;
diff --git a/module.network/src/main/resources/assets/anvillib_network/lang/zh_cn.json b/module.network/src/main/resources/assets/anvillib_network/lang/zh_cn.json
new file mode 100644
index 00000000..59645596
--- /dev/null
+++ b/module.network/src/main/resources/assets/anvillib_network/lang/zh_cn.json
@@ -0,0 +1,11 @@
+{
+ "anvillib_network.configuration.default_compression_algorithm": "默认压缩算法",
+ "anvillib_network.configuration.default_compression_algorithm.tooltip": "用于网络数据包的默认压缩算法。\n默认值:LZ4\n- NONE 无压缩\n- LZ4 极快的压缩和解压速度\n- GZIP 最大兼容性",
+ "anvillib_network.configuration.max_decompressed_size": "最大解压大小",
+ "anvillib_network.configuration.max_decompressed_size.tooltip": "最大解压大小(以字节为单位)。\n默认值:16777216",
+ "anvillib_network.configuration.section.anvillib.network.server.toml": "AnvilLib 网络 服务器 配置",
+ "anvillib_network.configuration.section.anvillib.network.server.toml.title": "AnvilLib 网络 服务器 配置",
+ "anvillib_network.configuration.threshold": "阈值",
+ "anvillib_network.configuration.threshold.tooltip": "压缩阈值(以字节为单位)。\n默认值:128",
+ "anvillib_network.configuration.title": "AnvilLib 网络 配置"
+}
diff --git a/module.recipe/gradle.properties b/module.recipe/gradle.properties
index b4f3f842..8b99e320 100644
--- a/module.recipe/gradle.properties
+++ b/module.recipe/gradle.properties
@@ -4,3 +4,6 @@ interface_injection=true
mod_id=anvillib_recipe
mod_name=AnvilLib-Recipe
mod_description=In-world recipe system with custom triggers, predicates and outcomes
+
+anvillib.needRunConfig=true
+anvillib.needRunConfig.data=true
diff --git a/module.recipe/src/generated/resources/assets/anvillib_recipe/lang/en_us.json b/module.recipe/src/generated/resources/assets/anvillib_recipe/lang/en_us.json
new file mode 100644
index 00000000..f6ccf4f5
--- /dev/null
+++ b/module.recipe/src/generated/resources/assets/anvillib_recipe/lang/en_us.json
@@ -0,0 +1,7 @@
+{
+ "anvillib_recipe.configuration.in_world_recipe_max_efficiency": "In World Recipe Max Efficiency",
+ "anvillib_recipe.configuration.in_world_recipe_max_efficiency.tooltip": "Maximum efficiency of in world recipes",
+ "anvillib_recipe.configuration.section.anvillib.recipe.common.toml": "Anvillib Recipe Common Configuration",
+ "anvillib_recipe.configuration.section.anvillib.recipe.common.toml.title": "Anvillib Recipe Common Configuration",
+ "anvillib_recipe.configuration.title": "Anvillib Recipe Configuration"
+}
\ No newline at end of file
diff --git a/module.recipe/src/main/resources/assets/anvillib_recipe/lang/zh_cn.json b/module.recipe/src/main/resources/assets/anvillib_recipe/lang/zh_cn.json
new file mode 100644
index 00000000..3403caa2
--- /dev/null
+++ b/module.recipe/src/main/resources/assets/anvillib_recipe/lang/zh_cn.json
@@ -0,0 +1,7 @@
+{
+ "anvillib_recipe.configuration.in_world_recipe_max_efficiency": "世界配方最大效率",
+ "anvillib_recipe.configuration.in_world_recipe_max_efficiency.tooltip": "世界配方最大效率值",
+ "anvillib_recipe.configuration.section.anvillib.recipe.common.toml": "AnvilLib 配方 通用 配置",
+ "anvillib_recipe.configuration.section.anvillib.recipe.common.toml.title": "AnvilLib 配方 通用 配置",
+ "anvillib_recipe.configuration.title": "AnvilLib 配方 配置"
+}
\ No newline at end of file
diff --git a/module.registrum/gradle.properties b/module.registrum/gradle.properties
index f77737db..0c1f4698 100644
--- a/module.registrum/gradle.properties
+++ b/module.registrum/gradle.properties
@@ -2,6 +2,3 @@
mod_id=anvillib_registrum
mod_name=AnvilLib-Registrum
mod_description=Your mod's best friend - keep your registry objects simple and organized
-
-anvillib.needRunConfig=true
-anvillib.needRunConfig.data=true
\ No newline at end of file
diff --git a/module.registrum/src/generated/resources/assets/anvillib/lang/en_us.json b/module.registrum/src/generated/resources/assets/anvillib/lang/en_us.json
deleted file mode 100644
index 30018052..00000000
--- a/module.registrum/src/generated/resources/assets/anvillib/lang/en_us.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "anvillib.configuration.in_world_recipe_max_efficiency": "In World Recipe Max Efficiency",
- "anvillib.configuration.in_world_recipe_max_efficiency.tooltip": "Maximum efficiency of in world recipes",
- "anvillib.configuration.section.anvillib.common.toml": "Anvillib Common Configuration",
- "anvillib.configuration.section.anvillib.common.toml.title": "Anvillib Common Configuration",
- "anvillib.configuration.title": "Anvillib Configuration"
-}
\ No newline at end of file
diff --git a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/AnvilLibRpcNetwork.java b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/AnvilLibRpcNetwork.java
index a3323d74..8e912bd2 100644
--- a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/AnvilLibRpcNetwork.java
+++ b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/AnvilLibRpcNetwork.java
@@ -11,7 +11,7 @@
*/
@EventBusSubscriber(modid = AnvilLibRpc.MOD_ID)
public class AnvilLibRpcNetwork {
- public static final String NETWORK_VERSION = "1";
+ public static final String NETWORK_VERSION = "2";
@SubscribeEvent
public static void register(RegisterPayloadHandlersEvent event) {
diff --git a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcPayload.java b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcPayload.java
index 80a2d3f4..e6f5953a 100644
--- a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcPayload.java
+++ b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcPayload.java
@@ -2,12 +2,12 @@
import dev.anvilcraft.lib.v2.network.packet.IInsensitiveBiPacket;
import dev.anvilcraft.lib.v2.network.packet.IPacket;
+import dev.anvilcraft.lib.v2.network.compression.PayloadCompression;
import dev.anvilcraft.lib.v2.rpc.client.AnvilLibRpcClient;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.RegistryFriendlyByteBuf;
-import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.world.entity.player.Player;
@@ -34,7 +34,7 @@
public class RpcPayload implements IRpcPayload, IInsensitiveBiPacket {
public static final Type TYPE = IPacket.type(AnvilLibRpc.mod("rpc"));
public static final StreamCodec STREAM_CODEC = StreamCodec.composite(
- ByteBufCodecs.BYTE_ARRAY,
+ PayloadCompression.STREAM_CODEC,
RpcPayload::data,
RpcPayload::new
);
diff --git a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcRequestPayload.java b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcRequestPayload.java
index 54419504..0ecf3a46 100644
--- a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcRequestPayload.java
+++ b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcRequestPayload.java
@@ -2,12 +2,12 @@
import dev.anvilcraft.lib.v2.network.packet.IInsensitiveBiPacket;
import dev.anvilcraft.lib.v2.network.packet.IPacket;
+import dev.anvilcraft.lib.v2.network.compression.PayloadCompression;
import dev.anvilcraft.lib.v2.rpc.client.AnvilLibRpcClient;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.RegistryFriendlyByteBuf;
-import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.world.entity.player.Player;
@@ -26,7 +26,7 @@
public class RpcRequestPayload implements IRpcPayload, IInsensitiveBiPacket {
public static final Type TYPE = IPacket.type(AnvilLibRpc.mod("rpc_request"));
public static final StreamCodec STREAM_CODEC = StreamCodec.composite(
- ByteBufCodecs.BYTE_ARRAY,
+ PayloadCompression.STREAM_CODEC,
RpcRequestPayload::data,
RpcRequestPayload::new
);
diff --git a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcResponsePayload.java b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcResponsePayload.java
index 88a61e1e..e07ee2cd 100644
--- a/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcResponsePayload.java
+++ b/module.rpc/src/main/java/dev/anvilcraft/lib/v2/rpc/RpcResponsePayload.java
@@ -2,12 +2,12 @@
import dev.anvilcraft.lib.v2.network.packet.IInsensitiveBiPacket;
import dev.anvilcraft.lib.v2.network.packet.IPacket;
+import dev.anvilcraft.lib.v2.network.compression.PayloadCompression;
import dev.anvilcraft.lib.v2.rpc.client.AnvilLibRpcClient;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.core.RegistryAccess;
import net.minecraft.network.RegistryFriendlyByteBuf;
-import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.world.entity.player.Player;
@@ -28,7 +28,7 @@
public class RpcResponsePayload implements IInsensitiveBiPacket {
public static final Type TYPE = IPacket.type(AnvilLibRpc.mod("rpc_response"));
public static final StreamCodec STREAM_CODEC = StreamCodec.composite(
- ByteBufCodecs.BYTE_ARRAY,
+ PayloadCompression.STREAM_CODEC,
RpcResponsePayload::data,
RpcResponsePayload::new
);
diff --git a/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/AnvilLibSyncNetwork.java b/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/AnvilLibSyncNetwork.java
index ac083108..3fe90ef2 100644
--- a/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/AnvilLibSyncNetwork.java
+++ b/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/AnvilLibSyncNetwork.java
@@ -9,7 +9,7 @@
@EventBusSubscriber(modid = AnvilLibSync.MOD_ID)
public class AnvilLibSyncNetwork {
- public static final String NETWORK_VERSION = "1";
+ public static final String NETWORK_VERSION = "2";
@SubscribeEvent
public static void register(RegisterPayloadHandlersEvent event) {
diff --git a/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/LazySyncPayload.java b/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/LazySyncPayload.java
index f2a45fb9..612fef09 100644
--- a/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/LazySyncPayload.java
+++ b/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/LazySyncPayload.java
@@ -2,6 +2,7 @@
import dev.anvilcraft.lib.v2.network.packet.IInsensitiveBiPacket;
import dev.anvilcraft.lib.v2.network.packet.IPacket;
+import dev.anvilcraft.lib.v2.network.compression.PayloadCompression;
import dev.anvilcraft.lib.v2.sync.AnvilLibSync;
import dev.anvilcraft.lib.v2.sync.client.AnvilLibSyncClient;
import dev.anvilcraft.lib.v2.sync.management.LazySyncManager;
@@ -12,7 +13,6 @@
import io.netty.buffer.Unpooled;
import lombok.extern.slf4j.Slf4j;
import net.minecraft.network.FriendlyByteBuf;
-import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.PacketFlow;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
@@ -45,7 +45,7 @@ public record LazySyncPayload(
) implements IInsensitiveBiPacket {
public static final Type TYPE = IPacket.type(AnvilLibSync.of("lazy_sync"));
public static final StreamCodec STREAM_CODEC = StreamCodec.composite(
- ByteBufCodecs.BYTE_ARRAY,
+ PayloadCompression.STREAM_CODEC,
LazySyncPayload::array,
LazySyncPayload::new
);
diff --git a/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/SyncPayload.java b/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/SyncPayload.java
index 4f32d539..1cdcd090 100644
--- a/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/SyncPayload.java
+++ b/module.sync/src/main/java/dev/anvilcraft/lib/v2/sync/network/payload/SyncPayload.java
@@ -2,6 +2,7 @@
import dev.anvilcraft.lib.v2.network.packet.IInsensitiveBiPacket;
import dev.anvilcraft.lib.v2.network.packet.IPacket;
+import dev.anvilcraft.lib.v2.network.compression.PayloadCompression;
import dev.anvilcraft.lib.v2.sync.AnvilLibSync;
import dev.anvilcraft.lib.v2.sync.client.AnvilLibSyncClient;
import dev.anvilcraft.lib.v2.sync.management.SyncProxy;
@@ -12,7 +13,6 @@
import io.netty.buffer.Unpooled;
import lombok.SneakyThrows;
import net.minecraft.network.FriendlyByteBuf;
-import net.minecraft.network.codec.ByteBufCodecs;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.PacketFlow;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
@@ -27,7 +27,7 @@ public record SyncPayload(
) implements IInsensitiveBiPacket {
public static final Type TYPE = IPacket.type(AnvilLibSync.of("sync"));
public static final StreamCodec STREAM_CODEC = StreamCodec.composite(
- ByteBufCodecs.BYTE_ARRAY,
+ PayloadCompression.STREAM_CODEC,
SyncPayload::array,
SyncPayload::new
);
diff --git a/module.wheel/gradle.properties b/module.wheel/gradle.properties
index 66c7eb2e..a0b4ee75 100644
--- a/module.wheel/gradle.properties
+++ b/module.wheel/gradle.properties
@@ -2,6 +2,3 @@
mod_id=anvillib_wheel
mod_name=AnvilLib-Wheel
mod_description=Provides the AnvilLib Wheel radial menu API.
-
-anvillib.needRunConfig=true
-anvillib.needRunConfig.data=true
diff --git a/module.wheel/src/generated/resources/assets/anvillib/lang/en_us.json b/module.wheel/src/generated/resources/assets/anvillib/lang/en_us.json
deleted file mode 100644
index 30018052..00000000
--- a/module.wheel/src/generated/resources/assets/anvillib/lang/en_us.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "anvillib.configuration.in_world_recipe_max_efficiency": "In World Recipe Max Efficiency",
- "anvillib.configuration.in_world_recipe_max_efficiency.tooltip": "Maximum efficiency of in world recipes",
- "anvillib.configuration.section.anvillib.common.toml": "Anvillib Common Configuration",
- "anvillib.configuration.section.anvillib.common.toml.title": "Anvillib Common Configuration",
- "anvillib.configuration.title": "Anvillib Configuration"
-}
\ No newline at end of file
diff --git a/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/AnvilLibWheel.java b/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/AnvilLibWheel.java
index 5838e423..3af20981 100644
--- a/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/AnvilLibWheel.java
+++ b/module.wheel/src/main/java/dev/anvilcraft/lib/v2/wheel/AnvilLibWheel.java
@@ -11,7 +11,6 @@
@EventBusSubscriber(modid = AnvilLibWheel.MOD_ID, value = Dist.CLIENT)
public class AnvilLibWheel {
public static final String MOD_ID = "anvillib_wheel";
- public static final String MAIN_ID = "anvillib";
@Getter
private static LibDynamicUniforms libDynamicUniforms;
@@ -21,6 +20,6 @@ public static void init(ConfigureMainRenderTargetEvent event) {
}
public static Identifier of(String path) {
- return Identifier.fromNamespaceAndPath(AnvilLibWheel.MAIN_ID, path);
+ return Identifier.fromNamespaceAndPath(AnvilLibWheel.MOD_ID, path);
}
}
diff --git a/module.wheel/src/main/resources/assets/anvillib/shaders/core/annular_sector.fsh b/module.wheel/src/main/resources/assets/anvillib_wheel/shaders/core/annular_sector.fsh
similarity index 100%
rename from module.wheel/src/main/resources/assets/anvillib/shaders/core/annular_sector.fsh
rename to module.wheel/src/main/resources/assets/anvillib_wheel/shaders/core/annular_sector.fsh
diff --git a/module.wheel/src/main/resources/assets/anvillib/shaders/core/ring.fsh b/module.wheel/src/main/resources/assets/anvillib_wheel/shaders/core/ring.fsh
similarity index 100%
rename from module.wheel/src/main/resources/assets/anvillib/shaders/core/ring.fsh
rename to module.wheel/src/main/resources/assets/anvillib_wheel/shaders/core/ring.fsh
diff --git a/module.wheel/src/main/resources/assets/anvillib/shaders/core/selection.fsh b/module.wheel/src/main/resources/assets/anvillib_wheel/shaders/core/selection.fsh
similarity index 100%
rename from module.wheel/src/main/resources/assets/anvillib/shaders/core/selection.fsh
rename to module.wheel/src/main/resources/assets/anvillib_wheel/shaders/core/selection.fsh