aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0213-EnderDragon-Events.patch
blob: 73e0d7b1691117bc9e35c7867889097b9f27c642 (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
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/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
index 3eaf64a6f66c6a844e30967e6b87432e559a59e7..5c5c71db73a2bfebbb33cebd6325a0f4fef1f239 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonSittingFlamingPhase.java
@@ -88,7 +88,13 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase {
             this.flame.setDuration(200);
             this.flame.setParticle(ParticleTypes.DRAGON_BREATH);
             this.flame.addEffect(new MobEffectInstance(MobEffects.HARM));
+            if (new com.destroystokyo.paper.event.entity.EnderDragonFlameEvent((org.bukkit.entity.EnderDragon) this.dragon.getBukkitEntity(), (org.bukkit.entity.AreaEffectCloud) this.flame.getBukkitEntity()).callEvent()) { // Paper - EnderDragon Events
             this.dragon.level().addFreshEntity(this.flame);
+            // Paper start - EnderDragon Events
+            } else {
+                this.end();
+            }
+            // Paper end - EnderDragon Events
         }
 
     }
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
index e5c896409536b7fb908590d02e40923d5979841f..a28e6b6a50cfd9191732ad2e4aca5f639a1fae75 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java
@@ -79,7 +79,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
 
                         DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize());
                         dragonFireball.moveTo(o, p, q, 0.0F, 0.0F);
+                        if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events
                         this.dragon.level().addFreshEntity(dragonFireball);
+                        else dragonFireball.discard(null); // Paper - EnderDragon Events
                         this.fireballCharge = 0;
                         if (this.currentPath != null) {
                             while (!this.currentPath.isDone()) {
diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
index 3c77515f6b7f1ff89325afba214e9a8e5f536158..1dade7a4fbdf190661e4431496349444467509cc 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
@@ -63,8 +63,10 @@ public class DragonFireball extends AbstractHurtingProjectile {
                     }
                 }
 
+                if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(LivingEntity::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) entityareaeffectcloud.getBukkitEntity()).callEvent()) { // Paper - EnderDragon Events
                 this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
                 this.level().addFreshEntity(entityareaeffectcloud);
+                } else entityareaeffectcloud.discard(null); // Paper - EnderDragon Events
                 this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
             }