From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: BillyGalbreath 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 5d6662740e126520e2d9f54585943ede77128360..58c7e282cf29bbdad3bd8c0a0d43ecefc411d20d 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 @@ -83,7 +83,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 this.dragon.level().addFreshEntity(this.flame); + // Paper start + } else { + this.end(); + } + // Paper end } } 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 f3cc80726e65b57dc03895d1707a8e803b7ea02c..fb92cfde2b6c70839a95ed0f25c015a029563715 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 @@ -74,7 +74,9 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { 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 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 1d1b5aa74d3c3e74c5f24120fc5f6df76fd036d5..52eb930c5425bc4db32e65ac2b1fb07300617725 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java @@ -52,8 +52,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) areaEffectCloud.getBukkitEntity()).callEvent()) { // Paper this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1); this.level().addFreshEntity(areaEffectCloud); + } else areaEffectCloud.discard(); // Paper this.discard(); }