geforkt von Mirrors/Paper
90fe0d58a5
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 897a0a23 SPIGOT-5753: Back PotionType by a minecraft registry 255b2aa1 SPIGOT-7080: Add World#locateNearestBiome ff984826 Remove javadoc.io doc links CraftBukkit Changes: 71b0135cc SPIGOT-5753: Back PotionType by a minecraft registry a6bcb8489 SPIGOT-7080: Add World#locateNearestBiome ad0e57434 SPIGOT-7502: CraftMetaItem - cannot deserialize BlockStateTag b3efca57a SPIGOT-6400: Use Mockito instead of InvocationHandler 38c599f9d PR-1272: Only allow one entity in CraftItem instead of two f065271ac SPIGOT-7498: ChunkSnapshot.getBlockEmittedLight() gets 64 blocks upper in Overworld Spigot Changes: e0e223fe Remove javadoc.io doc links
54 Zeilen
2.9 KiB
Diff
54 Zeilen
2.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
Date: Fri, 9 Dec 2022 01:47:23 -0800
|
|
Subject: [PATCH] fix Instruments
|
|
|
|
properly handle Player#playNote
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
index 4096145769065693c6d67f092ccedccb78ef4578..292054f546669fe607715e2d39e8ed558fc6fc0c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -726,29 +726,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
|
|
if (this.getHandle().connection == null) return;
|
|
|
|
- Sound instrumentSound = switch (instrument.ordinal()) {
|
|
- case 0 -> Sound.BLOCK_NOTE_BLOCK_HARP;
|
|
- case 1 -> Sound.BLOCK_NOTE_BLOCK_BASEDRUM;
|
|
- case 2 -> Sound.BLOCK_NOTE_BLOCK_SNARE;
|
|
- case 3 -> Sound.BLOCK_NOTE_BLOCK_HAT;
|
|
- case 4 -> Sound.BLOCK_NOTE_BLOCK_BASS;
|
|
- case 5 -> Sound.BLOCK_NOTE_BLOCK_FLUTE;
|
|
- case 6 -> Sound.BLOCK_NOTE_BLOCK_BELL;
|
|
- case 7 -> Sound.BLOCK_NOTE_BLOCK_GUITAR;
|
|
- case 8 -> Sound.BLOCK_NOTE_BLOCK_CHIME;
|
|
- case 9 -> Sound.BLOCK_NOTE_BLOCK_XYLOPHONE;
|
|
- case 10 -> Sound.BLOCK_NOTE_BLOCK_IRON_XYLOPHONE;
|
|
- case 11 -> Sound.BLOCK_NOTE_BLOCK_COW_BELL;
|
|
- case 12 -> Sound.BLOCK_NOTE_BLOCK_DIDGERIDOO;
|
|
- case 13 -> Sound.BLOCK_NOTE_BLOCK_BIT;
|
|
- case 14 -> Sound.BLOCK_NOTE_BLOCK_BANJO;
|
|
- case 15 -> Sound.BLOCK_NOTE_BLOCK_PLING;
|
|
- case 16 -> Sound.BLOCK_NOTE_BLOCK_XYLOPHONE;
|
|
- default -> null;
|
|
- };
|
|
-
|
|
- float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D);
|
|
- this.getHandle().connection.send(new ClientboundSoundPacket(CraftSound.bukkitToMinecraftHolder(instrumentSound), net.minecraft.sounds.SoundSource.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f, this.getHandle().getRandom().nextLong()));
|
|
+ // Paper start - fix all this (modeled off of NoteBlock)
|
|
+ net.minecraft.world.level.block.state.properties.NoteBlockInstrument noteBlockInstrument = CraftBlockData.toNMS(instrument, net.minecraft.world.level.block.state.properties.NoteBlockInstrument.class);
|
|
+ float pitch;
|
|
+ if (noteBlockInstrument.isTunable()) {
|
|
+ pitch = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D);
|
|
+ } else {
|
|
+ pitch = 1.0f;
|
|
+ }
|
|
+ if (!noteBlockInstrument.hasCustomSound()) {
|
|
+ this.getHandle().connection.send(new ClientboundSoundPacket(noteBlockInstrument.getSoundEvent(), net.minecraft.sounds.SoundSource.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, pitch, this.getHandle().getRandom().nextLong()));
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|