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 174e0113d54d049b56316f4cba8250ba7df4d236..29e040ff5c2d5c4022dd18d807b1b665e2acbe9c 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2506,6 +2506,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S 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"); @@ -2583,6 +2594,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S 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"); }