Some block drops
This commit is contained in:
@@ -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",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user