Yatopia/patches/server/0027-EMC-Human-getAttackPct.patch
2020-04-11 15:47:44 +02:00

47 lines
1.9 KiB
Diff

From 1a23964ea3c6da981ec95c5f5104eb1004568213 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 17 Jun 2018 02:09:37 -0400
Subject: [PATCH] EMC Human#getAttackPct
---
src/main/java/net/minecraft/server/EntityHuman.java | 2 ++
.../java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 59408cfd0..2a8eb7939 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -79,6 +79,7 @@ public abstract class EntityHuman extends EntityLiving {
public boolean fauxSleeping;
public String spawnWorld = "";
public int oldLevel = -1;
+ public float lastAttackPct = 0; // EMC
@Override
public CraftHumanEntity getBukkitEntity() {
@@ -1054,6 +1055,7 @@ public abstract class EntityHuman extends EntityLiving {
}
float f2 = this.s(0.5F);
+ this.lastAttackPct = f2; // EMC
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 1c88eacea..5dfa8eb79 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -72,6 +72,8 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
private boolean op;
private GameMode mode;
+ @Override public float getAttackPct() { return getHandle().lastAttackPct; } // EMC
+
public CraftHumanEntity(final CraftServer server, final EntityHuman entity) {
super(server, entity);
mode = server.getDefaultGameMode();
--
2.25.1.windows.1