diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 000000000..0da6ecd21 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,27 @@ +# GitHub CODEOWNERS File +# https://docs.github.com/en/repositories/managing-repository-settings-and-features/customizing-your-repository/about-code-owners + +# Default owner for the entire project +* @Snowiiii + +# Protocol related changes +crates/pumpkin-protocol/ @Snowiiii @xRookieFight +crates/pumpkin/src/net/ @Snowiiii @xRookieFight + +# Bedrock related changes +assets/bedrock/ @ZlordHUN @xRookieFight +crates/pumpkin-protocol/src/bedrock/ @ZlordHUN @xRookieFight +crates/pumpkin/src/net/bedrock/ @ZlordHUN @xRookieFight + +# Command related changes +crates/pumpkin/src/command/ @aure31 + +# Plugin related changes & WASM Host +crates/pumpkin-plugin-api/ @vyPal @yunuservices @QuantumSegfault +crates/pumpkin-plugin-wit/ @vyPal @yunuservices @QuantumSegfault +crates/pumpkin-api-macros/ @vyPal @yunuservices @QuantumSegfault +crates/pumpkin/src/plugin/ @vyPal @yunuservices @QuantumSegfault + +# Documentation related changes +*.md @Q2297045667 +docs/ @Q2297045667 diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml index ae77cea2e..17beb8706 100644 --- a/.github/workflows/typos.yml +++ b/.github/workflows/typos.yml @@ -21,4 +21,4 @@ jobs: with: submodules: recursive - name: Spell Check Repo - uses: crate-ci/typos@v1.48.0 + uses: crate-ci/typos@v1.49.0 diff --git a/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/graph.rs b/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/graph.rs index 0eb1abfad..2092d51b4 100644 --- a/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/graph.rs +++ b/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/graph.rs @@ -67,7 +67,9 @@ impl RoomGraph { grid[index as usize] = Some(graph.push(index)); } } - graph.source = grid[SOURCE_INDEX as usize].unwrap(); + if let Some(src) = grid[SOURCE_INDEX as usize] { + graph.source = src; + } for x in 0..5 { for z in 0..5 { @@ -101,27 +103,23 @@ impl RoomGraph { let roof = graph.push(1003); let left_wing = graph.push(1001); let right_wing = graph.push(1002); - graph.connect( - grid[TOP_CONNECT_INDEX as usize].unwrap(), - BlockDirection::Up, - roof, - ); - graph.connect( - grid[LEFT_CONNECT_INDEX as usize].unwrap(), - BlockDirection::South, - left_wing, - ); - graph.connect( - grid[RIGHT_CONNECT_INDEX as usize].unwrap(), - BlockDirection::South, - right_wing, - ); + if let Some(top) = grid[TOP_CONNECT_INDEX as usize] { + graph.connect(top, BlockDirection::Up, roof); + } + if let Some(left) = grid[LEFT_CONNECT_INDEX as usize] { + graph.connect(left, BlockDirection::South, left_wing); + } + if let Some(right) = grid[RIGHT_CONNECT_INDEX as usize] { + graph.connect(right, BlockDirection::South, right_wing); + } graph.rooms[roof].claimed = true; graph.rooms[left_wing].claimed = true; graph.rooms[right_wing].claimed = true; graph.rooms[graph.source].source = true; - graph.core = grid[room_index(random.next_bounded_i32(4), 0, 2) as usize].unwrap(); + if let Some(core_room) = grid[room_index(random.next_bounded_i32(4), 0, 2) as usize] { + graph.core = core_room; + } graph.claim_core(); for room in &mut graph.rooms { // Vanilla updates every grid room and the roof room here. The two wing @@ -147,7 +145,9 @@ impl RoomGraph { if !graph.rooms[room].openings[direction] { continue; } - let neighbor = graph.rooms[room].connections[direction].unwrap(); + let Some(neighbor) = graph.rooms[room].connections[direction] else { + continue; + }; let opposite = opposite_index(direction); graph.rooms[room].openings[direction] = false; graph.rooms[neighbor].openings[opposite] = false; @@ -218,7 +218,7 @@ impl RoomGraph { } pub fn connection(&self, room: usize, direction: BlockDirection) -> usize { - self.rooms[room].connections[direction as usize].unwrap() + self.rooms[room].connections[direction as usize].unwrap_or(0) } } diff --git a/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/rooms.rs b/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/rooms.rs index 8f9bcaf7d..57446067d 100644 --- a/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/rooms.rs +++ b/crates/pumpkin-world/src/generation/structure/structures/ocean_monument/rooms.rs @@ -116,8 +116,8 @@ impl RoomPiece { && graph.rooms[east].connections[BlockDirection::Up as usize] .is_some_and(|up| !graph.rooms[up].claimed) }) { - let east = east.unwrap(); - let up = up.unwrap(); + let east = east.unwrap_or(0); + let up = up.unwrap_or(0); let east_up = graph.connection(east, BlockDirection::Up); claim(graph, &[room, east, up, east_up]); RoomKind::DoubleXY @@ -131,26 +131,30 @@ impl RoomPiece { .is_some_and(|up| !graph.rooms[up].claimed) }) { - let north = north.unwrap(); - let up = up.unwrap(); + let north = north.unwrap_or(0); + let up = up.unwrap_or(0); let north_up = graph.connection(north, BlockDirection::Up); claim(graph, &[room, north, up, north_up]); RoomKind::DoubleYZ } else if opening(&graph.rooms[room], BlockDirection::North) && north.is_some_and(|north| !graph.rooms[north].claimed) { - let north = north.unwrap(); + let north = north.unwrap_or(0); claim(graph, &[room, north]); RoomKind::DoubleZ } else if opening(&graph.rooms[room], BlockDirection::East) && east.is_some_and(|east| !graph.rooms[east].claimed) { - claim(graph, &[room, east.unwrap()]); + if let Some(east) = east { + claim(graph, &[room, east]); + } RoomKind::DoubleX } else if opening(&graph.rooms[room], BlockDirection::Up) && up.is_some_and(|up| !graph.rooms[up].claimed) { - claim(graph, &[room, up.unwrap()]); + if let Some(up) = up { + claim(graph, &[room, up]); + } RoomKind::DoubleY } else if ![ BlockDirection::West, @@ -204,7 +208,7 @@ impl RoomPiece { } fn room<'a>(&self, graph: &'a RoomGraph) -> &'a RoomDefinition { - &graph.rooms[self.room.unwrap()] + &graph.rooms[self.room.unwrap_or(0)] } fn place_entry( @@ -308,7 +312,7 @@ impl RoomPiece { graph: &RoomGraph, ) { let p = &self.piece; - let west = self.room.unwrap(); + let west = self.room.unwrap_or(0); let east = graph.connection(west, BlockDirection::East); let west_room = &graph.rooms[west]; let east_room = &graph.rooms[east]; @@ -370,7 +374,7 @@ impl RoomPiece { graph: &RoomGraph, ) { let p = &self.piece; - let west = self.room.unwrap(); + let west = self.room.unwrap_or(0); let east = graph.connection(west, BlockDirection::East); let west_up = graph.connection(west, BlockDirection::Up); let east_up = graph.connection(east, BlockDirection::Up); @@ -515,7 +519,7 @@ impl RoomPiece { graph: &RoomGraph, ) { let p = &self.piece; - let lower = self.room.unwrap(); + let lower = self.room.unwrap_or(0); let upper = graph.connection(lower, BlockDirection::Up); let lower_room = &graph.rooms[lower]; let upper_room = &graph.rooms[upper]; @@ -680,7 +684,7 @@ impl RoomPiece { graph: &RoomGraph, ) { let p = &self.piece; - let south = self.room.unwrap(); + let south = self.room.unwrap_or(0); let north = graph.connection(south, BlockDirection::North); let south_up = graph.connection(south, BlockDirection::Up); let north_up = graph.connection(north, BlockDirection::Up); @@ -833,7 +837,7 @@ impl RoomPiece { graph: &RoomGraph, ) { let p = &self.piece; - let south = self.room.unwrap(); + let south = self.room.unwrap_or(0); let north = graph.connection(south, BlockDirection::North); let south_room = &graph.rooms[south]; let north_room = &graph.rooms[north]; diff --git a/flake.nix b/flake.nix index a14111cce..33361acb6 100644 --- a/flake.nix +++ b/flake.nix @@ -36,7 +36,7 @@ let naersk' = pkgs.callPackage naersk { }; - manifest = (lib.importTOML ./pumpkin/Cargo.toml).package; + manifest = (lib.importTOML ./crates/pumpkin/Cargo.toml).package; workspace-manifest = (lib.importTOML ./Cargo.toml).workspace.package; in { @@ -48,25 +48,7 @@ src = lib.fileset.toSource { root = ./.; - fileset = lib.fileset.unions [ - ./Cargo.lock - ./Cargo.toml - - ./assets - ./pumpkin - ./pumpkin-api-macros - ./pumpkin-codecs - ./pumpkin-config - ./pumpkin-data - ./pumpkin-inventory - ./pumpkin-macros - ./pumpkin-nbt - ./pumpkin-plugin-api - ./pumpkin-plugin-wit - ./pumpkin-protocol - ./pumpkin-util - ./pumpkin-world - ]; + fileset = lib.fileset.gitTracked ./.; }; };