summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntitySmallFireball.patch
blob: 5fed4bcdc7895ea0c5d1b0f2679ef86624aa00d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- a/net/minecraft/server/EntitySmallFireball.java
+++ b/net/minecraft/server/EntitySmallFireball.java
@@ -1,5 +1,7 @@
 package net.minecraft.server;
 
+import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
+
 public class EntitySmallFireball extends EntityFireball {
 
     public EntitySmallFireball(World world) {
@@ -30,7 +32,14 @@
                     flag = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
                     if (flag) {
                         this.a(this.shooter, movingobjectposition.entity);
-                        movingobjectposition.entity.setOnFire(5);
+                        // CraftBukkit start - Entity damage by entity event + combust event
+                        EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
+                        movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);
+
+                        if (!event.isCancelled()) {
+                            movingobjectposition.entity.setOnFire(event.getDuration());
+                        }
+                        // CraftBukkit end
                     }
                 }
             } else {
@@ -43,7 +52,11 @@
                     BlockPosition blockposition = movingobjectposition.a().shift(movingobjectposition.direction);
 
                     if (this.world.isEmpty(blockposition)) {
-                        this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+                        // CraftBukkit start
+                        if (isIncendiary && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) {
+                            this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
+                        }
+                        // CraftBukkit end
                     }
                 }
             }