aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/level/block/BlockNote.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/level/block/BlockNote.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/level/block/BlockNote.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/level/block/BlockNote.patch b/patch-remap/og/net/minecraft/world/level/block/BlockNote.patch
new file mode 100644
index 0000000000..0d436f9471
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/level/block/BlockNote.patch
@@ -0,0 +1,23 @@
+--- a/net/minecraft/world/level/block/BlockNote.java
++++ b/net/minecraft/world/level/block/BlockNote.java
+@@ -82,6 +82,7 @@
+ if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
+ if (flag1) {
+ this.playNote((Entity) null, iblockdata, world, blockposition);
++ iblockdata = world.getBlockState(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
+ }
+
+ world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
+@@ -91,6 +92,12 @@
+
+ private void playNote(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
+ if (((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).worksAboveNoteBlock() || world.getBlockState(blockposition.above()).isAir()) {
++ // CraftBukkit start
++ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, iblockdata.getValue(BlockNote.INSTRUMENT), iblockdata.getValue(BlockNote.NOTE));
++ if (event.isCancelled()) {
++ return;
++ }
++ // CraftBukkit end
+ world.blockEvent(blockposition, this, 0, 0);
+ world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, blockposition);
+ }