Skip to content

Commit

Permalink
Updated Upstream (Gale)
Browse files Browse the repository at this point in the history
Upstream has released updates that appear to apply and compile correctly

Gale Changes:
Dreeam-qwq/Gale@791f8d1 Revert "Fix fluidStateCount increment"
Dreeam-qwq/Gale@463fdde Add back Optimize entity coordinate key
Dreeam-qwq/Gale@3b27166 Add configurable xor-shift random support for optimized lighning random tick
Dreeam-qwq/Gale@1acfc2a Add back IceAndSnowTick optimization in Optimize random calls in chunk ticking
  • Loading branch information
Dreeam-qwq committed Aug 6, 2024
1 parent 711b992 commit 2149923
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group = cn.dreeam.leaf
mcVersion = 1.21
version = 1.21-R0.1-SNAPSHOT

galeCommit = a8aff53ed53fbbb183c120bc60aa085c80f00b83
galeCommit = 1acfc2a2f9e7308b7280a9b3a3a8d81cf9e9615e

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
10 changes: 5 additions & 5 deletions patches/server/0007-Pufferfish-Optimize-mob-spawning.patch
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ index 30ddaba93a1b2bb228a9fcdf25e8abab036d9f38..3ca8a80f44ef8c3fbf55250dc1f345e2
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 9fd7b17b7806636777de40abb9963ce770a97d15..1e7350b3199b1f1b9935c1893e61f41c4cc0d999 100644
index c520d824630e8b5c569c3213d019b2548120a50f..01ea21b960b5b32cdb14cefd1c23b50ba5cb8335 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -127,6 +127,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
Expand All @@ -58,15 +58,15 @@ index 9fd7b17b7806636777de40abb9963ce770a97d15..1e7350b3199b1f1b9935c1893e61f41c
public ServerChunkCache(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor workerExecutor, ChunkGenerator chunkGenerator, int viewDistance, int simulationDistance, boolean dsync, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory) {
this.level = world;
this.mainThreadProcessor = new ServerChunkCache.MainThreadExecutor(world);
@@ -453,6 +456,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -454,6 +457,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
// Paper start - Optional per player mob spawns
int naturalSpawnChunkCount = k;
if ((this.spawnFriendlies || this.spawnEnemies) && this.level.paperConfig().entities.spawning.perPlayerMobSpawns) { // don't count mobs when animals and monsters are disabled
+ if (!org.dreeam.leaf.config.modules.async.AsyncMobSpawning.enabled) { // Pufferfish - moved down when async processing
// re-set mob counts
for (ServerPlayer player : this.level.players) {
// Paper start - per player mob spawning backoff
@@ -467,14 +471,18 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -468,14 +472,18 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
// Paper end - per player mob spawning backoff
}
Expand All @@ -88,7 +88,7 @@ index 9fd7b17b7806636777de40abb9963ce770a97d15..1e7350b3199b1f1b9935c1893e61f41c
// Gale start - MultiPaper - skip unnecessary mob spawning computations
} else {
spawnercreature_d = null;
@@ -502,8 +510,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -503,8 +511,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon

if (true && this.chunkMap.anyPlayerCloseEnoughForSpawning(chunkcoordintpair)) { // Paper - rewrite chunk system
chunk1.incrementInhabitedTime(j);
Expand All @@ -99,7 +99,7 @@ index 9fd7b17b7806636777de40abb9963ce770a97d15..1e7350b3199b1f1b9935c1893e61f41c
}

if (true) { // Paper - rewrite chunk system
@@ -543,6 +551,40 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -544,6 +552,40 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
this.level.timings.broadcastChunkUpdates.stopTiming(); // Paper - timing
// Paper end - chunk tick iteration optimisations
}
Expand Down
16 changes: 8 additions & 8 deletions patches/server/0011-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ index c80be65d190c85e7f0ea8233ebbbdbc1ea67f276..97e793c971614299504605aeb4f99cad
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
this.trackedPlayers = trackedPlayers;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 21a910e69bf7b10d11a93793a6854198cc77c4c9..3a0315edfafd18b995b6b614b3b20f17777c4575 100644
index 881f507ff6fcac86f8ef04cbd3ff10c41c840d52..0ed4f5a291ef5009a0535273ac52a9fbac150553 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -220,6 +220,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
Expand Down Expand Up @@ -1070,7 +1070,7 @@ index 21a910e69bf7b10d11a93793a6854198cc77c4c9..3a0315edfafd18b995b6b614b3b20f17
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
Iterator iterator = this.customSpawners.iterator();

@@ -862,10 +904,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -864,10 +906,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper - Configurable spawn chances for skeleton horses

if (flag1) {
Expand All @@ -1091,7 +1091,7 @@ index 21a910e69bf7b10d11a93793a6854198cc77c4c9..3a0315edfafd18b995b6b614b3b20f17
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -944,7 +994,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -946,7 +996,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return holder.is(PoiTypes.LIGHTNING_ROD);
}, (blockposition1) -> {
return blockposition1.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockposition1.getX(), blockposition1.getZ()) - 1;
Expand All @@ -1100,7 +1100,7 @@ index 21a910e69bf7b10d11a93793a6854198cc77c4c9..3a0315edfafd18b995b6b614b3b20f17

return optional.map((blockposition1) -> {
return blockposition1.above(1);
@@ -993,11 +1043,27 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -995,11 +1045,27 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
if (this.canSleepThroughNights()) {
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
Expand Down Expand Up @@ -1129,23 +1129,23 @@ index 21a910e69bf7b10d11a93793a6854198cc77c4c9..3a0315edfafd18b995b6b614b3b20f17
ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
}

@@ -1137,6 +1203,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1139,6 +1205,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@VisibleForTesting
public void resetWeatherCycle() {
// CraftBukkit start
+ if (this.purpurConfig.rainStopsAfterSleep) // Purpur
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
@@ -1144,6 +1211,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1146,6 +1213,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.serverLevelData.setRainTime(0);
}
// CraftBukkit end
+ if (this.purpurConfig.thunderStopsAfterSleep) // Purpur
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
@@ -2582,7 +2650,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -2584,7 +2652,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal
Expand Down Expand Up @@ -2100,7 +2100,7 @@ index f43bf280999ff3860cc702def50cc62b131eb1bd..66d9e99a351f5fc6cf58be3bee4397d9
}

diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7c56c3b84809e751e94a2ac4ca27ab81168058c4..2429d9b16cb307d3c9aeb3ec8af677490d3fd3c2 100644
index 815db5b0a24f1628d646893ebad466dcee2ab0bd..06e5d3e2dfc762c640b5261b4962503e48c2a76f 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -169,6 +169,7 @@ import org.bukkit.plugin.PluginManager;
Expand Down
8 changes: 4 additions & 4 deletions patches/server/0012-Fix-Pufferfish-and-Purpur-patches.patch
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ index 096c89bd01cec2abd151bf6fffc4847d1bcd548f..cd0a8a6a1be75cab8bbb8ee3ac17bb73
this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
this.repaint();
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 1e7350b3199b1f1b9935c1893e61f41c4cc0d999..8fded112c6c30070ee6514ef25f1bad1d3fba4c1 100644
index 01ea21b960b5b32cdb14cefd1c23b50ba5cb8335..e8a89db44ed4f20516a9716bc3f41658f63a312c 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -485,7 +485,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -486,7 +486,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
//this.lastSpawnState = spawnercreature_d; // Pufferfish - this is managed asynchronously
// Gale start - MultiPaper - skip unnecessary mob spawning computations
} else {
Expand All @@ -77,7 +77,7 @@ index 1e7350b3199b1f1b9935c1893e61f41c4cc0d999..8fded112c6c30070ee6514ef25f1bad1
// Gale end - MultiPaper - skip unnecessary mob spawning computations

diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 3a816a31b9f3ecb02291b8be897db828502eab84..1b759f7ce1d1244982d8eac8b9bce95668e1bb8f 100644
index 0ed4f5a291ef5009a0535273ac52a9fbac150553..fae2574cee5779c4a3ea7aec393f087676327b0e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -658,7 +658,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
Expand All @@ -90,7 +90,7 @@ index 3a816a31b9f3ecb02291b8be897db828502eab84..1b759f7ce1d1244982d8eac8b9bce956
j = this.levelData.getDayTime() + 24000L;
TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (j - j % 24000L) - this.getDayTime());
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c0995861d1987f62f1bf2d37939f57c55f314c24..0a40cff1da82157487d209e63628387092d0d334 100644
index 06e5d3e2dfc762c640b5261b4962503e48c2a76f..164c126a61f550c09a7e114bf8947bde1c5a3aa8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -564,13 +564,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Expand Down
Loading

0 comments on commit 2149923

Please sign in to comment.