2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/level/block/BlockNote.java
|
|
|
|
+++ b/net/minecraft/world/level/block/BlockNote.java
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -77,6 +77,7 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
if (flag1 != (Boolean) iblockdata.getValue(BlockNote.POWERED)) {
|
2019-04-23 04:00:00 +02:00
|
|
|
if (flag1) {
|
2022-12-07 17:00:00 +01:00
|
|
|
this.playNote((Entity) null, iblockdata, world, blockposition);
|
2021-11-21 23:00:00 +01:00
|
|
|
+ iblockdata = world.getBlockState(blockposition); // CraftBukkit - SPIGOT-5617: update in case changed in event
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockNote.POWERED, flag1), 3);
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -86,6 +87,12 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
|
2022-12-07 17:00:00 +01:00
|
|
|
private void playNote(@Nullable Entity entity, IBlockData iblockdata, World world, BlockPosition blockposition) {
|
|
|
|
if (!((BlockPropertyInstrument) iblockdata.getValue(BlockNote.INSTRUMENT)).requiresAirAbove() || world.getBlockState(blockposition.above()).isAir()) {
|
2018-07-15 02:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
2022-12-07 17:00:00 +01:00
|
|
|
+ org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, iblockdata.getValue(BlockNote.INSTRUMENT), iblockdata.getValue(BlockNote.NOTE));
|
2022-06-07 18:00:00 +02:00
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
2018-07-15 02:00:00 +02:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2022-06-07 18:00:00 +02:00
|
|
|
world.blockEvent(blockposition, this, 0, 0);
|
|
|
|
world.gameEvent(entity, GameEvent.NOTE_BLOCK_PLAY, blockposition);
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|