mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
65bc2541a3
By: md_5 <git@md-5.net>
23 lines
1.4 KiB
Diff
23 lines
1.4 KiB
Diff
--- a/net/minecraft/world/level/block/BlockNote.java
|
|
+++ b/net/minecraft/world/level/block/BlockNote.java
|
|
@@ -83,6 +83,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);
|
|
@@ -92,6 +93,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, (Holder) GameEvent.NOTE_BLOCK_PLAY, blockposition);
|
|
}
|