From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sun, 11 Jun 2023 23:59:29 +0300 Subject: [PATCH] Fix MC-2025 Original post on Mojira: https://bugs.mojang.com/browse/MC-2025 Fix taken from Reddit: https://redd.it/8pgd4q diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index aa171a1afb9800e6ec84f6b4f1b28e44177752f7..306fd7d38d359715637aa52f1ba261f5a1d94e07 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2722,6 +2722,17 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess nbttagcompound.putBoolean("Purpur.FireImmune", immuneToFire); } // Purpur end + + // DivineMC start - Fix MC-2025 + // This fix was taken from Reddit: https://redd.it/8pgd4q + AABB boundingBox = getBoundingBox(); + ListTag boundingBoxList = new ListTag(); + for (double coord : new double[]{boundingBox.minX, boundingBox.minY, boundingBox.minZ, boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ}) { + boundingBoxList.add(DoubleTag.valueOf(coord)); + } + nbttagcompound.put("DivineMC.BoundingBox", boundingBoxList); + // DivineMC end + return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); @@ -2800,6 +2811,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.reapplyPosition(); } + // DivineMC start - Fix MC-2025 + // This fix was taken from Reddit: https://redd.it/8pgd4q + if (nbt.contains("DivineMC.BoundingBox", net.minecraft.nbt.Tag.TAG_LIST)) { + ListTag boundingBoxList = nbt.getList("DivineMC.BoundingBox", net.minecraft.nbt.Tag.TAG_DOUBLE); + setBoundingBox(new AABB(boundingBoxList.getDouble(0), boundingBoxList.getDouble(1), boundingBoxList.getDouble(2), boundingBoxList.getDouble(3), boundingBoxList.getDouble(4), boundingBoxList.getDouble(5))); + } + // DivineMC end + } else { throw new IllegalStateException("Entity has invalid rotation"); }