From 567207e6077488bc5f6e5d0000a3ddd342e69441 Mon Sep 17 00:00:00 2001 From: BreakingLead Date: Sat, 31 Aug 2024 16:54:10 +0800 Subject: [PATCH] rename 'blockworld' to 'minecraft' --- .vscode/launch.json | 83 +++++++++++++++++++ blockworld-client/renderer/atlas_image.rs | 4 +- blockworld-client/renderer/bytes_provider.rs | 4 +- .../renderer/chunk/render_chunk.rs | 2 +- blockworld-client/renderer/world_renderer.rs | 4 +- blockworld-client/world/chunk.rs | 10 +-- blockworld-client/world/chunk_array.rs | 2 +- 7 files changed, 96 insertions(+), 13 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..4eaf3fa --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,83 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug executable 'blockworld-client'", + "cargo": { + "args": [ + "build", + "--bin=blockworld-client", + "--package=blockworld-client" + ], + "filter": { + "name": "blockworld-client", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}/blockworld-client" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in executable 'blockworld-client'", + "cargo": { + "args": [ + "test", + "--no-run", + "--bin=blockworld-client", + "--package=blockworld-client" + ], + "filter": { + "name": "blockworld-client", + "kind": "bin" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'blockworld_utils'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=blockworld-utils" + ], + "filter": { + "name": "blockworld_utils", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}/blockworld-client" + }, + { + "type": "lldb", + "request": "launch", + "name": "Debug unit tests in library 'blockworld_server'", + "cargo": { + "args": [ + "test", + "--no-run", + "--lib", + "--package=blockworld-server" + ], + "filter": { + "name": "blockworld_server", + "kind": "lib" + } + }, + "args": [], + "cwd": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/blockworld-client/renderer/atlas_image.rs b/blockworld-client/renderer/atlas_image.rs index 778c970..eb0db24 100644 --- a/blockworld-client/renderer/atlas_image.rs +++ b/blockworld-client/renderer/atlas_image.rs @@ -13,8 +13,8 @@ use wgpu::hal::auxil::db; /// This is a wrapper around an image::RgbaImage that contains the contents of a sprite. It also will handle its mipmaps. pub struct Atlas { - /// - "blockworld:atlas/block" - /// - "blockworld:atlas/item" + /// - "minecraft:atlas/block" + /// - "minecraft:atlas/item" /// - "ic2:atlas/item" /// - etc. // self_name: ResourceLocation, diff --git a/blockworld-client/renderer/bytes_provider.rs b/blockworld-client/renderer/bytes_provider.rs index 9cfd7e5..eac700f 100644 --- a/blockworld-client/renderer/bytes_provider.rs +++ b/blockworld-client/renderer/bytes_provider.rs @@ -22,11 +22,11 @@ pub struct StaticBytesProvider; impl BytesProvider for StaticBytesProvider { fn get_bytes(&self, id: &ResourceLocation) -> Result, ResourceError> { - if id == &"blockworld:assets/shaders/wireframe_shader.wgsl".into() { + if id == &"minecraft:assets/shaders/wireframe_shader.wgsl".into() { let r = include_bytes!("shaders/wireframe_shader.wgsl").to_vec(); return Ok(r); } - if id == &"blockworld:assets/shaders/default_shader.wgsl".into() { + if id == &"minecraft:assets/shaders/default_shader.wgsl".into() { let r = include_bytes!("shaders/default_shader.wgsl").to_vec(); return Ok(r); } diff --git a/blockworld-client/renderer/chunk/render_chunk.rs b/blockworld-client/renderer/chunk/render_chunk.rs index 1fae5b6..1c82f27 100644 --- a/blockworld-client/renderer/chunk/render_chunk.rs +++ b/blockworld-client/renderer/chunk/render_chunk.rs @@ -33,7 +33,7 @@ impl RenderChunk { ); let block_id = chunk.get_block_id(x, y, z); - if block_id != "blockworld:air" { + if block_id != "minecraft:air" { let block = BLOCK_REGISTRY.get(&block_id.as_str().into()); if let Some(block) = block { let cull_mask = chunk.exist_neighbor(x, y, z); diff --git a/blockworld-client/renderer/world_renderer.rs b/blockworld-client/renderer/world_renderer.rs index 5b92dcc..469284a 100644 --- a/blockworld-client/renderer/world_renderer.rs +++ b/blockworld-client/renderer/world_renderer.rs @@ -63,7 +63,7 @@ impl WorldRenderer { let depth_texture = TextureWithView::new_depth(&device, &config); let shader = WgslShader::new( - &"blockworld:assets/shaders/default_shader.wgsl".into(), + &"minecraft:assets/shaders/default_shader.wgsl".into(), &StaticBytesProvider, device, "fs", @@ -72,7 +72,7 @@ impl WorldRenderer { .expect("Failed to load shader"); let wireframe_shader = WgslShader::new( - &"blockworld:assets/shaders/wireframe_shader.wgsl".into(), + &"minecraft:assets/shaders/wireframe_shader.wgsl".into(), &StaticBytesProvider, device, "fs", diff --git a/blockworld-client/world/chunk.rs b/blockworld-client/world/chunk.rs index de3fccc..668c9c3 100644 --- a/blockworld-client/world/chunk.rs +++ b/blockworld-client/world/chunk.rs @@ -27,7 +27,7 @@ impl SubChunk { pub fn new() -> Self { Self { block_ref_count: 0, - block_array: core::array::from_fn(|_| "blockworld:air".to_string()), + block_array: core::array::from_fn(|_| "minecraft:air".to_string()), } } @@ -44,14 +44,14 @@ impl SubChunk { pub fn set_blockid(&mut self, x: i32, y: i32, z: i32, block_id: &str) { self.block_array[Self::index(x, y, z)] = block_id.to_string(); - if block_id != "blockworld:air" { + if block_id != "minecraft:air" { self.block_ref_count += 1; } } pub fn remove_block(&mut self, x: i32, y: i32, z: i32) { - if self.block_array[Self::index(x, y, z)] != "blockworld:air" { - self.block_array[Self::index(x, y, z)] = "blockworld:air".to_string(); + if self.block_array[Self::index(x, y, z)] != "minecraft:air" { + self.block_array[Self::index(x, y, z)] = "minecraft:air".to_string(); self.block_ref_count -= 1; } } @@ -86,7 +86,7 @@ impl Chunk { } pub fn is_air(&self, x: i32, y: i32, z: i32) -> bool { - self.get_block_id(x, y, z) == "blockworld:air" + self.get_block_id(x, y, z) == "minecraft:air" } /// Get the block at (x,y,z) with respect to the chunk-relative coord. diff --git a/blockworld-client/world/chunk_array.rs b/blockworld-client/world/chunk_array.rs index def8e95..ba6622e 100644 --- a/blockworld-client/world/chunk_array.rs +++ b/blockworld-client/world/chunk_array.rs @@ -34,7 +34,7 @@ impl ChunkArray { let mut c = Chunk::new(x, z); for x_c in 0..16 { for z_c in 0..16 { - c.set_block_id(x_c, 1, z_c, "blockworld:stone".into()); + c.set_block_id(x_c, 1, z_c, "minecraft:stone".into()); } } c.is_chunk_loaded = true;