2022-11-25 07:22:19 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Tue, 22 Nov 2022 13:16:01 -0800
|
|
|
|
Subject: [PATCH] check global player list where appropriate
|
|
|
|
|
2023-03-15 01:36:12 +01:00
|
|
|
Makes certain entities check all players when searching for a player
|
|
|
|
instead of just checking players in their world.
|
2022-11-25 07:22:19 +01:00
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2023-09-22 17:51:48 +02:00
|
|
|
index 89ac71cd9305b21e78abbc31a3f2319eae636cfb..23dd27fb62609cfc648a1d1da66a59aa18fa0d8f 100644
|
2022-11-25 07:22:19 +01:00
|
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
2023-09-22 17:51:48 +02:00
|
|
|
@@ -2432,4 +2432,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
2022-11-25 07:22:19 +01:00
|
|
|
entity.updateDynamicGameEventListener(DynamicGameEventListener::move);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ @Nullable
|
|
|
|
+ public Player getGlobalPlayerByUUID(UUID uuid) {
|
|
|
|
+ return this.server.getPlayerList().getPlayer(uuid);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
2023-03-15 01:36:12 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2023-09-22 17:51:48 +02:00
|
|
|
index c3b9d590497bf96fd0df4c00f863ab64ec91115e..b8174fd81aba6d47d4882fdd442fb3c011b755ac 100644
|
2023-03-15 01:36:12 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
2023-09-22 17:51:48 +02:00
|
|
|
@@ -3672,7 +3672,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
2023-03-15 01:36:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public void onItemPickup(ItemEntity item) {
|
|
|
|
- Entity entity = item.getOwner();
|
2023-06-08 21:00:58 +02:00
|
|
|
+ Entity entity = item.thrower != null ? this.level().getGlobalPlayerByUUID(item.thrower) : null; // Paper - check all players
|
2023-03-15 01:36:12 +01:00
|
|
|
|
|
|
|
if (entity instanceof ServerPlayer) {
|
|
|
|
CriteriaTriggers.THROWN_ITEM_PICKED_UP_BY_ENTITY.trigger((ServerPlayer) entity, item.getItem(), this);
|
2022-11-25 07:22:19 +01:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
2023-09-22 17:51:48 +02:00
|
|
|
index 4b2cd6d34ea4081cad86041f57ccda41807d4279..807cff3fb51269b97d9aecbcc4706f0a139dfeaa 100644
|
2022-11-25 07:22:19 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
|
2023-09-22 17:51:48 +02:00
|
|
|
@@ -272,7 +272,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
|
2022-11-25 07:22:19 +01:00
|
|
|
entityvillager.finalizeSpawn(world, world.getCurrentDifficultyAt(entityvillager.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null);
|
|
|
|
entityvillager.refreshBrain(world);
|
|
|
|
if (this.conversionStarter != null) {
|
|
|
|
- Player entityhuman = world.getPlayerByUUID(this.conversionStarter);
|
|
|
|
+ Player entityhuman = world.getGlobalPlayerByUUID(this.conversionStarter); // Paper - check all players
|
|
|
|
|
|
|
|
if (entityhuman instanceof ServerPlayer) {
|
|
|
|
CriteriaTriggers.CURED_ZOMBIE_VILLAGER.trigger((ServerPlayer) entityhuman, this, entityvillager);
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/EntityGetter.java b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
2023-09-22 17:51:48 +02:00
|
|
|
index e82a56c32f4179dc6a8df97f314dc3b4370e818d..8f3c767449f63fad54e45cbbb7a50352e5dbee4b 100644
|
2022-11-25 07:22:19 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/EntityGetter.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/EntityGetter.java
|
2023-09-22 17:51:48 +02:00
|
|
|
@@ -231,4 +231,11 @@ public interface EntityGetter {
|
2022-11-25 07:22:19 +01:00
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ // Paper start
|
|
|
|
+ @Nullable
|
|
|
|
+ default Player getGlobalPlayerByUUID(UUID uuid) {
|
|
|
|
+ return this.getPlayerByUUID(uuid);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
2023-06-08 22:56:13 +02:00
|
|
|
index faad948f089575e4988d989790cc1dd13f8a79cd..5935cf23ec11ae48b6c7cec9bd696d10d808e729 100644
|
2022-11-25 07:22:19 +01:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/SculkShriekerBlockEntity.java
|
2023-06-08 10:47:19 +02:00
|
|
|
@@ -100,6 +100,13 @@ public class SculkShriekerBlockEntity extends BlockEntity implements GameEventLi
|
2022-11-25 07:22:19 +01:00
|
|
|
|
|
|
|
@Nullable
|
|
|
|
public static ServerPlayer tryGetPlayer(@Nullable Entity entity) {
|
|
|
|
+ // Paper start - ensure level is the same for sculk events
|
|
|
|
+ final ServerPlayer player = tryGetPlayer0(entity);
|
2023-06-08 22:56:13 +02:00
|
|
|
+ return player != null && player.level() == entity.level() ? player : null;
|
2022-11-25 07:22:19 +01:00
|
|
|
+ }
|
|
|
|
+ @Nullable
|
|
|
|
+ private static ServerPlayer tryGetPlayer0(@Nullable Entity entity) {
|
|
|
|
+ // Paper end
|
|
|
|
if (entity instanceof ServerPlayer serverPlayer) {
|
|
|
|
return serverPlayer;
|
|
|
|
} else {
|