mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-21 07:59:26 +00:00
* uwu * reorder * Change author * Sync upstream * Lithium: equipment tracking * Faster CraftServer#getworlds list creation Co-Authored-By: Kobe ⑧ <102713261+HaHaWTH@users.noreply.github.com>
31 lines
2.3 KiB
Diff
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 aa1fd8f2fba06292e93aba279cf18640b6909add..49c37853a0c26cef749a8a5ef4130554c0319ad9 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
|