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

44 lines
3.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Fri, 8 Jan 2021 16:07:32 -0500
Subject: [PATCH] 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.
diff --git a/src/main/java/net/minecraft/world/level/block/NoteBlock.java b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
index 58e8905a4b98e2e1ee372b99bdc3de9815063ac9..443bf39734ba2b0a7cdf0362d415ff176b2e8c85 100644
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
@@ -64,7 +64,7 @@ public class NoteBlock extends Block {
}
private void playNote(@Nullable Entity entity, Level world, BlockPos blockposition, BlockState data) { // CraftBukkit
- if (world.getBlockState(blockposition.above()).isAir()) {
+ if (world.purpurConfig.noteBlockIgnoreAbove || world.getBlockState(blockposition.above()).isAir()) { // Purpur
// CraftBukkit start
// org.bukkit.event.block.NotePlayEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callNotePlayEvent(world, blockposition, data.getValue(NoteBlock.INSTRUMENT), data.getValue(NoteBlock.NOTE)); // Paper - move event into block event handler
// if (event.isCancelled()) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index c7ea267c63a30ba8d2d65c5fe55c349ed29bda43..7988b6b572c83787ff0ab5f73ae49f097d8b391a 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -121,6 +121,7 @@ public class PurpurWorldConfig {
public boolean entitiesPickUpLootBypassMobGriefing = false;
public boolean fireballsBypassMobGriefing = false;
public boolean milkCuresBadOmen = true;
+ public boolean noteBlockIgnoreAbove = false;
public boolean persistentDroppableEntityDisplayNames = false;
public boolean projectilesBypassMobGriefing = false;
public double tridentLoyaltyVoidReturnHeight = 0.0D;
@@ -137,6 +138,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);
milkCuresBadOmen = getBoolean("gameplay-mechanics.milk-cures-bad-omen", milkCuresBadOmen);
+ noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
persistentDroppableEntityDisplayNames = getBoolean("gameplay-mechanics.persistent-droppable-entity-display-names", persistentDroppableEntityDisplayNames);
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
tridentLoyaltyVoidReturnHeight = getDouble("gameplay-mechanics.trident-loyalty-void-return-height", tridentLoyaltyVoidReturnHeight);