Files
Purpur/patches/server/0138-Config-to-allow-Note-Block-sounds-when-blocked.patch
2021-11-25 08:13:15 -05:00

44 lines
3.2 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 0512b3701a3bf33891ab6281355c07af6be5b9c1..d79cf8df4be544c4402a2419cd9238bde6620fbb 100644
--- a/src/main/java/net/minecraft/world/level/block/NoteBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/NoteBlock.java
@@ -61,7 +61,7 @@ public class NoteBlock extends Block {
}
private void playNote(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));
if (!event.isCancelled()) {
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index f38b05448019805fd07f462e910c805cdffed219..4b885756730850fd7b5db52f74eb2e3d0be749f6 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -384,6 +384,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;
@@ -400,6 +401,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);