9
0
mirror of https://github.com/WiIIiam278/HuskSync.git synced 2025-12-19 14:59:21 +00:00

feat: add support for Minecraft 1.21.6

This commit is contained in:
William278
2025-06-23 00:15:11 +01:00
parent 6050c584c0
commit e9f2856040
13 changed files with 68 additions and 30 deletions

View File

@@ -55,15 +55,19 @@ jobs:
paper-1.21.1
paper-1.21.4
paper-1.21.5
paper-1.21.6
fabric-1.20.1
fabric-1.21.1
fabric-1.21.4
fabric-1.21.5
fabric-1.21.6
distro-groups: |
paper
paper
paper
paper
paper
fabric
fabric
fabric
fabric
@@ -73,16 +77,20 @@ jobs:
Paper 1.21.1
Paper 1.21.4
Paper 1.21.5
Paper 1.21.6
Fabric 1.20.1
Fabric 1.21.1
Fabric 1.21.4
Fabric 1.21.5
Fabric 1.21.6
files: |
target/HuskSync-Bukkit-${{ env.version_name }}+mc.1.20.1.jar
target/HuskSync-Bukkit-${{ env.version_name }}+mc.1.21.1.jar
target/HuskSync-Bukkit-${{ env.version_name }}+mc.1.21.4.jar
target/HuskSync-Bukkit-${{ env.version_name }}+mc.1.21.5.jar
target/HuskSync-Bukkit-${{ env.version_name }}+mc.1.21.6.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.20.1.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.21.1.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.21.4.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.21.5.jar
target/HuskSync-Fabric-${{ env.version_name }}+mc.1.21.6.jar

View File

@@ -44,15 +44,19 @@ jobs:
paper-1.21.1
paper-1.21.4
paper-1.21.5
paper-1.21.6
fabric-1.20.1
fabric-1.21.1
fabric-1.21.4
fabric-1.21.5
fabric-1.21.6
distro-groups: |
paper
paper
paper
paper
paper
fabric
fabric
fabric
fabric
@@ -62,16 +66,20 @@ jobs:
Paper 1.21.1
Paper 1.21.4
Paper 1.21.5
Paper 1.21.6
Fabric 1.20.1
Fabric 1.21.1
Fabric 1.21.4
Fabric 1.21.5
Fabric 1.21.6
files: |
target/HuskSync-Bukkit-${{ github.event.release.tag_name }}+mc.1.20.1.jar
target/HuskSync-Bukkit-${{ github.event.release.tag_name }}+mc.1.21.1.jar
target/HuskSync-Bukkit-${{ github.event.release.tag_name }}+mc.1.21.4.jar
target/HuskSync-Bukkit-${{ github.event.release.tag_name }}+mc.1.21.5.jar
target/HuskSync-Bukkit-${{ github.event.release.tag_name }}+mc.1.21.6.jar
target/HuskSync-Fabric-${{ github.event.release.tag_name }}+mc.1.20.1.jar
target/HuskSync-Fabric-${{ github.event.release.tag_name }}+mc.1.21.1.jar
target/HuskSync-Fabric-${{ github.event.release.tag_name }}+mc.1.21.4.jar
target/HuskSync-Fabric-${{ github.event.release.tag_name }}+mc.1.21.5.jar
target/HuskSync-Fabric-${{ github.event.release.tag_name }}+mc.1.21.6.jar

View File

@@ -0,0 +1,3 @@
minecraft_version_numeric=12106
minecraft_api_version=1.21
paper_api_version=1.21.6-R0.1-SNAPSHOT

View File

