PaperMC/Spigot-API-Patches/0145-Add-Force-Loaded-Chunk-API.patch
Aikar 2365b308c8
Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.

This update has been tested to ensure that World Conversion still occurs correctly.

Bukkit Changes:
0812ce2c SPIGOT-4397: isChunkGenerated API

CraftBukkit Changes:
4824655c SPIGOT-4398: Upgrade to ASM 6.2.1 for better Java 11 support
eea43870 MC-134115: Fix issues converting tile entities
1a7f2d10 SPIGOT-4397: isChunkGenerated API
40aed54d SPIGOT-4396: Improve vehicle movement

Spigot Changes:
f6a273b1 Rebuild patches
2018-09-26 22:35:46 -04:00

55 lines
1.8 KiB
Diff

From f63d962bbe2d56e72384b92df8819041d1e57d54 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Wed, 29 Aug 2018 00:37:30 -0400
Subject: [PATCH] Add Force-Loaded Chunk API
diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java
index 8a8043351..4b9e0ca46 100644
--- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java
@@ -168,4 +168,20 @@ public interface Chunk {
* @return true if slimes are able to spawn in this chunk
*/
boolean isSlimeChunk();
+
+ // Paper start - Force-Loaded Chunk API
+ /**
+ * Checks if the chunk is currently force-loaded
+ *
+ * @return true if the chunk is force-loaded, otherwise false
+ */
+ boolean isForceLoaded();
+
+ /**
+ * Set's whether a chunk is force-loaded or not
+ *
+ * @param force whether or not to force load this chunk
+ */
+ void setForceLoaded(boolean force);
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index d367e890f..7bfe0b684 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -193,6 +193,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
return isChunkGenerated((int) chunkKey, (int) (chunkKey >> 32));
}
+ /**
+ * Checks if a chunk is force-loaded.
+ * Note: This will only return true if the chunk is also generated
+ *
+ * @param x X-coordinate of the chunk
+ * @param z Z-coordinate of the chunk
+ * @return true if the chunk is force-loaded. otherwise false
+ */
+ public boolean isChunkForceLoaded(int x, int z);
+
/**
* This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided,
* as well as future support
--
2.19.0