BlockManager
The BlockManager allows you to interact with Nova's blocks. You can place/destroy/get drops/etc.
You can get the BlockManager
using the previously retrieved Nova instance.
Getting a BlockState
The BlockManager also allows you to get a BlockState at a specific location.
You can also check if a block at a specific location is a Nova block via BlockManager.hasBlock(Location)
See BlockState for more information.
Placing a block
You can also place a nova block at a specific location by using a NovaMaterial
.
Warning
This function will throw an IllegalArgumentException
if the provided NovaMaterial
is not a block.
val material = materialRegistry.get("machines:pulverizer")
blockManager.placeBlock(
location, // (1)!
material, // (2)!
player, // (3)!
true // (4)!
)
- The location at which to place the block.
- The material to place.
- The source of the block placement. This doesn't have to be a player, it can also be a tile-entity or similar.
- Whether to play a sound when the block is placed.
NovaMaterial material = materialRegistry.get("machines:pulverizer");
blockManager.placeBlock(
location, // (1)!
material, // (2)!
player, // (3)!
true // (4)!
);
- The location at which to place the block.
- The material to place.
- The source of the block placement. This doesn't have to be a player, it can also be a tile-entity or similar.
- Whether to play a sound when the block is placed.
Note
The BlockManager.placeBlock
function has a few overrides requiring less arguments.
Getting the drops of a block
If you want to get the drops of a block, you can use the BlockManager.getDrops
function. Again, there are a few
overrides requiring less arguments.
Warning
This function will return null
if there is no nova block at the provided location.
- The location of the block.
- The source, again, this doesn't have to be a player, it can also be a tile-entity or similar.
- The tool used to break the block.
Removing a block
You can remove a block at a specific location by using the BlockManager.removeBlock
function. The function will return
a boolean
whether there was a block at the provided location and whether it was removed successfully.
- The location of the block.
- The source, again, this doesn't have to be a player, it can also be a tile-entity or similar.
- Whether to play a sound when the block is removed.
- Whether break particles should be displayed.
- The location of the block.
- The source, again, this doesn't have to be a player, it can also be a tile-entity or similar.
- Whether to play a sound when the block is removed.
- Whether break particles should be displayed.