From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: MrHua269 Date: Sat, 8 Mar 2025 21:21:11 +0800 Subject: [PATCH] Paper: Prevent zombie reinforcements loading chunks Origin: https://github.com/PaperMC/Paper/pull/11945 Co-authored by: Newwind As part of: Paper (https://github.com/PaperMC/Paper/blob/2ae1f05336d0f13b646e6c284f83ded16aae84ff/patches/server/1045-Prevent-zombie-reinforcements-loading-chunks.patch) Licensed under: GPL-3.0 (https://github.com/PaperMC/Paper/blob/fa360aa83657d15e8e803ce55800986f6bff8f70/licenses/GPL.md) diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java index a23607874a72723914cbfeea0ad1c51236c044d8..14d0758aca54d9a25e369dfa8c89c930f27946c9 100644 --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java @@ -352,6 +352,13 @@ public class Zombie extends Monster { int i2 = floor1 + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); int i3 = floor2 + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); BlockPos blockPos = new BlockPos(i1, i2, i3); + + // Paper start - Prevent reinforcement checks from loading chunks + if (this.level().getChunkIfLoadedImmediately(blockPos.getX() >> 4, blockPos.getZ() >> 4) == null) { + continue; + } + // Paper end - Prevent reinforcement checks from loading chunks + if (SpawnPlacements.isSpawnPositionOk(type, level, blockPos) && SpawnPlacements.checkSpawnRules(type, level, EntitySpawnReason.REINFORCEMENT, blockPos, level.random)) { zombie.setPos(i1, i2, i3);