mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 02:55:47 +01:00
49 lines
2.3 KiB
Diff
49 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
Date: Mon, 31 Jul 2017 01:49:48 -0500
|
|
Subject: [PATCH] LivingEntity#setKiller
|
|
|
|
|
|
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 {
|
|
public float aE;
|
|
@Nullable
|
|
public EntityHuman killer;
|
|
- protected int lastDamageByPlayerTime;
|
|
+ public int lastDamageByPlayerTime; // Paper - protected -> public
|
|
protected boolean killed;
|
|
protected int ticksFarFromPlayer;
|
|
protected float aJ;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index c654026587bc9bf77b39f59a0c89991ac581da1e..c43c300963bae9bca6ab9c9389dd53e42318715c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -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 {
|
|
return getHandle().killer == null ? null : (Player) getHandle().killer.getBukkitEntity();
|
|
}
|
|
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public void setKiller(Player killer) {
|
|
+ EntityPlayer entityPlayer = killer == null ? null : ((CraftPlayer) killer).getHandle();
|
|
+ getHandle().killer = entityPlayer;
|
|
+ getHandle().lastDamager = entityPlayer;
|
|
+ getHandle().lastDamageByPlayerTime = entityPlayer == null ? 0 : 100; // 100 value taken from EntityLiving#damageEntity
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public boolean addPotionEffect(PotionEffect effect) {
|
|
return addPotionEffect(effect, false);
|