diff options
Diffstat (limited to 'nms-patches')
-rw-r--r-- | nms-patches/DragonControllerManager.patch | 64 | ||||
-rw-r--r-- | nms-patches/EntityEnderDragon.patch | 9 |
2 files changed, 73 insertions, 0 deletions
diff --git a/nms-patches/DragonControllerManager.patch b/nms-patches/DragonControllerManager.patch new file mode 100644 index 00000000..f33447d3 --- /dev/null +++ b/nms-patches/DragonControllerManager.patch @@ -0,0 +1,64 @@ +--- a/net/minecraft/server/DragonControllerManager.java ++++ b/net/minecraft/server/DragonControllerManager.java +@@ -2,32 +2,44 @@ + + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; ++import org.bukkit.craftbukkit.entity.CraftEnderDragon; ++import org.bukkit.entity.EnderDragon; ++import org.bukkit.event.entity.EnderDragonChangePhaseEvent; + + public class DragonControllerManager { + + private static final Logger a = LogManager.getLogger(); +- private final EntityEnderDragon b; +- private final IDragonController[] c = new IDragonController[DragonControllerPhase.c()]; +- private IDragonController d; ++ private final EntityEnderDragon b; // PAIL: Rename enderDragon ++ private final IDragonController[] c = new IDragonController[DragonControllerPhase.c()]; // PAIL: Rename dragonControllers ++ private IDragonController d; // PAIL: Rename currentDragonController + + public DragonControllerManager(EntityEnderDragon entityenderdragon) { + this.b = entityenderdragon; + this.a(DragonControllerPhase.k); + } + +- public void a(DragonControllerPhase<?> dragoncontrollerphase) { +- if (this.d == null || dragoncontrollerphase != this.d.i()) { ++ public void a(DragonControllerPhase<?> dragoncontrollerphase) { // PAIL: Rename setControllerPhase ++ if (this.d == null || dragoncontrollerphase != this.d.i()) { // PAIL: Rename getControllerPhase + if (this.d != null) { +- this.d.e(); ++ this.d.e(); // PAIL: Rename + } + +- this.d = this.b(dragoncontrollerphase); ++ // CraftBukkit start - Call EnderDragonChangePhaseEvent ++ EnderDragonChangePhaseEvent event = new EnderDragonChangePhaseEvent((CraftEnderDragon) this.b.getBukkitEntity(), this.d == null ? null : CraftEnderDragon.getBukkitPhase(this.d.i()), CraftEnderDragon.getBukkitPhase(dragoncontrollerphase)); ++ this.b.world.getServer().getPluginManager().callEvent(event); ++ if (event.isCancelled()) { ++ return; ++ } ++ dragoncontrollerphase = CraftEnderDragon.getMinecraftPhase(event.getNewPhase()); ++ // CraftBukkit end ++ ++ this.d = this.b(dragoncontrollerphase); // PAIL: Rename getDragonController + if (!this.b.world.isClientSide) { +- this.b.getDataWatcher().set(EntityEnderDragon.a, Integer.valueOf(dragoncontrollerphase.b())); ++ this.b.getDataWatcher().set(EntityEnderDragon.a, Integer.valueOf(dragoncontrollerphase.b())); // PAIL: Rename getId + } + + DragonControllerManager.a.debug("Dragon is now in phase {} on the {}", new Object[] { dragoncontrollerphase, this.b.world.isClientSide ? "client" : "server"}); +- this.d.d(); ++ this.d.d(); // PAIL: Rename reset + } + } + +@@ -42,6 +54,6 @@ + this.c[i] = dragoncontrollerphase.a(this.b); + } + +- return this.c[i]; ++ return (T) this.c[i]; + } + } diff --git a/nms-patches/EntityEnderDragon.patch b/nms-patches/EntityEnderDragon.patch index 974f5d4f..456f569a 100644 --- a/nms-patches/EntityEnderDragon.patch +++ b/nms-patches/EntityEnderDragon.patch @@ -21,6 +21,15 @@ public EntityEnderDragon(World world) { super(world); +@@ -169,7 +175,7 @@ + + Vec3D vec3d = idragoncontroller.g(); + +- if (vec3d != null) { ++ if (vec3d != null && idragoncontroller.i() != DragonControllerPhase.k) { // CraftBukkit - Don't move when hovering + d0 = vec3d.x - this.locX; + d1 = vec3d.y - this.locY; + d2 = vec3d.z - this.locZ; @@ -308,7 +314,14 @@ if (this.currentEnderCrystal.dead) { this.currentEnderCrystal = null; |