3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/Spigot-API-Patches/0145-Add-Force-Loaded-Chunk-API.patch

56 Zeilen
1.8 KiB
Diff

2018-10-27 06:02:22 +02:00
From 14a1db13c30927e0e9b1b1b9540aab8f749b1df7 Mon Sep 17 00:00:00 2001
2018-09-03 16:05:55 +02:00
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
2018-10-27 06:02:22 +02:00
index 8a804335..4b9e0ca4 100644
2018-09-03 16:05:55 +02:00
--- a/src/main/java/org/bukkit/Chunk.java
+++ b/src/main/java/org/bukkit/Chunk.java
@@ -168,4 +168,20 @@ public interface Chunk {
2018-09-03 16:05:55 +02:00
* @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
2018-10-27 06:02:22 +02:00
index de89122e..aa28c452 100644
2018-09-03 16:05:55 +02:00
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
2018-10-27 06:02:22 +02:00
@@ -195,6 +195,16 @@ public interface World extends PluginMessageRecipient, Metadatable {
return isChunkGenerated((int) chunkKey, (int) (chunkKey >> 32));
}
2018-09-03 16:05:55 +02:00
+ /**
+ * 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);
+
2018-09-03 16:05:55 +02:00
/**
* This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided,
* as well as future support
2018-09-03 16:05:55 +02:00
--
2018-10-27 06:02:22 +02:00
2.19.1
2018-09-03 16:05:55 +02:00