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.
This commit is contained in:
Encode42
2025-01-10 02:01:54 -08:00
committed by granny
parent fdb1d7b224
commit 39ffbb788f
3 changed files with 13 additions and 45 deletions

View File

@@ -0,0 +1,11 @@
--- a/net/minecraft/world/level/block/NoteBlock.java
+++ b/net/minecraft/world/level/block/NoteBlock.java
@@ -107,7 +_,7 @@
}
private void playNote(@Nullable Entity entity, BlockState state, Level level, BlockPos pos) {
- if (state.getValue(INSTRUMENT).worksAboveNoteBlock() || level.getBlockState(pos.above()).isAir()) {
+ if (level.purpurConfig.noteBlockIgnoreAbove || state.getValue(INSTRUMENT).worksAboveNoteBlock() || level.getBlockState(pos.above()).isAir()) { // Purpur - Config to allow Note Block sounds when blocked
// CraftBukkit start
// org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, pos, state.getValue(NoteBlock.INSTRUMENT), state.getValue(NoteBlock.NOTE));
// if (event.isCancelled()) {

View File

@@ -116,6 +116,7 @@ public class PurpurWorldConfig {
public boolean entitiesPickUpLootBypassMobGriefing = false;
public boolean fireballsBypassMobGriefing = false;
public boolean projectilesBypassMobGriefing = false;
public boolean noteBlockIgnoreAbove = false;
private void miscGameplayMechanicsSettings() {
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
@@ -130,7 +131,7 @@ public class PurpurWorldConfig {
entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
fireballsBypassMobGriefing = getBoolean("gameplay-mechanics.fireballs-bypass-mob-griefing", fireballsBypassMobGriefing);
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
}
public int daytimeTicks = 12000;