X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fui%2Fui.cpp;h=02f372e5c66c57d7a827362814dc61c97aa66bc1;hb=ee77b8cf96525f0db007b170b6e96f055cba4d33;hp=39942987f6375a243fd0412572cffbc8201bf3fe;hpb=68f47f2824989b21ff9a480a367a6d0a41804f41;p=blank.git diff --git a/src/ui/ui.cpp b/src/ui/ui.cpp index 3994298..02f372e 100644 --- a/src/ui/ui.cpp +++ b/src/ui/ui.cpp @@ -396,9 +396,9 @@ void Interface::PickBlock() { void Interface::PlaceBlock() { if (!aim_world) return; - glm::vec3 next_pos = aim_world.BlockCoords() + aim_world.normal; - BlockLookup next_block(&aim_world.GetChunk(), next_pos); - if (next_block) { + BlockLookup next_block(aim_world.chunk, aim_world.BlockPos(), Block::NormalFace(aim_world.normal)); + if (!next_block) { + return; } next_block.SetBlock(selection); @@ -406,7 +406,7 @@ void Interface::PlaceBlock() { const Entity &player = ctrl.Controlled(); env.audio.Play( place_sound, - aim_world.GetChunk().ToSceneCoords(player.ChunkCoords(), next_pos) + next_block.GetChunk().ToSceneCoords(player.ChunkCoords(), next_block.GetBlockCoords()) ); }