Class CustomBlock.Advanced
java.lang.Object
dev.lone.itemsadder.api.CustomBlock.Advanced
- Enclosing class:
CustomBlock
Advanced helpers for editing ItemsAdder custom block region data directly.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidDeletes all custom block data stored for a chunk.static voiddeleteAllCustomBlocksInChunk(Chunk chunk, boolean removeVanillaBlock, boolean sendChunkPacket) Deletes all custom block data stored for a chunk.getAllBlocksLocations(Chunk chunk) Gets all custom block locations and namespaced ids stored in a chunk.getAllBlocksLocationsList(Chunk chunk) Gets all custom block locations stored in a chunk.static @Nullable StringgetInCustomRegion(Location location) Gets the custom block namespaced id stored in region data at a location.static voidplaceInCustomRegion(@NotNull CustomBlock customBlock, Location location) Stores a custom block in region data without placing the vanilla block state.static booleanplaceInCustomRegion(String namespacedId, Location location) Stores a custom block in region data without placing the vanilla block state.static booleanremoveFromCustomRegion(Location location) Removes custom block region data at a location.static voidrunActionOnBlocks(Chunk chunk, BiConsumer<String, Location> action) Runs an action for each custom block stored in a chunk.
-
Constructor Details
-
Advanced
public Advanced()
-
-
Method Details
-
getInCustomRegion
-
placeInCustomRegion
public static void placeInCustomRegion(@NotNull @NotNull CustomBlock customBlock, Location location) Stores a custom block in region data without placing the vanilla block state.- Parameters:
customBlock- the custom block to store.location- the location to write.
-
placeInCustomRegion
Stores a custom block in region data without placing the vanilla block state.- Parameters:
namespacedId- the custom block namespaced id.location- the location to write.- Returns:
- true if the custom block exists and was stored.
-
removeFromCustomRegion
Removes custom block region data at a location.- Parameters:
location- the location to clear.- Returns:
- true if custom block data existed and was removed.
-
deleteAllCustomBlocksInChunk
Deletes all custom block data stored for a chunk.- Parameters:
chunk- the chunk to clear.
-
deleteAllCustomBlocksInChunk
public static void deleteAllCustomBlocksInChunk(Chunk chunk, boolean removeVanillaBlock, boolean sendChunkPacket) Deletes all custom block data stored for a chunk.- Parameters:
chunk- the chunk to clear.removeVanillaBlock- true to also remove the vanilla blocks.sendChunkPacket- true to refresh the chunk for players after removal.
-
getAllBlocksLocationsList
-
getAllBlocksLocations
-
runActionOnBlocks
Runs an action for each custom block stored in a chunk.- Parameters:
chunk- the chunk to read.action- receives the namespaced id and location of each stored custom block.
-