Skip to content

Commit

Permalink
rename 'blockworld' to 'minecraft'
Browse files Browse the repository at this point in the history
  • Loading branch information
BreakingLead committed Aug 31, 2024
1 parent 601d396 commit 567207e
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 13 deletions.
83 changes: 83 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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}"
}
]
}
4 changes: 2 additions & 2 deletions blockworld-client/renderer/atlas_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions blockworld-client/renderer/bytes_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ pub struct StaticBytesProvider;

impl BytesProvider for StaticBytesProvider {
fn get_bytes(&self, id: &ResourceLocation) -> Result<Vec<u8>, 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);
}
Expand Down
2 changes: 1 addition & 1 deletion blockworld-client/renderer/chunk/render_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions blockworld-client/renderer/world_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions blockworld-client/world/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}
}

Expand All @@ -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;
}
}
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion blockworld-client/world/chunk_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 567207e

Please sign in to comment.