Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
last instrument fix, I promise
Dieser Commit ist enthalten in:
Ursprung
2ad5f6f66b
Commit
b4a8f14a67
@ -6,10 +6,10 @@ Subject: [PATCH] fix Instruments
|
|||||||
properly handle Player#playNote
|
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
|
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
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/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) {
|
public void playNote(Location loc, Instrument instrument, Note note) {
|
||||||
if (this.getHandle().connection == null) return;
|
if (this.getHandle().connection == null) return;
|
||||||
|
|
||||||
@ -66,11 +66,20 @@ index c628cbff6302e4b559964824fa61a1566b83cd9f..57ace8a66b3e5ea3f79462f02f0d7605
|
|||||||
- case 16:
|
- case 16:
|
||||||
- instrumentName = "xylophone";
|
- instrumentName = "xylophone";
|
||||||
- break;
|
- break;
|
||||||
- }
|
+ // 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); // Paper - really?
|
+ net.minecraft.world.level.block.state.properties.NoteBlockInstrument nms = CraftBlockData.toNMS(instrument, net.minecraft.world.level.block.state.properties.NoteBlockInstrument.class);
|
||||||
float f = (float) Math.pow(2.0D, (note.getId() - 12.0D) / 12.0D);
|
+ 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(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
|
@Override
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren