9
0
mirror of https://github.com/Dreeam-qwq/Gale.git synced 2025-12-23 16:59:23 +00:00

Drop Optimize random calls in chunk ticking

This commit is contained in:
Dreeam
2024-07-16 20:11:23 +08:00
parent 65a5517dde
commit d70d3a044c
108 changed files with 12 additions and 10 deletions

View File

@@ -3,6 +3,8 @@ From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Wed, 23 Nov 2022 16:45:45 +0100
Subject: [PATCH] Optimize random calls in chunk ticking
Removed since 1.21
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org

View File

@@ -31,7 +31,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index c7c83e99d0683ef6d057e56d1adc6d68424329a2..997d6fa7651be19553d055cf6f33fed556ab383b 100644
index f027997cb227bbadf6000ddb236fa6622304216d..8b8dbaf0a2cb8cb39bf178edb1a78f60f2043096 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -741,7 +741,20 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.

View File

@@ -13,10 +13,10 @@ As part of: SportPaper (https://github.com/Electroid/SportPaper)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 997d6fa7651be19553d055cf6f33fed556ab383b..8bca5e1165e09e219386a787eb36fabcd948a0e6 100644
index 8b8dbaf0a2cb8cb39bf178edb1a78f60f2043096..ec3edbfe8c9a7aef5a9f37fa1d2279acf4827660 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1602,7 +1602,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1600,7 +1600,17 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@Override
public void destroyBlockProgress(int entityId, BlockPos pos, int progress) {
@@ -35,7 +35,7 @@ index 997d6fa7651be19553d055cf6f33fed556ab383b..8bca5e1165e09e219386a787eb36fabc
// CraftBukkit start
Player entityhuman = null;
@@ -1636,7 +1646,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1634,7 +1644,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// CraftBukkit end
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {

View File

@@ -13,12 +13,12 @@ As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 4c4f4d862b898837e498486ae9e710891158702e..105e3b989440380e8c917075c335f58a96a5dde9 100644
index ccd6a21e502bfd25a0a84fdf1b6d6f2606cf7156..3b81ba4c283e474493e9bc97bbfa230a7878cdbc 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -432,11 +432,16 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -431,11 +431,16 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
this.level.resetIceAndSnowTick(); // Gale - Airplane - optimize random calls in chunk ticking - reset ice & snow tick random
if (this.level.tickRateManager().runsNormally()) {
+ // Gale start - MultiPaper - skip unnecessary mob spawning computations
+ NaturalSpawner.SpawnState spawnercreature_d; // moved down
@@ -34,7 +34,7 @@ index 4c4f4d862b898837e498486ae9e710891158702e..105e3b989440380e8c917075c335f58a
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
// re-set mob counts
for (ServerPlayer player : this.level.players) {
@@ -460,7 +465,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -459,7 +464,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
this.level.timings.countNaturalMobs.stopTiming(); // Paper - timings
this.lastSpawnState = spawnercreature_d;
@@ -47,7 +47,7 @@ index 4c4f4d862b898837e498486ae9e710891158702e..105e3b989440380e8c917075c335f58a
Util.shuffle(list, this.level.random);
// Paper start - PlayerNaturallySpawnCreaturesEvent
@@ -483,7 +492,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -482,7 +491,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
if (this.level.isNaturalSpawningAllowed(chunkcoordintpair) && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) {
chunk1.incrementInhabitedTime(j);
@@ -56,7 +56,7 @@ index 4c4f4d862b898837e498486ae9e710891158702e..105e3b989440380e8c917075c335f58a
NaturalSpawner.spawnForChunk(this.level, chunk1, spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1);
}
@@ -514,6 +523,20 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -513,6 +522,20 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
}

Some files were not shown because too many files have changed in this diff Show More