mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 00:56:39 +01:00
6048122e23
This patch appears to be causing some issues with 1.14.3 entity AI
43 lines
1.9 KiB
Diff
43 lines
1.9 KiB
Diff
From a7f048ab79c856fbd66d9771917961fcdf0849a3 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/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 3961ae1710..31e3bf0edf 100644
|
|
--- 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;
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index aa50435bec..42cc158824 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -304,6 +304,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) {
|
|
+ net.minecraft.server.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);
|
|
--
|
|
2.22.0
|
|
|