From b01fc3ffa80edc67c020e025f09f511569395a6a Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Wed, 2 Feb 2011 00:01:33 +0100 Subject: [PATCH] Add Chunk.getBlock(x,y,z), World.loadChunk(x,z) World.isChunkLoaded(x,z). By: Erik Broes --- paper-api/src/main/java/org/bukkit/Chunk.java | 12 ++++++++++++ paper-api/src/main/java/org/bukkit/World.java | 19 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/paper-api/src/main/java/org/bukkit/Chunk.java b/paper-api/src/main/java/org/bukkit/Chunk.java index 3f158f5b72..539ecb843c 100644 --- a/paper-api/src/main/java/org/bukkit/Chunk.java +++ b/paper-api/src/main/java/org/bukkit/Chunk.java @@ -1,6 +1,8 @@ package org.bukkit; +import org.bukkit.block.Block; + /** * Represents a chunk of blocks */ @@ -26,4 +28,14 @@ public interface Chunk { * @return Parent World */ World getWorld(); + + /** + * Gets a block from this chunk + * + * @param x 0-15 + * @param y 0-127 + * @param z 0-15 + * @return the Block + */ + Block getBlock(int x, int y, int z); } diff --git a/paper-api/src/main/java/org/bukkit/World.java b/paper-api/src/main/java/org/bukkit/World.java index 93b1a7196a..f3f66443cb 100644 --- a/paper-api/src/main/java/org/bukkit/World.java +++ b/paper-api/src/main/java/org/bukkit/World.java @@ -80,7 +80,24 @@ public interface World { * */ public void loadChunk(Chunk chunk); - + + /** + * Checks if the chunk at the specified coordinates is loaded + * + * @param x X-coordinate of the chunk + * @param z Z-coordinate of the chunk + * @return true if the chunk is loaded, otherwise false + */ + public boolean isChunkLoaded(int x, int z); + + /** + * Loads the chunk at the specified coordinates + * @param x X-coordinate of the chunk + * @param z Z-coordinate of the chunk + * + */ + public void loadChunk(int x, int z); + /** * Drop an item exactly at the specified location. *