-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not search the block out of current region & Ported some micro opt…
…imizations from Leaf
- Loading branch information
Showing
27 changed files
with
104 additions
and
2 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
...erver/minecraft-patches/features/0021-Do-not-search-the-block-out-of-current-region.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: MrHua269 <[email protected]> | ||
Date: Sun, 9 Mar 2025 11:39:01 +0800 | ||
Subject: [PATCH] Do not search the block out of current region | ||
|
||
|
||
diff --git a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java | ||
index 61887e6b052bca715c90dff5d9cd657e0b3f6a78..95e2dff6782bf7767ecb1a23e618862919ea71aa 100644 | ||
--- a/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java | ||
+++ b/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java | ||
@@ -422,6 +422,7 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity { | ||
if (i != 0 || i1 != 0 || allowBedrock) { | ||
for (int y = level.getMaxY(); y > (blockPos == null ? level.getMinY() : blockPos.getY()); y--) { | ||
BlockPos blockPos1 = new BlockPos(pos.getX() + i, y, pos.getZ() + i1); | ||
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor((Level) level, blockPos1)) continue; // Luminol - Do not search the block out of current region as we might be at the edge of the tickregion | ||
BlockState blockState = level.getBlockState(blockPos1); | ||
if (blockState.isCollisionShapeFullBlock(level, blockPos1) && (allowBedrock || !blockState.is(Blocks.BEDROCK))) { | ||
blockPos = blockPos1; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions
29
...inecraft-patches/features/0038-Leaf-Remove-useless-creating-stats-json-bases-on-pla.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: MrHua269 <[email protected]> | ||
Date: Sat, 8 Mar 2025 21:14:53 +0800 | ||
Subject: [PATCH] Leaf Remove useless creating stats json bases on player name | ||
logic | ||
|
||
|
||
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java | ||
index 548f7a2b0b020ff7fff27396942cc0bc9e755afe..9bf6e8240bf15f08b037b18cfeae15ebb8ea934d 100644 | ||
--- a/net/minecraft/server/players/PlayerList.java | ||
+++ b/net/minecraft/server/players/PlayerList.java | ||
@@ -1411,6 +1411,8 @@ public abstract class PlayerList { | ||
if (serverStatsCounter == null) { | ||
File file = this.server.getWorldPath(LevelResource.PLAYER_STATS_DIR).toFile(); | ||
File file1 = new File(file, uuid + ".json"); | ||
+ // Leaf start - Remove useless creating stats json bases on player name logic | ||
+ /* | ||
if (!file1.exists()) { | ||
File file2 = new File(file, displayName + ".json"); // CraftBukkit | ||
Path path = file2.toPath(); | ||
@@ -1418,6 +1420,8 @@ public abstract class PlayerList { | ||
file2.renameTo(file1); | ||
} | ||
} | ||
+ */ | ||
+ // Leaf end - Remove useless creating stats json bases on player name logic | ||
|
||
serverStatsCounter = new ServerStatsCounter(this.server, file1); | ||
// this.stats.put(uuid, serverStatsCounter); // CraftBukkit |
31 changes: 31 additions & 0 deletions
31
...r/minecraft-patches/features/0039-Leaf-Replace-brain-maps-with-optimized-collection.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: MrHua269 <[email protected]> | ||
Date: Sat, 8 Mar 2025 21:20:11 +0800 | ||
Subject: [PATCH] Leaf Replace brain maps with optimized collection | ||
|
||
|
||
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java | ||
index d61fba01feecce3610cd390f490d3097c5db19c4..67b71145e4feb4835a79a6007b04511a2c3b938a 100644 | ||
--- a/net/minecraft/world/entity/ai/Brain.java | ||
+++ b/net/minecraft/world/entity/ai/Brain.java | ||
@@ -45,14 +45,14 @@ public class Brain<E extends LivingEntity> { | ||
static final Logger LOGGER = LogUtils.getLogger(); | ||
private final Supplier<Codec<Brain<E>>> codec; | ||
private static final int SCHEDULE_UPDATE_DELAY = 20; | ||
- private final Map<MemoryModuleType<?>, Optional<? extends ExpirableValue<?>>> memories = Maps.newHashMap(); | ||
- private final Map<SensorType<? extends Sensor<? super E>>, Sensor<? super E>> sensors = Maps.newLinkedHashMap(); | ||
+ private final Map<MemoryModuleType<?>, Optional<? extends ExpirableValue<?>>> memories = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Leaf - Replace brain maps with optimized collection | ||
+ private final Map<SensorType<? extends Sensor<? super E>>, Sensor<? super E>> sensors = new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>(); // Leaf - Replace brain maps with optimized collection | ||
private final Map<Integer, Map<Activity, Set<BehaviorControl<? super E>>>> availableBehaviorsByPriority = Maps.newTreeMap(); | ||
private Schedule schedule = Schedule.EMPTY; | ||
- private final Map<Activity, Set<Pair<MemoryModuleType<?>, MemoryStatus>>> activityRequirements = Maps.newHashMap(); | ||
- private final Map<Activity, Set<MemoryModuleType<?>>> activityMemoriesToEraseWhenStopped = Maps.newHashMap(); | ||
- private Set<Activity> coreActivities = Sets.newHashSet(); | ||
- private final Set<Activity> activeActivities = Sets.newHashSet(); | ||
+ private final Map<Activity, Set<Pair<MemoryModuleType<?>, MemoryStatus>>> activityRequirements = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Leaf - Replace brain maps with optimized collection | ||
+ private final Map<Activity, Set<MemoryModuleType<?>>> activityMemoriesToEraseWhenStopped = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // Leaf - Replace brain maps with optimized collection | ||
+ private Set<Activity> coreActivities = new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(); // Leaf - Replace brain maps with optimized collection | ||
+ private final Set<Activity> activeActivities = new it.unimi.dsi.fastutil.objects.ObjectOpenHashSet<>(); // Leaf - Replace brain maps with optimized collection | ||
private Activity defaultActivity = Activity.IDLE; | ||
private long lastScheduleUpdate = -9999L; | ||
|
24 changes: 24 additions & 0 deletions
24
...inecraft-patches/features/0040-Leaf-Paper-PR-Prevent-zombie-reinforcements-loading-.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: MrHua269 <[email protected]> | ||
Date: Sat, 8 Mar 2025 21:21:11 +0800 | ||
Subject: [PATCH] Leaf Paper PR: Prevent zombie reinforcements loading chunks | ||
|
||
|
||
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java | ||
index cf231380febd6d316eb902d43c636135ee0d7fa4..731473610e068a613d67efaee08ded810fe86cf0 100644 | ||
--- a/net/minecraft/world/entity/monster/Zombie.java | ||
+++ b/net/minecraft/world/entity/monster/Zombie.java | ||
@@ -348,6 +348,13 @@ public class Zombie extends Monster { | ||
int i2 = floor1 + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); | ||
int i3 = floor2 + Mth.nextInt(this.random, 7, 40) * Mth.nextInt(this.random, -1, 1); | ||
BlockPos blockPos = new BlockPos(i1, i2, i3); | ||
+ | ||
+ // Paper start - Prevent reinforcement checks from loading chunks | ||
+ if (this.level().getChunkIfLoadedImmediately(blockPos.getX() >> 4, blockPos.getZ() >> 4) == null) { | ||
+ continue; | ||
+ } | ||
+ // Paper end - Prevent reinforcement checks from loading chunks | ||
+ | ||
if (SpawnPlacements.isSpawnPositionOk(type, level, blockPos) | ||
&& SpawnPlacements.checkSpawnRules(type, level, EntitySpawnReason.REINFORCEMENT, blockPos, level.random)) { | ||
zombie.setPos(i1, i2, i3); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.