Skip to content

Commit

Permalink
Drop Optimize random calls in chunk ticking
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jul 16, 2024
1 parent 65a5517 commit d70d3a0
Show file tree
Hide file tree
Showing 108 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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
}
}

Expand Down
File renamed without changes.

0 comments on commit d70d3a0

Please sign in to comment.