mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
feat(gameplay): add block change sync and coordinate utils
This commit is contained in:
@@ -37,7 +37,15 @@ public:
|
||||
|
||||
static int index(int x, int y, int z);
|
||||
static int index(const glm::vec3& pos);
|
||||
|
||||
static std::tuple<int, int, int> world_to_block(int world_x, int world_y,
|
||||
int world_z, int chunk_x,
|
||||
int chunk_z);
|
||||
static std::tuple<int, int, int> world_to_block(const glm::ivec3& block_pos,
|
||||
ChunkPos chunk_pos);
|
||||
static std::tuple<int, int, int> block_to_world(int x, int y, int z,
|
||||
int chunk_x, int chunk_z);
|
||||
static std::tuple<int, int, int> block_to_world(const glm::ivec3& block_pos,
|
||||
ChunkPos chunk_pos);
|
||||
BiomeType get_biome() const;
|
||||
ChunkPos get_chunk_pos() const;
|
||||
const std::vector<BlockType>& get_chunk_blocks() const;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "Cubed/AABB.hpp"
|
||||
#include "Cubed/gameplay/block.hpp"
|
||||
#include "Cubed/gameplay/chunk_pos.hpp"
|
||||
#include "Cubed/gameplay/client_chunk.hpp"
|
||||
@@ -18,7 +17,6 @@ public:
|
||||
~ClientWorld();
|
||||
void init();
|
||||
void update(float delta_time);
|
||||
bool can_move(const AABB& player_box) const;
|
||||
const std::optional<LookBlock>&
|
||||
get_look_block_pos(const std::string& name) const;
|
||||
ClientPlayer& get_player();
|
||||
@@ -26,13 +24,14 @@ public:
|
||||
bool is_solid(const glm::ivec3& block_pos) const;
|
||||
bool can_pass_block(const glm::ivec3& block_pos) const;
|
||||
BlockType get_block_tpye(const glm::ivec3& block_pos) const;
|
||||
void set_block(const glm::ivec3& pos, unsigned id);
|
||||
|
||||
void push_delete_vbo(GLuint vbo);
|
||||
void push_delete_vao(GLuint vao);
|
||||
void hot_reload();
|
||||
|
||||
void rebuild_world();
|
||||
// void hot_reload();
|
||||
|
||||
// void rebuild_world();
|
||||
void report_block_change(const glm::ivec3& pos, unsigned id) const;
|
||||
void receive_block_change(const BlockChangeRsp& rsp);
|
||||
int rendering_distance() const;
|
||||
void rendering_distance(int rendering_distance);
|
||||
void start_client_thread(std::string_view uuid);
|
||||
@@ -78,5 +77,6 @@ private:
|
||||
void report_player_pos();
|
||||
|
||||
void request_chunk();
|
||||
void set_block(const glm::ivec3& pos, unsigned id);
|
||||
};
|
||||
} // namespace Cubed
|
||||
|
||||
Reference in New Issue
Block a user