diff --git a/patches/server/0944-fix-Instruments.patch b/patches/server/0944-fix-Instruments.patch index 39a89920df..d880bb026e 100644 --- a/patches/server/0944-fix-Instruments.patch +++ b/patches/server/0944-fix-Instruments.patch @@ -6,10 +6,10 @@ 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 c628cbff6302e4b559964824fa61a1566b83cd9f..57ace8a66b3e5ea3f79462f02f0d7605e7410d98 100644 +index c628cbff6302e4b559964824fa61a1566b83cd9f..52071101c16ae84f69f1a00857b4895f328f6edd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -766,62 +766,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -766,62 +766,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { public void playNote(Location loc, Instrument instrument, Note note) { if (this.getHandle().connection == null) return; @@ -66,11 +66,20 @@ index c628cbff6302e4b559964824fa61a1566b83cd9f..57ace8a66b3e5ea3f79462f02f0d7605 - case 16: - instrumentName = "xylophone"; - break; -- } -+ net.minecraft.world.level.block.state.properties.NoteBlockInstrument nms = CraftBlockData.toNMS(instrument, net.minecraft.world.level.block.state.properties.NoteBlockInstrument.class); // Paper - really? - float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D); ++ // Paper start - fix all this (modeled off of NoteBlock) ++ net.minecraft.world.level.block.state.properties.NoteBlockInstrument nms = CraftBlockData.toNMS(instrument, net.minecraft.world.level.block.state.properties.NoteBlockInstrument.class); ++ float f; ++ if (nms.isTunable()) { ++ f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D); ++ } else { ++ f = 1.0f; + } +- float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D); - this.getHandle().connection.send(new ClientboundSoundPacket(BuiltInRegistries.SOUND_EVENT.wrapAsHolder(CraftSound.getSoundEffect("block.note_block." + instrumentName)), net.minecraft.sounds.SoundSource.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f, this.getHandle().getRandom().nextLong())); -+ this.getHandle().connection.send(new ClientboundSoundPacket(nms.getSoundEvent(), net.minecraft.sounds.SoundSource.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f, this.getHandle().getRandom().nextLong())); // Paper ++ if (!nms.hasCustomSound()) { ++ this.getHandle().connection.send(new ClientboundSoundPacket(nms.getSoundEvent(), net.minecraft.sounds.SoundSource.RECORDS, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), 3.0f, f, this.getHandle().getRandom().nextLong())); ++ } ++ // Paper end } @Override