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/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java index cc03c02f290ee8d58a2fea54b1f977f49a2cec6e..49a2308832b24dc1eb839af786dbec9f046bdab6 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java @@ -165,6 +165,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; @@ -198,6 +199,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(world, blockposition1) >= 15 && !iblockdata1.is(Blocks.BEDROCK)) { blockEntity.checkingBeamSections.clear(); blockEntity.lastCheckY = l; @@ -217,7 +221,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 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 d0067ae397b4d5af56a4fa25508281f76d5633c5..09a3fdf469921fb218dbb1f7e213522a8d1235dc 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -757,11 +757,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;