2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-08-24 19:18:41 +00:00
|
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
|
|
Date: Mon, 31 Jul 2017 01:49:48 -0500
|
|
|
|
Subject: [PATCH] LivingEntity#setKiller
|
|
|
|
|
|
|
|
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
|
|
index 3d6b8fd09c07e78c0d786dff9658eb0089f853cf..851aed157a233ab690a57e5736fa01beaff45b5c 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
|
|
|
@@ -180,7 +180,7 @@ public abstract class EntityLiving extends Entity {
|
2020-08-25 02:22:08 +00:00
|
|
|
public float aE;
|
2020-06-25 13:11:48 +00:00
|
|
|
@Nullable
|
2019-05-06 02:58:04 +00:00
|
|
|
public EntityHuman killer;
|
|
|
|
- protected int lastDamageByPlayerTime;
|
|
|
|
+ public int lastDamageByPlayerTime; // Paper - protected -> public
|
|
|
|
protected boolean killed;
|
|
|
|
protected int ticksFarFromPlayer;
|
2020-08-25 02:22:08 +00:00
|
|
|
protected float aJ;
|
2017-08-24 19:18:41 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2021-03-16 13:04:28 +00:00
|
|
|
index c654026587bc9bf77b39f59a0c89991ac581da1e..c43c300963bae9bca6ab9c9389dd53e42318715c 100644
|
2017-08-24 19:18:41 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2021-03-16 13:04:28 +00:00
|
|
|
@@ -8,6 +8,7 @@ import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.UUID;
|
|
|
|
+import net.minecraft.server.level.EntityPlayer;
|
|
|
|
import net.minecraft.world.EnumHand;
|
|
|
|
import net.minecraft.world.damagesource.DamageSource;
|
|
|
|
import net.minecraft.world.effect.MobEffect;
|
|
|
|
@@ -344,6 +345,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2017-08-24 19:18:41 +00:00
|
|
|
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ @Override
|
|
|
|
+ public void setKiller(Player killer) {
|
2021-03-16 13:04:28 +00:00
|
|
|
+ EntityPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
|
2017-08-24 19:18:41 +00:00
|
|
|
+ getHandle().killer = entityPlayer;
|
|
|
|
+ getHandle().lastDamager = entityPlayer;
|
|
|
|
+ getHandle().lastDamageByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
2019-05-06 02:58:04 +00:00
|
|
|
@Override
|
2017-08-24 19:18:41 +00:00
|
|
|
public boolean addPotionEffect(PotionEffect effect) {
|
|
|
|
return addPotionEffect(effect, false);
|