PaperMC/Spigot-Server-Patches/0258-EnderDragon-Events.patch
Spottedleaf 5c7081fecc Update upstream & fix some chunk related issues (#2177)
* Updated Upstream (Bukkit/CraftBukkit)

Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories

CraftBukkit Changes:
4090d01f SPIGOT-5047: Correct slot types for 1.14 inventories
e8c08362 SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.
d445af3b SPIGOT-5067: Add item meta for 1.14 spawn eggs

* Bring Chunk load checks in-line with spigot

As of the last upstream merge spigot now checks ticket level status
when returning loaded chunks for a world from api. Now our checks
will respect that decision.

* Fix spawn ticket levels

Vanilla would keep the inner chunks of spawn available for ticking,
however my changes made all chunks non-ticking. Resolve by changing
ticket levels for spawn chunks inside the border to respect this
behavior.


* Make World#getChunkIfLoadedImmediately return only entity ticking chunks

Mojang appears to be using chunks with level > 33 (non-ticking chunks)
as cached chunks and not actually loaded chunks.

* Bring all loaded checks in line with spigot

Loaded chunks must be at least border  chunks, or level <= 33
2019-06-14 03:27:40 +01:00

61 lines
3.5 KiB
Diff

From 8f20e2699a59fc519e02eeb983ee623ddaef35a2 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 4ab310cd6b..90f6d58ddd 100644
--- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java
@@ -65,7 +65,9 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
this.d.setDuration(200);
this.d.setParticle(Particles.DRAGON_BREATH);
this.d.a(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(); // Paper
}
}
@@ -76,6 +78,8 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded
++this.c;
}
+
+ public void removeAreaEffect() { this.e(); } // Paper - OBFHELPER
@Override
public void e() {
if (this.d != null) {
diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
index 14e20f4961..0b0815e113 100644
--- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java
+++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java
@@ -68,7 +68,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 239be99c51..2195b83ce2 100644
--- a/src/main/java/net/minecraft/server/EntityDragonFireball.java
+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java
@@ -40,8 +40,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, new BlockPosition(this.locX, this.locY, this.locZ), 0);
this.world.addEntity(entityareaeffectcloud);
+ } else entityareaeffectcloud.die(); // Paper
this.die();
}
--
2.21.0