1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-03-22 23:15:36 +01:00

Add buffer to CraftWorld#warnUnsafeChunk

This allows plugins to access chunks slightly outside of the
max world border (such as ones which may be loaded naturally
by players) without tripping any logs.
This commit is contained in:
Spottedleaf 2025-01-28 17:43:30 -08:00
parent e2f0efd1af
commit 54b2e9d973

View file

@ -356,7 +356,8 @@ public class CraftWorld extends CraftRegionAccessor implements World {
// Paper start
private static void warnUnsafeChunk(String reason, int x, int z) {
// if any chunk coord is outside of 30 million blocks
if (x > 1875000 || z > 1875000 || x < -1875000 || z < -1875000) {
int max = (30_000_000 / 16) + 625;
if (x > max || z > max || x < -max || z < -max) {
Plugin plugin = io.papermc.paper.util.StackWalkerUtil.getFirstPluginCaller();
if (plugin != null) {
plugin.getLogger().warning("Plugin is %s at (%s, %s), this might cause issues.".formatted(reason, x, z));