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:
7
fabric/1.21.6/gradle.properties
Normal file
7
fabric/1.21.6/gradle.properties
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.21.5
|
||||
1.21.6
|
||||
@@ -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)
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user