mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-08-24 23:03:00 +02:00
40 lines
1.6 KiB
Diff
40 lines
1.6 KiB
Diff
From 69100d35ec3a134bd1110294ccb9be4674169c9d Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Wed, 12 Mar 2014 23:10:04 -0400
|
|
Subject: [PATCH] EMC LivingEntityArmorProtectEvent
|
|
|
|
To control if armor should protect entity, how much if so, and how much item damage to give.
|
|
---
|
|
src/main/java/net/minecraft/server/EntityLiving.java | 8 +++++++-
|
|
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index 6ea927dc..5b402690 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -39,6 +39,7 @@ import org.bukkit.event.player.PlayerItemConsumeEvent;
|
|
// CraftBukkit end
|
|
|
|
import co.aikar.timings.MinecraftTimings; // Paper
|
|
+import com.empireminecraft.customevents.LivingEntityArmorProtectEvent; // EMC
|
|
|
|
public abstract class EntityLiving extends Entity {
|
|
|
|
@@ -1576,7 +1577,12 @@ public abstract class EntityLiving extends Entity {
|
|
public int getArmorStrength() {
|
|
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.ARMOR);
|
|
|
|
- return MathHelper.floor(attributeinstance.getValue());
|
|
+ // EMC start
|
|
+ final double value = attributeinstance.getValue();
|
|
+ LivingEntityArmorProtectEvent event = new LivingEntityArmorProtectEvent(this.getBukkitLivingEntity(), value);
|
|
+ event.callEvent();
|
|
+ return MathHelper.floor(event.getArmorValue());
|
|
+ // EMC end
|
|
}
|
|
|
|
protected void damageArmor(float f) {}
|
|
--
|
|
2.25.1.windows.1
|
|
|