check global player list where appropriate
Makes certain entities check all players when searching for a player instead of just checking players in their world.
This commit is contained in:
@@ -62,3 +62,15 @@
|
||||
default boolean hasNearbyAlivePlayer(double x, double y, double z, double range) {
|
||||
for (Player player : this.players()) {
|
||||
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
|
||||
@@ -124,4 +165,11 @@
|
||||
|
||||
return null;
|
||||
}
|
||||
+
|
||||
+ // Paper start - check global player list where appropriate
|
||||
+ @Nullable
|
||||
+ default Player getGlobalPlayerByUUID(UUID uuid) {
|
||||
+ return this.getPlayerByUUID(uuid);
|
||||
+ }
|
||||
+ // Paper end - check global player list where appropriate
|
||||
}
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
--- a/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
||||
+++ b/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
||||
@@ -190,7 +190,7 @@
|
||||
@@ -105,6 +105,13 @@
|
||||
|
||||
@Nullable
|
||||
public static ServerPlayer tryGetPlayer(@Nullable Entity entity) {
|
||||
+ // Paper start - check global player list where appropriate; ensure level is the same for sculk events
|
||||
+ final ServerPlayer player = tryGetPlayer0(entity);
|
||||
+ return player != null && player.level() == entity.level() ? player : null;
|
||||
+ }
|
||||
+ @Nullable
|
||||
+ private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) {
|
||||
+ // Paper end - check global player list where appropriate
|
||||
if (entity instanceof ServerPlayer) {
|
||||
return (ServerPlayer)entity;
|
||||
} else {
|
||||
@@ -190,7 +197,7 @@
|
||||
private boolean trySummonWarden(ServerLevel world) {
|
||||
return this.warningLevel >= 4
|
||||
&& SpawnUtil.trySpawnMob(
|
||||
|
||||
Reference in New Issue
Block a user