From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 22:25:11 -0700
Subject: [PATCH] Fix enderdragon exp dupe

Properly track death stage when unloading/loading in the
dragon

1.17: Mojang fixed in 1.17(maybe before, idk)

resolved by Mojang https://bugs.mojang.com/browse/MCPE-64818

diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
index ec9436005a3a6fdfb4783d1092bb361224eb6414..b224a630f8adb1fa357c838e6b32c784aed0b15b 100644
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EnderDragon.java
@@ -879,6 +879,7 @@ public class EnderDragon extends Mob implements Enemy {
     public void addAdditionalSaveData(CompoundTag tag) {
         super.addAdditionalSaveData(tag);
         tag.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
+        tag.putInt("Paper.DeathTick", this.dragonDeathTime); // Paper
     }
 
     @Override
@@ -887,6 +888,7 @@ public class EnderDragon extends Mob implements Enemy {
         if (tag.contains("DragonPhase")) {
             this.phaseManager.setPhase(EnderDragonPhase.getById(tag.getInt("DragonPhase")));
         }
+        this.dragonDeathTime = tag.getInt("Paper.DeathTick"); // Paper
 
     }
 
