Fix jukebox component (#11642)

This commit is contained in:
Lulu13022002 2024-11-23 20:09:34 +01:00 committed by GitHub
parent 915637df5c
commit 751e9bd125
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 206 additions and 211 deletions

View file

@ -4691,16 +4691,15 @@ index 0000000000000000000000000000000000000000..197224e31175252d8438a8df585bbb65
+}
diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..e85e544506b4c762503a1cb490e6c0f5b1d563f4
index 0000000000000000000000000000000000000000..9d97c9afa31bed6d2e6b7778bfe4cc41cea31c4d
--- /dev/null
+++ b/src/main/java/io/papermc/paper/util/MCUtil.java
@@ -0,0 +1,220 @@
@@ -0,0 +1,209 @@
+package io.papermc.paper.util;
+
+import com.google.common.collect.Collections2;
+import com.google.common.collect.Lists;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import io.papermc.paper.adventure.PaperAdventure;
+import io.papermc.paper.math.BlockPosition;
+import io.papermc.paper.math.FinePosition;
+import io.papermc.paper.math.Position;
@ -4716,15 +4715,10 @@ index 0000000000000000000000000000000000000000..e85e544506b4c762503a1cb490e6c0f5
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.function.Supplier;
+import net.kyori.adventure.key.Key;
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.Holder;
+import net.minecraft.core.Vec3i;
+import net.minecraft.core.registries.BuiltInRegistries;
+import net.minecraft.resources.ResourceKey;
+import net.minecraft.resources.ResourceLocation;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.sounds.SoundEvent;
+import net.minecraft.world.level.ChunkPos;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.phys.Vec3;
@ -4896,11 +4890,6 @@ index 0000000000000000000000000000000000000000..e85e544506b4c762503a1cb490e6c0f5
+ return CraftNamespacedKey.fromMinecraft(key.location());
+ }
+
+ public static Holder<SoundEvent> keyToSound(Key key) {
+ ResourceLocation soundId = PaperAdventure.asVanilla(key);
+ return BuiltInRegistries.SOUND_EVENT.wrapAsHolder(BuiltInRegistries.SOUND_EVENT.getOptional(soundId).orElse(SoundEvent.createVariableRangeEvent(soundId)));
+ }
+
+ public static <A, M> List<A> transformUnmodifiable(final List<? extends M> nms, final Function<? super M, ? extends A> converter) {
+ return Collections.unmodifiableList(Lists.transform(nms, converter::apply));
+ }