mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add on_replaced block event and on_block_replaced world event
This commit is contained in:
parent
b40c8c4b4c
commit
f2e7a54180
7 changed files with 54 additions and 0 deletions
|
|
@ -75,6 +75,13 @@ void BlocksController::breakBlock(
|
|||
void BlocksController::placeBlock(
|
||||
Player* player, const Block& def, blockstate state, int x, int y, int z
|
||||
) {
|
||||
auto voxel = chunks.get(x, y, z);
|
||||
if (voxel == nullptr) {
|
||||
return;
|
||||
}
|
||||
const auto& prevDef = level.content->getIndices()->blocks.require(voxel->id);
|
||||
scripting::on_block_replaced(player, prevDef, {x, y, z});
|
||||
|
||||
onBlockInteraction(
|
||||
player, glm::ivec3(x, y, z), def, BlockInteraction::placing
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue