aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch
new file mode 100644
index 0000000000..cee86bd747
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch
@@ -0,0 +1,33 @@
+--- a/net/minecraft/world/level/block/NoteBlock.java
++++ b/net/minecraft/world/level/block/NoteBlock.java
+@@ -85,7 +81,8 @@
+
+ if (flag1 != (Boolean) blockstate.getValue(NoteBlock.POWERED)) {
+ if (flag1) {
+- this.playNote((Entity) null, blockstate, level, blockpos);
++ this.playNote((Entity) null, state, level, pos);
++ state = level.getBlockState(pos); // CraftBukkit - SPIGOT-5617: update in case changed in event
+ }
+
+ level.setBlock(blockpos, (BlockState) blockstate.setValue(NoteBlock.POWERED, flag1), 3);
+@@ -93,10 +90,16 @@
+
+ }
+
+- private void playNote(@Nullable Entity entity, BlockState blockstate, Level level, BlockPos blockpos) {
+- if (((NoteBlockInstrument) blockstate.getValue(NoteBlock.INSTRUMENT)).worksAboveNoteBlock() || level.getBlockState(blockpos.above()).isAir()) {
+- level.blockEvent(blockpos, this, 0, 0);
+- level.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, blockpos);
++ private void playNote(@Nullable Entity entity, IBlockData state, Level level, BlockPos pos) {
++ if (((NoteBlockInstrument) state.getValue(NoteBlock.INSTRUMENT)).worksAboveNoteBlock() || level.getBlockState(pos.above()).isAir()) {
++ // CraftBukkit start
++ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(level, pos, state.getValue(NoteBlock.INSTRUMENT), state.getValue(NoteBlock.NOTE));
++ if (event.isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
++ level.blockEvent(pos, this, 0, 0);
++ level.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, pos);
+ }
+
+ }