mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 17:09:29 +00:00
Backport some fixes from Paper 1.21.6
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: hayanesuru <hayanesuru@outlook.jp>
|
||||
Date: Tue, 3 Jun 2025 15:20:59 +0900
|
||||
Subject: [PATCH] optimize mob spawning
|
||||
|
||||
|
||||
diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java
|
||||
index f242941ce06d356a025e306efe78c688e9b755c4..38a6a11c05c0a0a2f59c1477e516431263dce101 100644
|
||||
--- a/net/minecraft/world/level/NaturalSpawner.java
|
||||
+++ b/net/minecraft/world/level/NaturalSpawner.java
|
||||
@@ -472,6 +472,17 @@ public final class NaturalSpawner {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Leaf start - optimize mob spawning
|
||||
+ private static void mutableRandomPosWithin(BlockPos.MutableBlockPos pos1, Level level, LevelChunk chunk) {
|
||||
+ ChunkPos pos = chunk.getPos();
|
||||
+ int randomX = pos.getMinBlockX() + level.random.nextInt(16);
|
||||
+ int randomZ = pos.getMinBlockZ() + level.random.nextInt(16);
|
||||
+ int surfaceY = chunk.getHeight(Heightmap.Types.WORLD_SURFACE, randomX, randomZ) + 1;
|
||||
+ int randomY = Mth.randomBetweenInclusive(level.random, level.getMinY(), surfaceY);
|
||||
+ pos1.set(randomX, randomY, randomZ);
|
||||
+ }
|
||||
+ // Leaf end - optimize mob spawning
|
||||
+
|
||||
private static BlockPos getRandomPosWithin(Level level, LevelChunk chunk) {
|
||||
ChunkPos pos = chunk.getPos();
|
||||
int i = pos.getMinBlockX() + level.random.nextInt(16);
|
||||
Reference in New Issue
Block a user