diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch new file mode 100644 index 0000000000..9694e75e40 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/level/block/NoteBlock.java.patch @@ -0,0 +1,37 @@ +--- a/net/minecraft/world/level/block/NoteBlock.java ++++ b/net/minecraft/world/level/block/NoteBlock.java +@@ -77,19 +76,27 @@ + } + + @Override +- public void neighborChanged(BlockState state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { +- boolean hasNeighborSignal = level.hasNeighborSignal(pos); +- if (hasNeighborSignal != state.getValue(POWERED)) { +- if (hasNeighborSignal) { +- this.playNote(null, state, level, pos); ++ public void neighborChanged(IBlockData state, Level level, BlockPos pos, Block block, BlockPos fromPos, boolean isMoving) { ++ boolean flag1 = level.hasNeighborSignal(pos); ++ ++ if (flag1 != (Boolean) state.getValue(NoteBlock.POWERED)) { ++ if (flag1) { ++ this.playNote((Entity) null, state, level, pos); ++ state = level.getBlockState(pos); // CraftBukkit - SPIGOT-5617: update in case changed in event + } + + level.setBlock(pos, state.setValue(POWERED, Boolean.valueOf(hasNeighborSignal)), 3); + } + } + +- private void playNote(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) { +- if (state.getValue(INSTRUMENT).worksAboveNoteBlock() || level.getBlockState(pos.above()).isAir()) { ++ 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); + } |