3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 04:20:04 +01:00
Paper/patches/server/0359-Maps-shouldn-t-load-chunks.patch

32 Zeilen
2.0 KiB
Diff

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
2024-10-23 16:08:40 +02:00
index 2715c89fb9ea098d8c77b124be1be634835ecb93..af78d15aead7a2dc8304c541e37e306215b761be 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
2024-10-23 16:08:40 +02:00
@@ -97,8 +97,8 @@ public class MapItem extends Item {
2024-04-24 08:44:48 +02:00
int r = (j / i + o - 64) * i;
int s = (k / i + p - 64) * i;
2023-06-08 00:58:10 +02:00
Multiset<MapColor> multiset = LinkedHashMultiset.create();
2024-04-24 08:44:48 +02:00
- 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()) {