Scissors/patches/server/0050-Limit-save-data-for-Bees-and-Vexes.patch
2023-07-05 17:56:31 -05:00

45 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Allink <arclicious@vivaldi.net>
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 c33e5c51839c8e6ec04c1b302127d2bf0f48664c..c59094fbcb772ec9d671d02f38c2214cb0c94990 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -223,8 +223,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 bb5c2f90bef5e3c57ffde996853e122d108b2789..4505af9d995df1ed2912814249bc336127be4f06 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")) {