forked from mirror/Folia
4a59238743
Very early build, network configuration switching is supported but not tested (note: changes need to be backported to Paper) Changes: - Supports per player mob caps - Adds entity tracker optimisations which are not in Paper (and will not be ported to Paper due to plugin conflicts) - No longer reverts paper distance map optimisations, as those are replaced by the NearbyPlayers class These changes should bring Folia in-line with Paper's optimisations at least (probably more given the entity tracker optimisations), still missing features like world loading / some commands
28 lines
1.9 KiB
Diff
28 lines
1.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
|
Date: Sat, 13 May 2023 17:13:40 -0700
|
|
Subject: [PATCH] Do not access POI data for lodestone compass
|
|
|
|
Instead, we can just check the loaded chunk's block position for
|
|
the lodestone block, as that is at least safe enough for the light
|
|
engine compared to the POI access. This should make it safe for
|
|
off-region access.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/CompassItem.java b/src/main/java/net/minecraft/world/item/CompassItem.java
|
|
index 7c4a2f8bb3efd11db2f8711952cc26a067c6d56b..2a60db30bc113039c03ff10b45d5a704a4106b48 100644
|
|
--- a/src/main/java/net/minecraft/world/item/CompassItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/CompassItem.java
|
|
@@ -77,7 +77,11 @@ public class CompassItem extends Item implements Vanishable {
|
|
Optional<ResourceKey<Level>> optional = getLodestoneDimension(compoundTag);
|
|
if (optional.isPresent() && optional.get() == world.dimension() && compoundTag.contains("LodestonePos")) {
|
|
BlockPos blockPos = NbtUtils.readBlockPos(compoundTag.getCompound("LodestonePos"));
|
|
- if (!world.isInWorldBounds(blockPos) || (world.hasChunkAt(blockPos) && !((ServerLevel)world).getPoiManager().existsAtPosition(PoiTypes.LODESTONE, blockPos))) { // Paper
|
|
+
|
|
+ // Folia start - do not access the POI data off-region
|
|
+ net.minecraft.world.level.chunk.LevelChunk chunk = world.getChunkIfLoaded(blockPos);
|
|
+ if (!world.isInWorldBounds(blockPos) || chunk != null && chunk.getBlockState(blockPos).getBlock() != Blocks.LODESTONE) { // Paper
|
|
+ // Folia end - do not access the POI data off-region
|
|
compoundTag.remove("LodestonePos");
|
|
}
|
|
}
|