@@ -8,9 +8,9 @@ plugins {
dependencies {
implementation project(path: ':common')
implementation 'net.william278.uniform:uniform-bukkit:1.3.4'
implementation 'net.william278.uniform:uniform-paper:1.3.4'
implementation 'net.william278.toilet:toilet-bukkit:1.0.13'
implementation 'net.william278.uniform:uniform-bukkit:1.3.5'
implementation 'net.william278.uniform:uniform-paper:1.3.5'
implementation 'net.william278.toilet:toilet-bukkit:1.0.14'
implementation 'net.william278:mpdbdataconverter:1.0.1'
implementation 'net.william278:hsldataconverter:1.0'
implementation 'net.william278:mapdataapi:2.0'

View File

@@ -354,9 +354,11 @@ public class BukkitHuskSync extends JavaPlugin implements HuskSync, BukkitTask.S
case "1.20.3", "1.20.4" -> DataFixerUtil.VERSION1_20_4;
case "1.20.5", "1.20.6" -> DataFixerUtil.VERSION1_20_5;
case "1.21", "1.21.1" -> DataFixerUtil.VERSION1_21;
case "1.21.2", "1.21.3" -> DataFixerUtil.VERSION1_21_2;
case "1.21.4" -> 4189;
case "1.21.2" -> DataFixerUtil.VERSION1_21_2;
case "1.21.3" -> DataFixerUtil.VERSION1_21_3;
case "1.21.4" -> DataFixerUtil.VERSION1_21_4;
case "1.21.5" -> DataFixerUtil.VERSION1_21_5;
case "1.21.6" -> 4435;
default -> DataFixerUtil.getCurrentVersion();
};
}

View File

@@ -17,15 +17,15 @@ dependencies {
exclude module: 'slf4j-api'
}
compileOnlyApi 'net.william278.toilet:toilet-common:1.0.13'
compileOnlyApi 'net.william278.toilet:toilet-common:1.0.14'
compileOnly 'net.william278.uniform:uniform-common:1.3.4'
compileOnly 'net.william278.uniform:uniform-common:1.3.5'
compileOnly 'com.mojang:brigadier:1.1.8'
compileOnly 'org.projectlombok:lombok:1.18.38'
compileOnly 'org.jetbrains:annotations:26.0.2'
compileOnly 'net.kyori:adventure-api:4.21.0'
compileOnly 'net.kyori:adventure-api:4.23.0'
compileOnly 'net.kyori:adventure-platform-api:4.4.0'
compileOnly "net.kyori:adventure-text-serializer-plain:4.21.0"
compileOnly "net.kyori:adventure-text-serializer-plain:4.23.0"
compileOnly 'com.google.guava:guava:33.4.8-jre'
compileOnly 'com.github.plan-player-analytics:Plan:5.6.2965'
compileOnly "redis.clients:jedis:$jedis_version"

View File

@@ -0,0 +1,7 @@
essential.defaults.loom.mappings=net.fabricmc:yarn:1.21.6+build.1:v2
fabric_loader_version=0.16.14
fabric_api_version=0.127.1+1.21.6
fabric_permissions_api_version=0.4.0
fabric_adventure_platform_version=6.5.0-SNAPSHOT
fabric_sgui_version=1.10.0+1.21.6

View File

