mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
37 lines
1.8 KiB
Diff
37 lines
1.8 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||
|
@@ -0,0 +0,0 @@ public abstract class Projectile extends Entity {
|
||
|
|
||
|
@Nullable
|
||
|
public Entity getOwner() {
|
||
|
- return this.ownerUUID != null && this.level instanceof ServerLevel ? ((ServerLevel) this.level).getEntity(this.ownerUUID) : (this.ownerNetworkId != 0 ? this.level.getEntity(this.ownerNetworkId) : null);
|
||
|
+ // Paper start - MC-50319 - shooter might be in another world (arrows through portals)
|
||
|
+ Entity entity = this.ownerUUID != null && this.level instanceof ServerLevel ? ((ServerLevel) this.level).getEntity(this.ownerUUID) : (this.ownerNetworkId != 0 ? this.level.getEntity(this.ownerNetworkId) : null);
|
||
|
+ if (entity == null) {
|
||
|
+ for (ServerLevel world : level.getServer().getAllLevels()) {
|
||
|
+ entity = world.getEntity(this.ownerUUID);
|
||
|
+ if (entity != null) {
|
||
|
+ break;
|
||
|
+ }
|
||
|
+ }
|
||
|
+ }
|
||
|
+ return entity;
|
||
|
+ // Paper end
|
||
|
}
|
||
|
|
||
|
@Override
|