From 0ae6dd265913fc1e0c602d7d9dfa82494c5f5d3c Mon Sep 17 00:00:00 2001 From: Jake Potrebic <15055071+Machine-Maker@users.noreply.github.com> Date: Fri, 2 Jul 2021 12:51:49 -0700 Subject: [PATCH] fix custom beacon ranges (#6067) --- ...0551-Beacon-API-custom-effect-ranges.patch | 45 +++++++++++++++++-- ...tChunkIfLoadedImmediately-in-places.patch} | 0 2 files changed, 41 insertions(+), 4 deletions(-) rename patches/server/{0724-Use-getChunkIfLoadedImmediately-in-places.patch => 0725-Use-getChunkIfLoadedImmediately-in-places.patch} (100%) diff --git a/patches/server/0551-Beacon-API-custom-effect-ranges.patch b/patches/server/0551-Beacon-API-custom-effect-ranges.patch index 358189f049..90b6578e16 100644 --- a/patches/server/0551-Beacon-API-custom-effect-ranges.patch +++ b/patches/server/0551-Beacon-API-custom-effect-ranges.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Beacon API - custom effect ranges 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 0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1..1df7a4a937729fc402f80021434ddf3481facd94 100644 +index 0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1..11740e6a312cf8ab10b52461f455feba0e1b2788 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 @@ -79,6 +79,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { @@ -35,6 +35,15 @@ index 0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1..1df7a4a937729fc402f80021434ddf34 public BeaconBlockEntity(BlockPos pos, BlockState state) { super(BlockEntityType.BEACON, pos, state); +@@ -182,7 +202,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { + } + + if (blockEntity.levels > 0 && !blockEntity.beamSections.isEmpty()) { +- BeaconBlockEntity.applyEffects(world, pos, blockEntity.levels, blockEntity.primaryPower, blockEntity.secondaryPower); ++ BeaconBlockEntity.applyEffects(world, pos, blockEntity.levels, blockEntity.primaryPower, blockEntity.secondaryPower, blockEntity); // Paper + BeaconBlockEntity.playSound(world, pos, SoundEvents.BEACON_AMBIENT); + } + } @@ -268,8 +288,13 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } @@ -50,7 +59,26 @@ index 0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1..1df7a4a937729fc402f80021434ddf34 AABB axisalignedbb = (new AABB(blockposition)).inflate(d0).expandTowards(0.0D, (double) world.getHeight(), 0.0D); List list = world.getEntitiesOfClass(Player.class, axisalignedbb); -@@ -366,6 +391,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -310,12 +335,17 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { + } + + private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable MobEffect primaryEffect, @Nullable MobEffect secondaryEffect) { ++ // Paper start ++ BeaconBlockEntity.applyEffects(world, pos, beaconLevel, primaryEffect, secondaryEffect, null); ++ } ++ private static void applyEffects(Level world, BlockPos pos, int beaconLevel, @Nullable MobEffect primaryEffect, @Nullable MobEffect secondaryEffect, @Nullable BeaconBlockEntity blockEntity) { ++ // Paper end + if (!world.isClientSide && primaryEffect != null) { + double d0 = (double) (beaconLevel * 10 + 10); + byte b0 = BeaconBlockEntity.getAmplification(beaconLevel, primaryEffect, secondaryEffect); + + int j = BeaconBlockEntity.getLevel(beaconLevel); +- List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel); ++ List list = BeaconBlockEntity.getHumansInRange(world, pos, beaconLevel, blockEntity); // Paper + + BeaconBlockEntity.applyEffect(list, primaryEffect, j, b0, true, pos); // Paper - BeaconEffectEvent + +@@ -366,6 +396,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } this.lockKey = LockCode.fromTag(nbt); @@ -58,7 +86,7 @@ index 0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1..1df7a4a937729fc402f80021434ddf34 } @Override -@@ -379,6 +405,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { +@@ -379,6 +410,7 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider { } this.lockKey.addToTag(nbt); @@ -67,9 +95,18 @@ index 0fa01b98f4a2ce2a7d34437a71d8c1cc7e718fb1..1df7a4a937729fc402f80021434ddf34 } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java -index 5abf219e86c6b4cf0c6b2e8ea72d7ed7b4f612e3..e2b2625565a4ac39899de01a7fe660188f04c109 100644 +index 5abf219e86c6b4cf0c6b2e8ea72d7ed7b4f612e3..59a6a3d78d41d86c0e52510a2f81265d56368c7b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java +@@ -31,7 +31,7 @@ public class CraftBeacon extends CraftBlockEntityState implem + if (tileEntity instanceof BeaconBlockEntity) { + BeaconBlockEntity beacon = (BeaconBlockEntity) tileEntity; + +- Collection nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels); ++ Collection nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels, beacon); // Paper + Collection bukkit = new ArrayList(nms.size()); + + for (Player human : nms) { @@ -108,4 +108,21 @@ public class CraftBeacon extends CraftBlockEntityState implem public void setLock(String key) { this.getSnapshot().lockKey = (key == null) ? LockCode.NO_LOCK : new LockCode(key); diff --git a/patches/server/0724-Use-getChunkIfLoadedImmediately-in-places.patch b/patches/server/0725-Use-getChunkIfLoadedImmediately-in-places.patch similarity index 100% rename from patches/server/0724-Use-getChunkIfLoadedImmediately-in-places.patch rename to patches/server/0725-Use-getChunkIfLoadedImmediately-in-places.patch