Some block drops

This commit is contained in:
2026-03-15 13:52:45 -03:00
parent 42f5536580
commit 3ba45e4a2e
12 changed files with 63 additions and 24 deletions
+19 -15
View File
@@ -100,21 +100,25 @@ export class PlayerControlsSystem extends System {
if (InputManager.is_mouse_pressed(0)) {
world.dimension.break_block(block.x, block.y, block.z);
} else if (InputManager.is_mouse_pressed(2)) {
const FACE_OFFSETS = {
top: { x: 0, y: 1, z: 0 },
bottom: { x: 0, y: -1, z: 0 },
north: { x: 0, y: 0, z: -1 },
south: { x: 0, y: 0, z: 1 },
west: { x: -1, y: 0, z: 0 },
east: { x: 1, y: 0, z: 0 },
};
const offset = FACE_OFFSETS[block.face];
world.dimension.add_block({
x: block.x + offset.x,
y: block.y + offset.y,
z: block.z + offset.z,
id: "bworld:dirt",
});
const inventory = player_component.player_inventory;
const hotbar_slot = inventory.container.get_slot(inventory.hotbar_selected);
if (hotbar_slot.has_item()) {
const FACE_OFFSETS = {
top: { x: 0, y: 1, z: 0 },
bottom: { x: 0, y: -1, z: 0 },
north: { x: 0, y: 0, z: -1 },
south: { x: 0, y: 0, z: 1 },
west: { x: -1, y: 0, z: 0 },
east: { x: 1, y: 0, z: 0 },
};
const offset = FACE_OFFSETS[block.face];
world.dimension.add_block({
x: block.x + offset.x,
y: block.y + offset.y,
z: block.z + offset.z,
id: "bworld:dirt",
});
}
}
}