diff options
author | Owen <[email protected]> | 2022-03-11 15:13:46 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-11 21:13:46 +0100 |
commit | ea1efef1164aa7653119eb4be000749930e5b4da (patch) | |
tree | 104968ec407cf897e14388b14d2bf397844c8279 /patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch | |
parent | 1790528a6104c7c801e02a6f6d2ec0dda70e2af9 (diff) | |
download | Paper-ea1efef1164aa7653119eb4be000749930e5b4da.tar.gz Paper-ea1efef1164aa7653119eb4be000749930e5b4da.zip |
Remove Patches (#7541)
Diffstat (limited to 'patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch')
-rw-r--r-- | patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch b/patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch new file mode 100644 index 0000000000..ded712fe98 --- /dev/null +++ b/patches/server/0261-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Mon, 10 Sep 2018 23:56:36 -0400 +Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks + + +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +index 4a67daa7ee7f8c0fcb37c2a0fdba158485343a1f..027ef44d46cb1dda19c5c239f6970c90285fb961 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/RemoveBlockGoal.java +@@ -133,7 +133,9 @@ public class RemoveBlockGoal extends MoveToBlockGoal { + + @Nullable + private BlockPos getPosWithBlock(BlockPos pos, BlockGetter world) { +- if (world.getBlockState(pos).is(this.blockToRemove)) { ++ net.minecraft.world.level.block.state.BlockState block = world.getBlockStateIfLoaded(pos); // Paper ++ if (block == null) return null; // Paper ++ if (block.is(this.blockToRemove)) { // Paper + return pos; + } else { + BlockPos[] ablockposition = new BlockPos[]{pos.below(), pos.west(), pos.east(), pos.north(), pos.south(), pos.below().below()}; +@@ -143,7 +145,8 @@ public class RemoveBlockGoal extends MoveToBlockGoal { + for (int j = 0; j < i; ++j) { + BlockPos blockposition1 = ablockposition1[j]; + +- if (world.getBlockState(blockposition1).is(this.blockToRemove)) { ++ net.minecraft.world.level.block.state.BlockState block2 = world.getBlockStateIfLoaded(blockposition1); // Paper ++ if (block2 != null && block2.is(this.blockToRemove)) { // Paper + return blockposition1; + } + } +@@ -154,7 +157,7 @@ public class RemoveBlockGoal extends MoveToBlockGoal { + + @Override + protected boolean isValidTarget(LevelReader world, BlockPos pos) { +- ChunkAccess ichunkaccess = world.getChunk(SectionPos.blockToSectionCoord(pos.getX()), SectionPos.blockToSectionCoord(pos.getZ()), ChunkStatus.FULL, false); ++ ChunkAccess ichunkaccess = world.getChunkIfLoadedImmediately(pos.getX() >> 4, pos.getZ() >> 4); // Paper + + return ichunkaccess == null ? false : ichunkaccess.getBlockState(pos).is(this.blockToRemove) && ichunkaccess.getBlockState(pos.above()).isAir() && ichunkaccess.getBlockState(pos.above(2)).isAir(); + } |