Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 03:20:07 +01:00
fix custom beacon ranges (#6067)
Dieser Commit ist enthalten in:
Ursprung
6446e54dd9
Commit
0ae6dd2659
@ -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<Player> 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<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) {
|
||||
@@ -108,4 +108,21 @@ public class CraftBeacon extends CraftBlockEntityState<BeaconBlockEntity> implem
|
||||
public void setLock(String key) {
|
||||
this.getSnapshot().lockKey = (key == null) ? LockCode.NO_LOCK : new LockCode(key);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren