From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Allink Date: Wed, 5 Jul 2023 22:58:24 +0100 Subject: [PATCH] Limit save data for Bees and Vexes diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..4a8383d48da4fcf39ec528a00cd09417f8d08c57 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java @@ -227,8 +227,12 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { @Override public void readAdditionalSaveData(CompoundTag nbt) { this.hivePos = null; - if (nbt.contains("HivePos")) { - this.hivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos")); + if (nbt.contains("HivePos")) + { + // Scissors start - Limit HivePos + final BlockPos savedHivePos = NbtUtils.readBlockPos(nbt.getCompound("HivePos")); + this.hivePos = this.level().isLoadedAndInBounds(savedHivePos) ? savedHivePos : null; + // Scissors end - Limit HivePos } this.savedFlowerPos = null; diff --git a/src/main/java/net/minecraft/world/entity/monster/Vex.java b/src/main/java/net/minecraft/world/entity/monster/Vex.java index 65cb385ab294e362d666a6d03c4496cdc3b64890..42c3e946e51f6dcb100078969a4fb46c77f42b2d 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Vex.java +++ b/src/main/java/net/minecraft/world/entity/monster/Vex.java @@ -118,8 +118,12 @@ public class Vex extends Monster implements TraceableEntity { @Override public void readAdditionalSaveData(CompoundTag nbt) { super.readAdditionalSaveData(nbt); - if (nbt.contains("BoundX")) { - this.boundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ")); + if (nbt.contains("BoundX")) + { + // Scissors start - Limit Vex bound origin + final BlockPos savedBoundOrigin = new BlockPos(nbt.getInt("BoundX"), nbt.getInt("BoundY"), nbt.getInt("BoundZ")); + this.boundOrigin = this.level().isLoadedAndInBounds(savedBoundOrigin) ? savedBoundOrigin : null; + // Scissors end - Limit Vex bound origin } if (nbt.contains("LifeTicks")) {