Paper/Spigot-Server-Patches/0174-LivingEntity-setKiller.patch

44 lines
1.9 KiB
Diff
Raw Normal View History

2019-05-22 06:14:56 +02:00
From d5e2a9836544cba3722ea3ed5aa45dcbc082341c Mon Sep 17 00:00:00 2001
2017-08-24 21:18:41 +02:00
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:49:48 -0500
Subject: [PATCH] LivingEntity#setKiller
2019-05-06 04:58:04 +02:00
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
2019-05-22 06:14:56 +02:00
index 06f09d7b5d..e2921de48b 100644
2019-05-06 04:58:04 +02:00
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -76,7 +76,7 @@ public abstract class EntityLiving extends Entity {
public float aN;
public float aO;
public EntityHuman killer;
- protected int lastDamageByPlayerTime;
+ public int lastDamageByPlayerTime; // Paper - protected -> public
protected boolean killed;
protected int ticksFarFromPlayer;
protected float aT;
2017-08-24 21:18:41 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2019-05-22 06:14:56 +02:00
index aa50435bec..42cc158824 100644
2017-08-24 21:18:41 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2019-05-22 06:14:56 +02:00
@@ -304,6 +304,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2017-08-24 21:18:41 +02:00
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
}
+ // Paper start
+ @Override
+ public void setKiller(Player killer) {
+ net.minecraft.server.EntityPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
2017-08-24 21:18:41 +02:00
+ getHandle().killer = entityPlayer;
+ getHandle().lastDamager = entityPlayer;
+ getHandle().lastDamageByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity
+ }
+ // Paper end
+
2019-05-06 04:58:04 +02:00
@Override
2017-08-24 21:18:41 +02:00
public boolean addPotionEffect(PotionEffect effect) {
return addPotionEffect(effect, false);
--
2.21.0
2017-08-24 21:18:41 +02:00