mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
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:
@@ -1,44 +0,0 @@
|
|||||||
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/net/minecraft/world/level/block/NoteBlock.java b/net/minecraft/world/level/block/NoteBlock.java
|
|
||||||
index 6582db84c5307257f16c321453491cf24e40c9c7..f9015d4e478efeec8a796b7a897638f76064db20 100644
|
|
||||||
--- a/net/minecraft/world/level/block/NoteBlock.java
|
|
||||||
+++ b/net/minecraft/world/level/block/NoteBlock.java
|
|
||||||
@@ -97,7 +97,7 @@ public class NoteBlock extends Block {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void playNote(@Nullable Entity entity, BlockState state, Level world, BlockPos pos) {
|
|
||||||
- if (((NoteBlockInstrument) state.getValue(NoteBlock.INSTRUMENT)).worksAboveNoteBlock() || world.getBlockState(pos.above()).isAir()) {
|
|
||||||
+ if (world.purpurConfig.noteBlockIgnoreAbove || ((NoteBlockInstrument) state.getValue(NoteBlock.INSTRUMENT)).worksAboveNoteBlock() || world.getBlockState(pos.above()).isAir()) { // Purpur
|
|
||||||
// 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()) {
|
|
||||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
index 4f31d65962618a29b0a52ec7c51fba2267d63a05..a71a380f20dad2f43183d128e7a487420248a671 100644
|
|
||||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
|
||||||
@@ -124,6 +124,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);
|
|
||||||
@@ -138,7 +139,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;
|
|
||||||
@@ -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()) {
|
||||||
@@ -116,6 +116,7 @@ public class PurpurWorldConfig {
|
|||||||
public boolean entitiesPickUpLootBypassMobGriefing = false;
|
public boolean entitiesPickUpLootBypassMobGriefing = false;
|
||||||
public boolean fireballsBypassMobGriefing = false;
|
public boolean fireballsBypassMobGriefing = false;
|
||||||
public boolean projectilesBypassMobGriefing = false;
|
public boolean projectilesBypassMobGriefing = false;
|
||||||
|
public boolean noteBlockIgnoreAbove = false;
|
||||||
private void miscGameplayMechanicsSettings() {
|
private void miscGameplayMechanicsSettings() {
|
||||||
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
useBetterMending = getBoolean("gameplay-mechanics.use-better-mending", useBetterMending);
|
||||||
boatEjectPlayersOnLand = getBoolean("gameplay-mechanics.boat.eject-players-on-land", boatEjectPlayersOnLand);
|
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);
|
entitiesPickUpLootBypassMobGriefing = getBoolean("gameplay-mechanics.entities-pick-up-loot-bypass-mob-griefing", entitiesPickUpLootBypassMobGriefing);
|
||||||
fireballsBypassMobGriefing = getBoolean("gameplay-mechanics.fireballs-bypass-mob-griefing", fireballsBypassMobGriefing);
|
fireballsBypassMobGriefing = getBoolean("gameplay-mechanics.fireballs-bypass-mob-griefing", fireballsBypassMobGriefing);
|
||||||
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
|
projectilesBypassMobGriefing = getBoolean("gameplay-mechanics.projectiles-bypass-mob-griefing", projectilesBypassMobGriefing);
|
||||||
|
noteBlockIgnoreAbove = getBoolean("gameplay-mechanics.note-block-ignore-above", noteBlockIgnoreAbove);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int daytimeTicks = 12000;
|
public int daytimeTicks = 12000;
|
||||||
|
|||||||
Reference in New Issue
Block a user