From d17908d92aad947599774b69f03eea1ae4a30111 Mon Sep 17 00:00:00 2001 From: 12emin34 Date: Sun, 12 Jan 2025 17:05:38 -0800 Subject: [PATCH] Option to allow beacon effects when covered by tinted glass --- ...beacon-effects-when-covered-by-tinte.patch | 55 ------------------- .../block/entity/BeaconBlockEntity.java.patch | 25 +++++++++ .../purpurmc/purpur/PurpurWorldConfig.java | 2 + 3 files changed, 27 insertions(+), 55 deletions(-) delete mode 100644 patches/server/0269-Option-to-allow-beacon-effects-when-covered-by-tinte.patch diff --git a/patches/server/0269-Option-to-allow-beacon-effects-when-covered-by-tinte.patch b/patches/server/0269-Option-to-allow-beacon-effects-when-covered-by-tinte.patch deleted file mode 100644 index 513ee4b1d..000000000 --- a/patches/server/0269-Option-to-allow-beacon-effects-when-covered-by-tinte.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: 12emin34 -Date: Mon, 26 Dec 2022 19:10:43 +0100 -Subject: [PATCH] Option to allow beacon effects when covered by tinted glass - - -diff --git a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -index 15a24cad5700cc1fe7430e425909869be84fe928..98e3d0a6f1be8cef8678b4048a3a484012092f08 100644 ---- a/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -+++ b/net/minecraft/world/level/block/entity/BeaconBlockEntity.java -@@ -178,6 +178,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name - int j = pos.getY(); - int k = pos.getZ(); - BlockPos blockposition1; -+ boolean isTintedGlass = false; - - if (blockEntity.lastCheckY < j) { - blockposition1 = pos; -@@ -211,6 +212,9 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name - } - } - } else { -+ if (world.purpurConfig.beaconAllowEffectsWithTintedGlass && block.equals(Blocks.TINTED_GLASS)) { -+ isTintedGlass = true; -+ } - if (tileentitybeacon_beaconcolortracker == null || iblockdata1.getLightBlock() >= 15 && !iblockdata1.is(Blocks.BEDROCK)) { - blockEntity.checkingBeamSections.clear(); - blockEntity.lastCheckY = l; -@@ -230,7 +234,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name - blockEntity.levels = BeaconBlockEntity.updateBase(world, i, j, k); - } - -- if (blockEntity.levels > 0 && !blockEntity.beamSections.isEmpty()) { -+ if (blockEntity.levels > 0 && (!blockEntity.beamSections.isEmpty() || (world.purpurConfig.beaconAllowEffectsWithTintedGlass && isTintedGlass))) { - BeaconBlockEntity.applyEffects(world, pos, blockEntity.levels, blockEntity.primaryPower, blockEntity.secondaryPower, blockEntity); // Paper - Custom beacon ranges - BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT); - } -diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 1400039583896ffe6198949e5e627ef58c5abee9..0cc3e2a55712a809a3338b06ab23a3172334b1b3 100644 ---- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -823,11 +823,13 @@ public class PurpurWorldConfig { - public int beaconLevelTwo = 30; - public int beaconLevelThree = 40; - public int beaconLevelFour = 50; -+ public boolean beaconAllowEffectsWithTintedGlass = false; - private void beaconSettings() { - beaconLevelOne = getInt("blocks.beacon.effect-range.level-1", beaconLevelOne); - beaconLevelTwo = getInt("blocks.beacon.effect-range.level-2", beaconLevelTwo); - beaconLevelThree = getInt("blocks.beacon.effect-range.level-3", beaconLevelThree); - beaconLevelFour = getInt("blocks.beacon.effect-range.level-4", beaconLevelFour); -+ beaconAllowEffectsWithTintedGlass = getBoolean("blocks.beacon.allow-effects-with-tinted-glass", beaconAllowEffectsWithTintedGlass); - } - - public boolean bedExplode = true; diff --git a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch index 4184a1c94..8987119ae 100644 --- a/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch +++ b/purpur-server/minecraft-patches/sources/net/minecraft/world/level/block/entity/BeaconBlockEntity.java.patch @@ -17,3 +17,28 @@ return this.levels * 10 + 10; } else { return effectRange; +@@ -168,6 +_,7 @@ + int y = pos.getY(); + int z = pos.getZ(); + BlockPos blockPos; ++ boolean isTintedGlass = false; // Purpur - allow beacon effects when covered by tinted glass + if (blockEntity.lastCheckY < y) { + blockPos = pos; + blockEntity.checkingBeamSections = Lists.newArrayList(); +@@ -197,6 +_,7 @@ + } + } + } else { ++ if (level.purpurConfig.beaconAllowEffectsWithTintedGlass && blockState.getBlock().equals(Blocks.TINTED_GLASS)) {isTintedGlass = true;} // Purpur - allow beacon effects when covered by tinted glass + if (beaconBeamSection == null || blockState.getLightBlock() >= 15 && !blockState.is(Blocks.BEDROCK)) { + blockEntity.checkingBeamSections.clear(); + blockEntity.lastCheckY = height; +@@ -216,7 +_,7 @@ + blockEntity.levels = updateBase(level, x, y, z); + } + +- if (blockEntity.levels > 0 && !blockEntity.beamSections.isEmpty()) { ++ if (blockEntity.levels > 0 && (!blockEntity.beamSections.isEmpty() || (level.purpurConfig.beaconAllowEffectsWithTintedGlass && isTintedGlass))) { // Purpur - allow beacon effects when covered by tinted glass + applyEffects(level, pos, blockEntity.levels, blockEntity.primaryPower, blockEntity.secondaryPower, blockEntity); // Paper - Custom beacon ranges + playSound(level, pos, SoundEvents.BEACON_AMBIENT); + } diff --git a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java index da22c9167..920ddfa37 100644 --- a/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -822,11 +822,13 @@ public class PurpurWorldConfig { public int beaconLevelTwo = 30; public int beaconLevelThree = 40; public int beaconLevelFour = 50; + public boolean beaconAllowEffectsWithTintedGlass = false; private void beaconSettings() { beaconLevelOne = getInt("blocks.beacon.effect-range.level-1", beaconLevelOne); beaconLevelTwo = getInt("blocks.beacon.effect-range.level-2", beaconLevelTwo); beaconLevelThree = getInt("blocks.beacon.effect-range.level-3", beaconLevelThree); beaconLevelFour = getInt("blocks.beacon.effect-range.level-4", beaconLevelFour); + beaconAllowEffectsWithTintedGlass = getBoolean("blocks.beacon.allow-effects-with-tinted-glass", beaconAllowEffectsWithTintedGlass); } public boolean bedExplode = true;