|
|
|
@ -150,6 +150,7 @@ public abstract class FabricSerializer {
|
|
|
|
|
int VERSION1_20_2 = 3578; // Future
|
|
|
|
|
int VERSION1_20_4 = 3700; // Future
|
|
|
|
|
int VERSION1_20_5 = 3837; // Future
|
|
|
|
|
int VERSION1_21 = 3953; // Future
|
|
|
|
|
|
|
|
|
|
@NotNull
|
|
|
|
|
default ItemStack[] getItems(@NotNull NbtCompound tag, @NotNull Version mcVersion, @NotNull FabricHuskSync plugin) {
|
|
|
|
@ -158,15 +159,14 @@ public abstract class FabricSerializer {
|
|
|
|
|
return upgradeItemStacks(tag, mcVersion, plugin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final int size = tag.getInt("size");
|
|
|
|
|
final NbtList items = tag.getList("items", NbtElement.COMPOUND_TYPE);
|
|
|
|
|
final ItemStack[] itemStacks = new ItemStack[size];
|
|
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
|
|
final NbtCompound compound = items.getCompound(i);
|
|
|
|
|
final int slot = compound.getInt("Slot");
|
|
|
|
|
itemStacks[slot] = ItemStack.fromNbt(compound);
|
|
|
|
|
}
|
|
|
|
|
return itemStacks;
|
|
|
|
|
final ItemStack[] contents = new ItemStack[tag.getInt("size")];
|
|
|
|
|
final NbtList itemList = tag.getList("items", NbtElement.COMPOUND_TYPE);
|
|
|
|
|
itemList.forEach(element -> {
|
|
|
|
|
final NbtCompound compound = (NbtCompound) element;
|
|
|
|
|
contents[compound.getInt("Slot")] = ItemStack.fromNbt(compound);
|
|
|
|
|
});
|
|
|
|
|
plugin.debug(Arrays.toString(contents));
|
|
|
|
|
return contents;
|
|
|
|
|
} catch (Throwable e) {
|
|
|
|
|
throw new Serializer.DeserializationException("Failed to read item NBT string (%s)".formatted(tag), e);
|
|
|
|
|
}
|
|
|
|
@ -232,6 +232,7 @@ public abstract class FabricSerializer {
|
|
|
|
|
case "1.20.2" -> VERSION1_20_2; // Future
|
|
|
|
|
case "1.20.4" -> VERSION1_20_4; // Future
|
|
|
|
|
case "1.20.5", "1.20.6" -> VERSION1_20_5; // Future
|
|
|
|
|
case "1.21" -> VERSION1_21; // Future
|
|
|
|
|
default -> VERSION1_20_1; // Current supported ver
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|