mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add player.is_infinite_items, .set_infinite_items
This commit is contained in:
parent
f4f479d389
commit
14b596140d
6 changed files with 54 additions and 4 deletions
|
|
@ -461,6 +461,10 @@ void PlayerController::processRightClick(const Block& def, const Block& target)
|
|||
}
|
||||
}
|
||||
if (chosenBlock != vox->id && chosenBlock) {
|
||||
if (!player->isInfiniteItems()) {
|
||||
auto& slot = player->getInventory()->getSlot(player->getChosenSlot());
|
||||
slot.setCount(slot.getCount()-1);
|
||||
}
|
||||
blocksController->placeBlock(
|
||||
player.get(), def, state, coord.x, coord.y, coord.z
|
||||
);
|
||||
|
|
@ -522,8 +526,8 @@ void PlayerController::updateInteraction(float delta) {
|
|||
auto iend = selection.position;
|
||||
if (lclick && !input.shift && item.rt.funcsset.on_block_break_by) {
|
||||
if (scripting::on_item_break_block(
|
||||
player.get(), item, iend.x, iend.y, iend.z
|
||||
)) {
|
||||
player.get(), item, iend.x, iend.y, iend.z
|
||||
)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue