aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0247-EnderDragon-Events.patch
blob: 1577dc2d0adc9c6da2b13ccc50ee09076fedd196 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sat, 21 Jul 2018 01:51:27 -0500
Subject: [PATCH] EnderDragon Events


diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
index fbc2ec88f7c71c853c492301986a23dafc8fa7a6..0d860d5dbef667b40a137127fcb73fd6611dcba8 100644
--- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
@@ -71,7 +71,11 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
             this.d.setDuration(200);
             this.d.setParticle(Particles.DRAGON_BREATH);
             this.d.addEffect(new MobEffect(MobEffects.HARM));
+            if (new com.destroystokyo.paper.event.entity.EnderDragonFlameEvent((org.bukkit.entity.EnderDragon) this.a.getBukkitEntity(), (org.bukkit.entity.AreaEffectCloud) this.d.getBukkitEntity()).callEvent()) { // Paper
             this.a.world.addEntity(this.d);
+            } else {
+                this.removeAreaEffect();
+            }
         }
 
     }
@@ -82,8 +86,8 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
         ++this.c;
     }
 
-    @Override
-    public void e() {
+    public final void removeAreaEffect() { this.e(); } // Paper - OBFHELPER
+    @Override public void e() {
         if (this.d != null) {
             this.d.die();
             this.d = null;
diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
index 7c94faa59c2b9887292c6d88fa2e3bb46e3e67c7..ac546ff959510a2d0120c24c90bf13ff83873161 100644
--- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java
+++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
@@ -71,7 +71,9 @@ public class DragonControllerStrafe extends AbstractDragonController {
                         EntityDragonFireball entitydragonfireball = new EntityDragonFireball(this.a.world, this.a, d9, d10, d11);
 
                         entitydragonfireball.setPositionRotation(d6, d7, d8, 0.0F, 0.0F);
+                        if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) a.getBukkitEntity(), (org.bukkit.entity.DragonFireball) entitydragonfireball.getBukkitEntity()).callEvent()) // Paper
                         this.a.world.addEntity(entitydragonfireball);
+                        else entitydragonfireball.die(); // Paper
                         this.c = 0;
                         if (this.d != null) {
                             while (!this.d.b()) {
diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java
index 743a08d18df8890a61eeb48984c0882bb353e15c..96fdf9d068c2df154dbc2fb7978b0ba7a030c834 100644
--- a/src/main/java/net/minecraft/server/EntityDragonFireball.java
+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java
@@ -46,8 +46,10 @@ public class EntityDragonFireball extends EntityFireball {
                     }
                 }
 
+                if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(EntityLiving::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper
                 this.world.triggerEffect(2006, this.getChunkCoordinates(), this.isSilent() ? -1 : 1);
                 this.world.addEntity(entityareaeffectcloud);
+                } else entityareaeffectcloud.die(); // Paper
                 this.die();
             }