summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityLiving.patch
diff options
context:
space:
mode:
authormd_5 <git@md-5.net>2016-12-10 12:16:14 +1100
committermd_5 <git@md-5.net>2016-12-10 12:16:14 +1100
commit7dfa530395a35ce287463e0a166d96a19c26d671 (patch)
treeecec5c96f99b3c2410e3890f7ec9157f7d4caf3f /nms-patches/EntityLiving.patch
parent03c4bf2244687a4791f2f6ca8edcf08d8d114d67 (diff)
downloadcraftbukkit-7dfa530395a35ce287463e0a166d96a19c26d671.tar
craftbukkit-7dfa530395a35ce287463e0a166d96a19c26d671.tar.gz
craftbukkit-7dfa530395a35ce287463e0a166d96a19c26d671.tar.lz
craftbukkit-7dfa530395a35ce287463e0a166d96a19c26d671.tar.xz
craftbukkit-7dfa530395a35ce287463e0a166d96a19c26d671.zip
SPIGOT-2907: Improve EntityResurrectEvent handling
Diffstat (limited to 'nms-patches/EntityLiving.patch')
-rw-r--r--nms-patches/EntityLiving.patch45
1 files changed, 30 insertions, 15 deletions
diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch
index 1d219271..7bc21426 100644
--- a/nms-patches/EntityLiving.patch
+++ b/nms-patches/EntityLiving.patch
@@ -319,22 +319,37 @@
this.aA = 0.0F;
Entity entity1 = damagesource.getEntity();
-@@ -817,7 +958,13 @@
+@@ -806,18 +947,27 @@
+ EnumHand[] aenumhand = EnumHand.values();
+ int i = aenumhand.length;
+
++ // CraftBukkit start
++ ItemStack itemstack = ItemStack.a;
+ for (int j = 0; j < i; ++j) {
+ EnumHand enumhand = aenumhand[j];
+- ItemStack itemstack = this.b(enumhand);
++ itemstack = this.b(enumhand);
+
+ if (itemstack.getItem() == Items.cY) {
+- itemstack.subtract(1);
++ // itemstack.subtract(1);
+ flag = true;
+ break;
}
}
-- if (flag) {
-+ // CraftBukkit start
+ EntityResurrectEvent event = new EntityResurrectEvent((LivingEntity) this.getBukkitEntity());
+ event.setCancelled(!flag);
+ this.world.getServer().getPluginManager().callEvent(event);
++ flag = !event.isCancelled();
+
-+ if (!event.isCancelled()) {
+ if (flag) {
++ itemstack.subtract(1);
+ // CraftBukkit end
if (this instanceof EntityHuman) {
((EntityHuman) this).b(StatisticList.b(Items.cY));
}
-@@ -914,6 +1061,12 @@
+@@ -914,6 +1064,12 @@
boolean flag = this.lastDamageByPlayerTime > 0;
this.a(flag, i, damagesource);
@@ -347,7 +362,7 @@
}
}
-@@ -1003,8 +1156,13 @@
+@@ -1003,8 +1159,13 @@
int i = MathHelper.f((f - 3.0F - f2) * f1);
if (i > 0) {
@@ -362,7 +377,7 @@
int j = MathHelper.floor(this.locX);
int k = MathHelper.floor(this.locY - 0.20000000298023224D);
int l = MathHelper.floor(this.locZ);
-@@ -1031,7 +1189,7 @@
+@@ -1031,7 +1192,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@@ -371,7 +386,7 @@
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.getAttributeInstance(GenericAttributes.h).getValue());
}
-@@ -1044,7 +1202,8 @@
+@@ -1044,7 +1205,8 @@
} else {
int i;
@@ -381,7 +396,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
-@@ -1065,22 +1224,129 @@
+@@ -1065,22 +1227,129 @@
}
}
@@ -521,7 +536,7 @@
}
public CombatTracker getCombatTracker() {
-@@ -1147,6 +1413,7 @@
+@@ -1147,6 +1416,7 @@
public AttributeMapBase getAttributeMap() {
if (this.attributeMap == null) {
this.attributeMap = new AttributeMapServer();
@@ -529,7 +544,7 @@
}
return this.attributeMap;
-@@ -1438,6 +1705,7 @@
+@@ -1438,6 +1708,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@@ -537,7 +552,7 @@
this.setFlag(7, false);
}
} else {
-@@ -1798,6 +2066,7 @@
+@@ -1798,6 +2069,7 @@
}
if (!this.world.isClientSide) {
@@ -545,7 +560,7 @@
this.setFlag(7, flag);
}
-@@ -1895,11 +2164,11 @@
+@@ -1895,11 +2167,11 @@
}
public boolean isInteractable() {
@@ -559,7 +574,7 @@
}
protected void ap() {
-@@ -2036,7 +2305,23 @@
+@@ -2036,7 +2308,23 @@
protected void v() {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.a(this.activeItem, 16);
@@ -584,7 +599,7 @@
this.cF();
}
-@@ -2115,10 +2400,18 @@
+@@ -2115,10 +2403,18 @@
}
if (flag1) {