aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0369-Maps-shouldn-t-load-chunks.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-05-29 13:58:57 -0700
committerGitHub <[email protected]>2024-05-29 22:58:57 +0200
commita31dc90741ed9c121a13a3c124c9ebf5bafd0da7 (patch)
tree81963bd94fe7772ee08bd21710230de21b6b25da /patches/server/0369-Maps-shouldn-t-load-chunks.patch
parented85aac53cfd93d29fa24e6071dbdddd0e49624b (diff)
downloadPaper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.tar.gz
Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.zip
Several fixes and new api for experience merging/stacking (#9242)
Diffstat (limited to 'patches/server/0369-Maps-shouldn-t-load-chunks.patch')
-rw-r--r--patches/server/0369-Maps-shouldn-t-load-chunks.patch31
1 files changed, 31 insertions, 0 deletions
diff --git a/patches/server/0369-Maps-shouldn-t-load-chunks.patch b/patches/server/0369-Maps-shouldn-t-load-chunks.patch
new file mode 100644
index 0000000000..3bc3299f81
--- /dev/null
+++ b/patches/server/0369-Maps-shouldn-t-load-chunks.patch
@@ -0,0 +1,31 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Phoenix616 <[email protected]>
+Date: Sun, 7 Jun 2020 21:43:42 +0100
+Subject: [PATCH] Maps shouldn't load chunks
+
+Previously maps would load all chunks in a certain radius depending on
+ their scale when trying to update their content. This would result in
+ main thread chunk loads when they weren't really necessary, especially
+ on low view distances or "slow" async chunk loads after teleports or
+ other prioritisation.
+
+ This changes it to only try to render already loaded chunks based on
+ the assumption that the chunks around the player will get loaded
+ eventually anyways and that maps will get checked for update every
+ five ticks that movement occur in anyways.
+
+diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
+index 4e6d42051de14a1a62184fbb586ea38fb31261b3..36de7c63370c529579d31ba1d77ec12b754ef313 100644
+--- a/src/main/java/net/minecraft/world/item/MapItem.java
++++ b/src/main/java/net/minecraft/world/item/MapItem.java
+@@ -98,8 +98,8 @@ public class MapItem extends ComplexItem {
+ int r = (j / i + o - 64) * i;
+ int s = (k / i + p - 64) * i;
+ Multiset<MapColor> multiset = LinkedHashMultiset.create();
+- LevelChunk levelChunk = world.getChunk(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s));
+- if (!levelChunk.isEmpty()) {
++ LevelChunk levelChunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s)); // Paper - Maps shouldn't load chunks
++ if (levelChunk != null && !levelChunk.isEmpty()) { // Paper - Maps shouldn't load chunks
+ int t = 0;
+ double e = 0.0;
+ if (world.dimensionType().hasCeiling()) {