From 7de25fd330f3e1000bf5626239d58df851d940e3 Mon Sep 17 00:00:00 2001 From: Jake Potrebic <jake.m.potrebic@gmail.com> Date: Wed, 16 Jun 2021 15:57:49 -0700 Subject: [PATCH] update to Adventure 4.8.1 --- patches/api/Adventure.patch | 2 +- patches/server/Adventure.patch | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/patches/api/Adventure.patch b/patches/api/Adventure.patch index 82ea453668..0b3a7ebd09 100644 --- a/patches/api/Adventure.patch +++ b/patches/api/Adventure.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 api("org.yaml:snakeyaml:1.29") api("com.googlecode.json-simple:json-simple:1.1.1") // Paper api("it.unimi.dsi:fastutil:8.2.2") -+ api(platform("net.kyori:adventure-bom:4.7.0")) ++ api(platform("net.kyori:adventure-bom:4.8.1")) + api("net.kyori:adventure-api") + api("net.kyori:adventure-text-serializer-gson") + api("net.kyori:adventure-text-serializer-legacy") diff --git a/patches/server/Adventure.patch b/patches/server/Adventure.patch index a12eafa260..847731b40a 100644 --- a/patches/server/Adventure.patch +++ b/patches/server/Adventure.patch @@ -2335,6 +2335,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override ++ public void playSound(final net.kyori.adventure.sound.Sound sound, final net.kyori.adventure.sound.Sound.Emitter emitter) { ++ final Entity entity; ++ if (emitter == net.kyori.adventure.sound.Sound.Emitter.self()) { ++ entity = this.getHandle(); ++ } else if (emitter instanceof org.bukkit.entity.Entity) { ++ entity = ((CraftEntity) emitter).getHandle(); ++ } else { ++ throw new IllegalArgumentException("Sound emitter must be an Entity or self(), but was: " + emitter); ++ } ++ ++ final ResourceLocation name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name()); ++ final java.util.Optional<net.minecraft.sounds.SoundEvent> event = net.minecraft.core.Registry.SOUND_EVENT.getOptional(name); ++ if (event.isPresent()) { ++ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSoundEntityPacket(event.get(), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), entity, sound.volume(), sound.pitch())); ++ } ++ } ++ ++ @Override + public void stopSound(final net.kyori.adventure.sound.SoundStop stop) { + this.getHandle().connection.send(new ClientboundStopSoundPacket( + io.papermc.paper.adventure.PaperAdventure.asVanillaNullable(stop.sound()),