9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-22 08:29:28 +00:00
Files
Leaf/patches/server/0100-Paper-PR-Prevent-zombie-reinforcements-loading-chunk.patch
Dreeam 29915218cb Updated Upstream (Paper/Gale)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@2aaf436 Validate slot in PlayerInventory#setSlot (#11399)
PaperMC/Paper@5c82955 Only mark decorations dirty if a removal actually occurs (#11413)
PaperMC/Paper@c5a1066 Remove wall-time / unused skip tick protection (#11412)

Gale Changes:
Dreeam-qwq/Gale@3a10fbf Updated Upstream (Paper)
2024-09-20 22:46:07 -04:00

31 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Newwind <support@newwindserver.com>
Date: Sat, 27 Jul 2024 11:09:37 +0200
Subject: [PATCH] Paper PR: Prevent zombie reinforcements loading chunks
Original license: GPLv3
Original project: https://github.com/PaperMC/Paper
Paper pull request: https://github.com/PaperMC/Paper/pull/11175
When a zombie calls reinforcements it tries to spawn them in a random location within a 40 block radius of the zombie,
before spawning, it checks isSpawnPositionOk() for the position which loads the block to check if a mob can spawn on said block.
This patch ensures the chunk at the random location is loaded before trying to spawn the reinforcement zombie in it.
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index ac9a63c70b5ddfb528eff559ca1464051d8865f4..7836f6142f1066d7f59724929ff7d8a2074bdfed 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -384,6 +384,12 @@ public class Zombie extends Monster {
BlockPos blockposition = new BlockPos(i1, j1, k1);
EntityType<?> entitytypes = entityzombie.getType();
+ // Paper start - Prevent reinforcement checks from loading chunks
+ if (this.level().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
+ continue;
+ }
+ // Paper end - Prevent reinforcement checks from loading chunks
+
if (SpawnPlacements.isSpawnPositionOk(entitytypes, this.level(), blockposition) && SpawnPlacements.checkSpawnRules(entitytypes, worldserver, MobSpawnType.REINFORCEMENT, blockposition, this.level().random)) {
entityzombie.setPos((double) i1, (double) j1, (double) k1);
if (!this.level().hasNearbyAlivePlayerThatAffectsSpawning((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) { // Paper - Affects Spawning API