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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionA map of block locations and their corresponding block data.private final Map<UUID, EntityData> A map of entity UUIDs and their corresponding entity data.private static final longprivate final org.bukkit.WorldThe world in which the grave is located.private final intThe x-coordinate of the grave's location.private final intThe z-coordinate of the grave's location. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBlockData(BlockData blockData) Adds block data to the chunk.voidaddEntityData(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.LocationGets the location of the chunk.org.bukkit.WorldgetWorld()Gets the world of the chunk.intgetX()Gets the x-coordinate of the chunk.intgetZ()Gets the z-coordinate of the chunk.booleanhasData()Checks if the chunk has any block or entity data.booleanisLoaded()Checks if the chunk is currently loaded.voidremoveBlockData(org.bukkit.Location location) Removes block data from the chunk based on the location.voidremoveEntityData(EntityData entityData) Removes entity data from the chunk based on the entity's UUID.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
world
private final org.bukkit.World worldThe world in which the grave is located.This
Worldobject represents the Minecraft world where the grave is situated. -
x
private final int xThe x-coordinate of the grave's location.This integer represents the horizontal position of the grave in the Minecraft world.
-
z
private final int zThe z-coordinate of the grave's location.This integer represents the horizontal position of the grave in the Minecraft world.
-
blockDataMap
-
entityDataMap
A map of entity UUIDs and their corresponding entity data.This
MapcontainsUUIDkeys representing unique identifiers for entities andEntityDatavalues representing the data associated with those entities.
-
-
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
Worldby 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.
-