Skip to content

Commit

Permalink
fix: in block when outside world
Browse files Browse the repository at this point in the history
  • Loading branch information
L3P3 committed Dec 22, 2024
1 parent 1df3ae4 commit f44c9cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minicraft",
"version": "0.11.3",
"version": "0.11.4",
"description": "voxel-based 3d game, written in javascript",
"homepage": "https://l3p3.de/minicraft",
"repository": {
Expand Down
14 changes: 8 additions & 6 deletions src/game/m_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,14 @@ export const renderer_render = (model, now) => {
let dim_next = 0;

player.block_focus_y = -1;
block_inside = world_block_get(
world,
position_x_shifted & world_width_m1,
position_y_shifted & (CHUNK_HEIGHT - 1),
position_z_shifted & world_width_m1
);
block_inside =
(position_y < 0 || position_y >= CHUNK_HEIGHT) ? 0 :
world_block_get(
world,
position_x_shifted & world_width_m1,
position_y_shifted & (CHUNK_HEIGHT - 1),
position_z_shifted & world_width_m1
);

// inside block?
if (
Expand Down

0 comments on commit f44c9cd

Please sign in to comment.