From 6f21d3ca8fb02001dd10f49019cfb05ed914a873 Mon Sep 17 00:00:00 2001 From: t00thpick1 Date: Thu, 19 Jun 2014 14:38:45 -0400 Subject: [Bleeding] Implement new damage api. Fixes BUKKIT-5326, BUKKIT-3878. This commit centralizes event handling to where damage is actually applied to the entity to avoid bugs that have resulted from nodamageticks, modifications to damage after the event has been called, and similar mishaps. This also implements new API for getting and setting of modifications made to the damage amount actually applied to the entity. This is done by storing the change in the damage amount as each modifier is applied by vanilla code. The method that actually damages the armor worn by an entity has been relocated beneath the event called as to not apply durability loss when the event has been cancelled. --- src/main/java/net/minecraft/server/EntityItemFrame.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/main/java/net/minecraft/server/EntityItemFrame.java') diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java index 8d39f5f4..940e7c86 100644 --- a/src/main/java/net/minecraft/server/EntityItemFrame.java +++ b/src/main/java/net/minecraft/server/EntityItemFrame.java @@ -24,8 +24,7 @@ public class EntityItemFrame extends EntityHanging { } else if (this.getItem() != null) { if (!this.world.isStatic) { // CraftBukkit start - fire EntityDamageEvent - org.bukkit.event.entity.EntityDamageEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.handleEntityDamageEvent(this, damagesource, f); - if ((event != null && event.isCancelled()) || this.dead) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f) || this.dead) { return true; } // CraftBukkit end -- cgit v1.2.3