From 4b3cf51ba5e2f65035ad24e841d6a8e69e1f562c Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sat, 2 Mar 2024 00:44:01 +0000 Subject: [PATCH] Update java and bedrock schema --- converter/build.gradle.kts | 10 +++++----- .../converter/converter/sound/SoundConverter.java | 11 ++++++----- .../converter/util/NioDirectoryFileTreeReader.java | 3 ++- pack-schema/generator/src/main/resources/schema | 2 +- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/converter/build.gradle.kts b/converter/build.gradle.kts index 80bba2d..0d45b28 100644 --- a/converter/build.gradle.kts +++ b/converter/build.gradle.kts @@ -4,11 +4,11 @@ dependencies { implementation("commons-io:commons-io:2.11.0") implementation("com.twelvemonkeys.imageio:imageio-tga:3.9.4") implementation("com.nukkitx.fastutil:fastutil-int-object-maps:8.5.3") - implementation("net.kyori:adventure-api:4.13.1") - implementation("net.kyori:adventure-text-serializer-gson:4.13.1") - implementation("net.kyori:adventure-text-serializer-legacy:4.13.1") - implementation("team.unnamed:creative-api:0.7.1-SNAPSHOT") - implementation("team.unnamed:creative-serializer-minecraft:0.7.1-SNAPSHOT") + implementation("net.kyori:adventure-api:4.14.0") + implementation("net.kyori:adventure-text-serializer-gson:4.14.0") + implementation("net.kyori:adventure-text-serializer-legacy:4.14.0") + implementation("team.unnamed:creative-api:1.7.0") + implementation("team.unnamed:creative-serializer-minecraft:1.7.0") compileOnly("com.google.auto.service:auto-service:1.0.1") annotationProcessor("com.google.auto.service:auto-service:1.0.1") diff --git a/converter/src/main/java/org/geysermc/pack/converter/converter/sound/SoundConverter.java b/converter/src/main/java/org/geysermc/pack/converter/converter/sound/SoundConverter.java index d9df2fc..d912f4a 100644 --- a/converter/src/main/java/org/geysermc/pack/converter/converter/sound/SoundConverter.java +++ b/converter/src/main/java/org/geysermc/pack/converter/converter/sound/SoundConverter.java @@ -36,7 +36,9 @@ import org.geysermc.pack.converter.converter.BaseConverter; import org.geysermc.pack.converter.converter.Converter; import org.geysermc.pack.converter.data.BaseConversionData; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Unmodifiable; import team.unnamed.creative.sound.Sound; +import team.unnamed.creative.sound.SoundEntry; import team.unnamed.creative.sound.SoundEvent; import team.unnamed.creative.sound.SoundRegistry; @@ -55,16 +57,15 @@ public class SoundConverter extends BaseConverter { public void convert(@NotNull PackConversionContext context) throws Exception { Collection registry = context.javaResourcePack().soundRegistries(); for (SoundRegistry soundRegistry : registry) { - Map sounds = soundRegistry.sounds(); + @Unmodifiable @NotNull Collection sounds = soundRegistry.sounds(); - for (Map.Entry entry : sounds.entrySet()) { - String key = entry.getKey(); - SoundEvent value = entry.getValue(); + for (SoundEvent value : sounds) { + String key = value.key().asString(); SoundDefinitions definition = new SoundDefinitions(); definition.useLegacyMaxDistance(true); // TODO: Needed? definition.maxDistance(64); // ??? - for (Sound sound : value.sounds()) { + for (SoundEntry sound : value.sounds()) { Sounds bedrockSound = new Sounds(); bedrockSound.name(BEDROCK_SOUNDS_LOCATION + "/" + sound.key().value()); bedrockSound.stream(sound.stream()); diff --git a/converter/src/main/java/org/geysermc/pack/converter/util/NioDirectoryFileTreeReader.java b/converter/src/main/java/org/geysermc/pack/converter/util/NioDirectoryFileTreeReader.java index f062802..791acd8 100644 --- a/converter/src/main/java/org/geysermc/pack/converter/util/NioDirectoryFileTreeReader.java +++ b/converter/src/main/java/org/geysermc/pack/converter/util/NioDirectoryFileTreeReader.java @@ -26,6 +26,7 @@ package org.geysermc.pack.converter.util; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import team.unnamed.creative.serialize.minecraft.fs.FileTreeReader; @@ -116,7 +117,7 @@ public final class NioDirectoryFileTreeReader implements FileTreeReader { } @Override - public InputStream input() { + public @NotNull InputStream stream() { return currentStream; } diff --git a/pack-schema/generator/src/main/resources/schema b/pack-schema/generator/src/main/resources/schema index 9ceffc0..2dbccee 160000 --- a/pack-schema/generator/src/main/resources/schema +++ b/pack-schema/generator/src/main/resources/schema @@ -1 +1 @@ -Subproject commit 9ceffc043e5e6b4274fda2076ae890073d12a954 +Subproject commit 2dbcceefcbbde9837e15108bd6aa71a3ebdd6a45