Skip to content

Commit 80c44d1

Browse files
encode42granny
authored andcommitted
Config to allow Note Block sounds when blocked
Allows for Note Blocks to ignore whether or not there's air above them to play. Normally, the sounds will only play when the block directly above is air. With this patch enabled, players can place any block above the Note Block and it will still work.
1 parent 7aef583 commit 80c44d1

3 files changed

Lines changed: 13 additions & 45 deletions

File tree

patches/server/0117-Config-to-allow-Note-Block-sounds-when-blocked.patch

Lines changed: 0 additions & 44 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/net/minecraft/world/level/block/NoteBlock.java
2+
+++ b/net/minecraft/world/level/block/NoteBlock.java
3+
@@ -107,7 +_,7 @@
4+
}
5+
6+
private void playNote(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) {
7+
- if (state.getValue(INSTRUMENT).worksAboveNoteBlock() || level.getBlockState(pos.above()).isAir()) {
8+
+ if (level.purpurConfig.noteBlockIgnoreAbove || state.getValue(INSTRUMENT).worksAboveNoteBlock() || level.getBlockState(pos.above()).isAir()) { // Purpur - Config to allow Note Block sounds when blocked
9+
// CraftBukkit start
10+
// org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, pos, state.getValue(NoteBlock.INSTRUMENT), state.getValue(NoteBlock.NOTE));
11+
// if (event.isCancelled()) {

purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ private void arrowSettings() {
116116
public boolean entitiesPickUpLootBypassMobGriefing = false;
117117
public boolean fireballsBypassMobGriefing = false;
118118
public boolean projectilesBypassMobGriefing = false;
119+
public boolean noteBlockIgnoreAbove = false;
119120
private void miscGameplayMechanicsSettings() {
120121
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
121122
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
@@ -130,7 +131,7 @@ private void miscGameplayMechanicsSettings() {
130131
entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
131132
fireballsBypassMobGriefing = getBoolean("gameplay-mechanics.fireballs-bypass-mob-griefing", fireballsBypassMobGriefing);
132133
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
133-
134+
noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
134135
}
135136

136137
public int daytimeTicks = 12000;

0 commit comments

Comments
 (0)