diff --git a/Spigot-Server-Patches/Entity-Origin-API.patch b/Spigot-Server-Patches/Entity-Origin-API.patch index 5e5aefe45a8..ffe6fb21c7a 100644 --- a/Spigot-Server-Patches/Entity-Origin-API.patch +++ b/Spigot-Server-Patches/Entity-Origin-API.patch @@ -50,6 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end + // Paper start - Save the entity's origin location + if (this.origin != null) { ++ nbttagcompound.setUUID("Paper.OriginWorld", origin.getWorld().getUID()); + nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); + } + // Paper end @@ -63,7 +64,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Restore the entity's origin location + NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6); + if (!originTag.isEmpty()) { -+ origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); ++ org.bukkit.World originWorld = world.getWorld(); ++ if (nbttagcompound.hasKey("Paper.OriginWorld")) { ++ originWorld = Bukkit.getWorld(nbttagcompound.getUUID("Paper.OriginWorld")); ++ } ++ origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); + } + // Paper end + diff --git a/Spigot-Server-Patches/Entity-fromMobSpawner.patch b/Spigot-Server-Patches/Entity-fromMobSpawner.patch index a4301e1783b..72a76c566a5 100644 --- a/Spigot-Server-Patches/Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/Entity-fromMobSpawner.patch @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void inactiveTick() { } // Spigot end @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne - if (this.origin != null) { + nbttagcompound.setUUID("Paper.OriginWorld", origin.getWorld().getUID()); nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } + // Save entity's from mob spawner status @@ -28,8 +28,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return nbttagcompound; } catch (Throwable throwable) { @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne - if (!originTag.isEmpty()) { - origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); + } + origin = new org.bukkit.Location(originWorld, originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); } + + spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status diff --git a/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch b/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch index 226993e7032..b469bc0a8cc 100644 --- a/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch +++ b/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch @@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne - if (this.origin != null) { + nbttagcompound.setUUID("Paper.OriginWorld", origin.getWorld().getUID()); nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } + if (spawnReason != null) { diff --git a/Spigot-Server-Patches/Fix-invulnerable-end-crystals.patch b/Spigot-Server-Patches/Fix-invulnerable-end-crystals.patch index 1a2b8006238..69839d43468 100644 --- a/Spigot-Server-Patches/Fix-invulnerable-end-crystals.patch +++ b/Spigot-Server-Patches/Fix-invulnerable-end-crystals.patch @@ -1,5 +1,5 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Jake Potrebic +From: Max Lee Date: Thu, 27 May 2021 14:52:30 -0700 Subject: [PATCH] Fix invulnerable end crystals @@ -19,32 +19,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + fixInvulnerableEndCrystalExploit = getBoolean("unsupported-settings.fix-invulnerable-end-crystal-exploit", fixInvulnerableEndCrystalExploit); + } } -diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java -@@ -0,0 +0,0 @@ public class EnderDragonBattle { +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java +@@ -0,0 +0,0 @@ public class EntityEnderCrystal extends Entity { + private static final DataWatcherObject> c = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.m); + private static final DataWatcherObject d = DataWatcher.a(EntityEnderCrystal.class, DataWatcherRegistry.i); + public int b; ++ public boolean generatedByDragonFight = false; // Paper - Fix invulnerable end crystals - while (iterator.hasNext()) { - WorldGenEnder.Spike worldgenender_spike = (WorldGenEnder.Spike) iterator.next(); -+ if (!this.world.paperConfig.fixInvulnerableEndCrystalExploit || worldgenender_spike.crystal == null) { // Paper - List list = this.world.a(EntityEnderCrystal.class, worldgenender_spike.f()); - Iterator iterator1 = list.iterator(); - -@@ -0,0 +0,0 @@ public class EnderDragonBattle { - entityendercrystal.setInvulnerable(false); - entityendercrystal.setBeamTarget((BlockPosition) null); + public EntityEnderCrystal(EntityTypes entitytypes, World world) { + super(entitytypes, world); +@@ -0,0 +0,0 @@ public class EntityEnderCrystal extends Entity { + } + // CraftBukkit end } -+ // Paper start -+ } else { -+ worldgenender_spike.crystal.setInvulnerable(false); -+ worldgenender_spike.crystal.setBeamTarget(null); -+ worldgenender_spike.crystal = null; ++ // Paper start - Fix invulnerable end crystals ++ if (this.world.paperConfig.fixInvulnerableEndCrystalExploit && this.generatedByDragonFight && this.isInvulnerable()) { ++ if ((this.origin.getWorld() != null && !((WorldServer) this.world).uuid.equals(this.origin.getWorld().getUID())) ++ || ((WorldServer) this.world).getDragonBattle() == null ++ || ((WorldServer) this.world).getDragonBattle().respawnPhase == null ++ || ((WorldServer) this.world).getDragonBattle().respawnPhase.ordinal() > net.minecraft.world.level.dimension.end.EnumDragonRespawn.SUMMONING_DRAGON.ordinal()) { ++ this.setInvulnerable(false); ++ this.setBeamTarget(null); ++ } + } + // Paper end } } +@@ -0,0 +0,0 @@ public class EntityEnderCrystal extends Entity { + } + + nbttagcompound.setBoolean("ShowBottom", this.isShowingBottom()); ++ if (this.generatedByDragonFight) nbttagcompound.setBoolean("Paper.GeneratedByDragonFight", this.generatedByDragonFight); // Paper - Fix invulnerable end crystals + } + + @Override +@@ -0,0 +0,0 @@ public class EntityEnderCrystal extends Entity { + if (nbttagcompound.hasKeyOfType("ShowBottom", 1)) { + this.setShowingBottom(nbttagcompound.getBoolean("ShowBottom")); + } ++ if (nbttagcompound.hasKeyOfType("Paper.GeneratedByDragonFight", 1)) this.generatedByDragonFight = nbttagcompound.getBoolean("Paper.GeneratedByDragonFight"); // Paper - Fix invulnerable end crystals + + } + diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEnder.java b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEnder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEnder.java @@ -59,18 +79,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (list.isEmpty()) { @@ -0,0 +0,0 @@ public class WorldGenEnder extends WorldGenerator