PaperMC/patches/server/0379-Maps-shouldn-t-load-chunks.patch

33 lines
1.9 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
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 5fadfa65b7db07648d88e53893e091024d120bed..e46ceae916f6396d96226db6d8e90bd29088f765 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/item/MapItem.java
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
@@ -126,9 +126,9 @@ public class MapItem extends ComplexItem {
2022-12-07 21:16:54 +01:00
int j2 = (j / i + k1 - 64) * i;
int k2 = (k / i + l1 - 64) * i;
2023-06-08 00:58:10 +02:00
Multiset<MapColor> multiset = LinkedHashMultiset.create();
2022-12-07 21:16:54 +01:00
- LevelChunk chunk = world.getChunk(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2));
+ LevelChunk chunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2)); // Paper - Maps shouldn't load chunks
2021-06-11 14:02:28 +02:00
- if (!chunk.isEmpty()) {
+ if (chunk != null && !chunk.isEmpty()) { // Paper - Maps shouldn't load chunks
2022-12-07 21:16:54 +01:00
int l2 = 0;
double d1 = 0.0D;
int i3;