2021-06-11 12:02:28 +00:00
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
2021-06-12 21:31:35 +00:00
index df44bfce8cc492cd901dfa86331b9be7f1e13837..7490674d59d152a70e24a790bdbc717998ed2c52 100644
2021-06-11 12:02:28 +00:00
--- 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
2021-06-12 21:31:35 +00:00
@@ -81,7 +81,13 @@ public class DragonSittingFlamingPhase extends AbstractDragonSittingPhase {
2021-06-11 12:02:28 +00:00
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
this.dragon.level.addFreshEntity(this.flame);
2021-06-12 21:31:35 +00:00
+ // Paper start
2021-06-11 12:02:28 +00:00
+ } else {
2021-06-12 21:31:35 +00:00
+ this.end();
2021-06-11 12:02:28 +00:00
+ }
2021-06-12 21:31:35 +00:00
+ // Paper end
2021-06-11 12:02:28 +00:00
}
}
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
2021-06-12 21:31:35 +00:00
index 974895ef23e9d2b8c520abd262a2e80d28be5860..318a288a9170254b682955d96a150e99ca89b345 100644
2021-06-11 12:02:28 +00:00
--- 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
2021-06-12 21:31:35 +00:00
@@ -71,7 +71,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance {
2021-06-11 12:02:28 +00:00
2021-06-12 21:31:35 +00:00
DragonFireball dragonFireball = new DragonFireball(this.dragon.level, this.dragon, r, s, t);
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
this.dragon.level.addFreshEntity(dragonFireball);
+ else dragonFireball.discard(); // Paper
2021-06-11 12:02:28 +00:00
this.fireballCharge = 0;
if (this.currentPath != null) {
2021-06-12 21:31:35 +00:00
while(!this.currentPath.isDone()) {
2021-06-11 12:02:28 +00:00
diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
2021-06-12 21:31:35 +00:00
index a7935042497a108a21814c28b01a0ab27aefbbc4..6afe37e42d88701af38df5793a9ea9d7d2cda5c5 100644
2021-06-11 12:02:28 +00:00
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
2021-06-12 21:31:35 +00:00
@@ -52,8 +52,10 @@ public class DragonFireball extends AbstractHurtingProjectile {
2021-06-11 12:02:28 +00:00
}
}
2021-06-12 21:31:35 +00:00
+ 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) areaEffectCloud.getBukkitEntity()).callEvent()) { // Paper
2021-06-11 12:02:28 +00:00
this.level.levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
2021-06-12 21:31:35 +00:00
this.level.addFreshEntity(areaEffectCloud);
+ } else areaEffectCloud.discard(); // Paper
this.discard();
2021-06-11 12:02:28 +00:00
}