mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-12 18:55:51 -07:00
fix custom beacon ranges (#6067)
This commit is contained in:
@@ -38,6 +38,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
@@ -0,0 +0,0 @@ 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||||
|
}
|
||||||
|
|
||||||
public static List getHumansInRange(Level world, BlockPos blockposition, int i) {
|
public static List getHumansInRange(Level world, BlockPos blockposition, int i) {
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ return BeaconBlockEntity.getHumansInRange(world, blockposition, i, null);
|
+ return BeaconBlockEntity.getHumansInRange(world, blockposition, i, null);
|
||||||
@@ -53,6 +62,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
@@ -0,0 +0,0 @@ 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
|
||||||
|
|
||||||
|
@@ -0,0 +0,0 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider {
|
||||||
|
}
|
||||||
|
|
||||||
this.lockKey = LockCode.fromTag(nbt);
|
this.lockKey = LockCode.fromTag(nbt);
|
||||||
+ this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper
|
+ this.effectRange = nbt.contains(PAPER_RANGE_TAG, 6) ? nbt.getDouble(PAPER_RANGE_TAG) : -1; // Paper
|
||||||
}
|
}
|
||||||
@@ -70,6 +98,15 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/m
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java
|
||||||
|
@@ -0,0 +0,0 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
|
||||||
|
if (tileEntity instanceof BeaconBlockEntity) {
|
||||||
|
BeaconBlockEntity beacon = (BeaconBlockEntity) tileEntity;
|
||||||
|
|
||||||
|
- Collection<Player> nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels);
|
||||||
|
+ Collection<Player> nms = BeaconBlockEntity.getHumansInRange(beacon.getLevel(), beacon.getBlockPos(), beacon.levels, beacon); // Paper
|
||||||
|
Collection<LivingEntity> bukkit = new ArrayList<LivingEntity>(nms.size());
|
||||||
|
|
||||||
|
for (Player human : nms) {
|
||||||
@@ -0,0 +0,0 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
|
@@ -0,0 +0,0 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
|
||||||
public void setLock(String key) {
|
public void setLock(String key) {
|
||||||
this.getSnapshot().lockKey = (key == null) ? LockCode.NO_LOCK : new LockCode(key);
|
this.getSnapshot().lockKey = (key == null) ? LockCode.NO_LOCK : new LockCode(key);
|
||||||
|
Reference in New Issue
Block a user