mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
cc6fd371b2
Fixes #6357 Closes #6508 Closes #6358
35 lines
1.7 KiB
Diff
35 lines
1.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 17 Oct 2018 19:17:27 -0400
|
|
Subject: [PATCH] MC-50319: Check other worlds for shooter of projectiles
|
|
|
|
Say a player shoots an arrow through a nether portal, the game
|
|
would lose the shooter for determining things such as Player Kills,
|
|
because the entity is in another world.
|
|
|
|
If the projectile fails to find the shooter in the current world, check
|
|
other worlds.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
index d7d4aa7ed2f321df8099adb97a3c699ed38ae6fc..21ce4be0d8d0147a92f87e17bb5078a211419984 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
@@ -57,6 +57,18 @@ public abstract class Projectile extends Entity {
|
|
return this.cachedOwner;
|
|
} else if (this.ownerUUID != null && this.level instanceof ServerLevel) {
|
|
this.cachedOwner = ((ServerLevel) this.level).getEntity(this.ownerUUID);
|
|
+ // Paper start - check all worlds
|
|
+ if (this.cachedOwner == null) {
|
|
+ for (final ServerLevel level : this.level.getServer().getAllLevels()) {
|
|
+ if (level == this.level) continue;
|
|
+ final Entity entity = level.getEntity(this.ownerUUID);
|
|
+ if (entity != null) {
|
|
+ this.cachedOwner = entity;
|
|
+ break;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
return this.cachedOwner;
|
|
} else {
|
|
return null;
|