Paper/nms-patches/EntitySkeleton.patch
2015-03-04 09:48:58 +00:00

61 lines
2.3 KiB
Diff

--- /home/matt/mc-dev-private//net/minecraft/server/EntitySkeleton.java 2015-02-26 22:40:22.683608138 +0000
+++ src/main/java/net/minecraft/server/EntitySkeleton.java 2015-02-26 22:40:22.687608138 +0000
@@ -2,6 +2,8 @@
import java.util.Calendar;
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
+
public class EntitySkeleton extends EntityMonster implements IRangedEntity {
private PathfinderGoalArrowAttack a = new PathfinderGoalArrowAttack(this, 1.0D, 20, 60, 15.0F);
@@ -89,7 +91,14 @@
}
if (flag) {
- this.setOnFire(8);
+ // CraftBukkit start
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ this.setOnFire(event.getDuration());
+ }
+ // CraftBukkit end
}
}
}
@@ -224,11 +233,30 @@
}
if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) {
- entityarrow.setOnFire(100);
+ // CraftBukkit start - call EntityCombustEvent
+ EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100);
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ entityarrow.setOnFire(event.getDuration());
+ }
+ // CraftBukkit end
+ }
+
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F);
+ if (event.isCancelled()) {
+ event.getProjectile().remove();
+ return;
+ }
+
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+ world.addEntity(entityarrow);
}
+ // CraftBukkit end
this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F));
- this.world.addEntity(entityarrow);
+ // this.world.addEntity(entityarrow); // CraftBukkit - moved up
}
public int getSkeletonType() {