Package com.ranull.graves.data
Class ChunkData
java.lang.Object
com.ranull.graves.data.ChunkData
- All Implemented Interfaces:
Serializable
Represents data for a specific chunk in the game world, including block and entity data.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addBlockData
(BlockData blockData) Adds block data to the chunk.void
addEntityData
(EntityData entityData) Adds entity data to the chunk.Gets the map of block data within the chunk.Gets the map of entity data within the chunk.org.bukkit.Location
Gets the location of the chunk.org.bukkit.World
getWorld()
Gets the world of the chunk.int
getX()
Gets the x-coordinate of the chunk.int
getZ()
Gets the z-coordinate of the chunk.boolean
hasData()
Checks if the chunk has any block or entity data.boolean
isLoaded()
Checks if the chunk is currently loaded.void
removeBlockData
(org.bukkit.Location location) Removes block data from the chunk based on the location.void
removeEntityData
(EntityData entityData) Removes entity data from the chunk based on the entity's UUID.
-
Constructor Details
-
ChunkData
public ChunkData(org.bukkit.Location location) Constructs a new ChunkData instance based on a location.- Parameters:
location
- The location within the chunk.
-
ChunkData
Constructs a new ChunkData instance using a world name and chunk coordinates (Folia-safe).This constructor avoids calling methods that might trigger synchronous chunk loads on Folia. It resolves the
World
by name without touching chunk APIs.- Parameters:
worldName
- the name of the world containing the chunkchunkX
- the chunk X coordinatechunkZ
- the chunk Z coordinate
-
-
Method Details
-
getWorld
public org.bukkit.World getWorld()Gets the world of the chunk.- Returns:
- The world of the chunk.
-
getX
public int getX()Gets the x-coordinate of the chunk.- Returns:
- The x-coordinate of the chunk.
-
getZ
public int getZ()Gets the z-coordinate of the chunk.- Returns:
- The z-coordinate of the chunk.
-
hasData
public boolean hasData()Checks if the chunk has any block or entity data.- Returns:
- True if the chunk has data, false otherwise.
-
isLoaded
public boolean isLoaded()Checks if the chunk is currently loaded.- Returns:
- True if the chunk is loaded, false otherwise.
-
getLocation
public org.bukkit.Location getLocation()Gets the location of the chunk.- Returns:
- The location of the chunk.
-
getBlockDataMap
Gets the map of block data within the chunk.- Returns:
- The map of block data.
-
addBlockData
Adds block data to the chunk.- Parameters:
blockData
- The block data to add.
-
removeBlockData
public void removeBlockData(org.bukkit.Location location) Removes block data from the chunk based on the location.- Parameters:
location
- The location of the block data to remove.
-
getEntityDataMap
Gets the map of entity data within the chunk.- Returns:
- The map of entity data.
-
addEntityData
Adds entity data to the chunk.- Parameters:
entityData
- The entity data to add.
-
removeEntityData
Removes entity data from the chunk based on the entity's UUID.- Parameters:
entityData
- The entity data to remove.
-