@@ -14,8 +14,8 @@ dependencies {
modImplementation include("net.kyori:adventure-platform-fabric:${fabric_adventure_platform_version}")
modImplementation include("me.lucko:fabric-permissions-api:${fabric_permissions_api_version}")
modImplementation include("eu.pb4:sgui:${fabric_sgui_version}")
modImplementation include("net.william278.uniform:uniform-fabric:1.3.4+${project.name}")
modImplementation include("net.william278.toilet:toilet-fabric:1.0.13+${project.name}")
modImplementation include("net.william278.uniform:uniform-fabric:1.3.5+${project.name}")
modImplementation include("net.william278.toilet:toilet-fabric:1.0.14+${project.name}")
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"
// Manually include config deps due to the way including api deps works

View File

@@ -1 +1 @@
1.21.5
1.21.6

View File

@@ -3,13 +3,15 @@ plugins {
}
preprocess {
def fabric12106 = createNode("1.21.6", 12106, "yarn")
def fabric12105 = createNode("1.21.5", 12105, "yarn")
def fabric12104 = createNode("1.21.4", 12104, "yarn")
def fabric12101 = createNode("1.21.1", 12101, "yarn")
def fabric12001 = createNode("1.20.1", 12001, "yarn")
strictExtraMappings.set(true)
fabric12104.link(fabric12105, null)
fabric12101.link(fabric12105, null)
fabric12001.link(fabric12105, null)
fabric12105.link(fabric12106, null)
fabric12104.link(fabric12106, null)
fabric12101.link(fabric12106, null)
fabric12001.link(fabric12106, null)
}

View File

@@ -99,8 +99,9 @@ public class FabricHuskSync implements DedicatedServerModInitializer, HuskSync,
private static final int VERSION1_20_5 = 3837;
private static final int VERSION1_21_1 = 3955;
private static final int VERSION1_21_3 = 4082;
private static final int VERSION1_21_4 = 4189; // Current
private static final int VERSION1_21_4 = 4189;
private static final int VERSION1_21_5 = 4323;
private static final int VERSION1_21_6 = 4435;
private final HashMap<Identifier, Serializer<? extends Data>> serializers = Maps.newHashMap();
private final Map<UUID, Map<Identifier, Data>> playerCustomDataStore = Maps.newConcurrentMap();
@@ -387,10 +388,13 @@ public class FabricHuskSync implements DedicatedServerModInitializer, HuskSync,
case "1.21.2", "1.21.3" -> VERSION1_21_3;
case "1.21.4" -> VERSION1_21_4;
case "1.21.5" -> VERSION1_21_5;
//#if MC==12105
case "1.21.6" -> VERSION1_21_6;
//#if MC==12106
default -> VERSION1_21_6;
//#elseif MC==12105
//$$ default -> VERSION1_21_5;
//#elseif MC==12104
default -> VERSION1_21_4;
//$$ default -> VERSION1_21_4;
//#elseif MC==12101
//$$ default -> VERSION1_21_1;
//#elseif MC==12001

View File

@@ -272,12 +272,14 @@ public abstract class FabricSerializer {
}
@Nullable
private NbtCompound encodeNbt(@NotNull ItemStack item, @NotNull DynamicRegistryManager registryManager) {
private NbtCompound encodeNbt(@NotNull ItemStack item, @NotNull DynamicRegistryManager reg) {
try {
//#if MC>=12104
return (NbtCompound) item.toNbt(registryManager);
//#if MC>=12106
return (NbtCompound) ItemStack.CODEC.encodeStart(reg.getOps(NbtOps.INSTANCE), item).getOrThrow();
//#elseif MC>=12104
//$$ return (NbtCompound) item.toNbt(reg);
//#elseif MC==12101
//$$ return (NbtCompound) item.encode(registryManager);
//$$ return (NbtCompound) item.encode(reg);
//#elseif MC==12001
//$$ final NbtCompound compound = new NbtCompound();
//$$ item.writeNbt(compound);
@@ -289,14 +291,16 @@ public abstract class FabricSerializer {
}
@NotNull
private ItemStack decodeNbt(@NotNull NbtElement item, @NotNull DynamicRegistryManager registryManager) {
//#if MC==12001
private ItemStack decodeNbt(@NotNull NbtElement item, @NotNull DynamicRegistryManager reg) {
//#if MC>=12106
final @Nullable ItemStack stack = ItemStack.CODEC.decode(reg.getOps(NbtOps.INSTANCE), item).getOrThrow().getFirst();
//#elseif MC>12001
//$$ final @Nullable ItemStack stack = ItemStack.fromNbt(reg, item).orElse(null);
//#elseif MC==12001
//$$ final @Nullable ItemStack stack = ItemStack.fromNbt((NbtCompound) item);
//#else
final @Nullable ItemStack stack = ItemStack.fromNbt(registryManager, item).orElse(null);
//#endif
if (stack == null) {
throw new IllegalStateException("Failed to decode item NBT (got null 'fromNbt'): (%s)".formatted(item));
throw new IllegalStateException("Failed to decode item NBT (decode got null): (%s)".formatted(item));
}
return stack;
}

View File

@@ -4,7 +4,7 @@ org.gradle.daemon=true
javaVersion=21
# Plugin metadata
plugin_version=3.8.4
plugin_version=3.8.5
plugin_archive=husksync
plugin_description=A modern, cross-server player data synchronization system