Skip to content

Commit

Permalink
Move types and rename to be more generic. (#23)
Browse files Browse the repository at this point in the history
* Add interaction enums for block placement.

* Make enums more generic and move into potentially more proper locations.
  • Loading branch information
ambeeeeee authored Mar 3, 2021
1 parent 5669160 commit 58c1e40
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
16 changes: 0 additions & 16 deletions crates/core/src/interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,3 @@ pub enum InteractionType {
Attack,
InteractAt,
}

#[derive(Debug, Serialize, Deserialize)]
pub enum InteractHand {
Main,
Offhand,
}

#[derive(Debug, Serialize, Deserialize)]
pub enum InteractBlockFace {
Bottom,
Top,
North,
South,
West,
East,
}
8 changes: 5 additions & 3 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod entity;
mod gamemode;
mod gamerules;
mod interaction;
mod player;
mod positions;

pub use biome::Biome;
Expand All @@ -16,8 +17,9 @@ pub use enchantment::{Enchantment, EnchantmentKind};
pub use entity::EntityKind;
pub use gamemode::Gamemode;
pub use gamerules::GameRules;
pub use interaction::{InteractBlockFace, InteractHand, InteractionType};
pub use interaction::InteractionType;
pub use player::Hand;
pub use positions::{
vec3, Aabb, BlockPosition, ChunkPosition, Mat4f, Position, Vec2d, Vec2f, Vec2i, Vec3d, Vec3f,
Vec3i, Vec4d, Vec4f, Vec4i,
vec3, Aabb, BlockFace, BlockPosition, ChunkPosition, Mat4f, Position, Vec2d, Vec2f, Vec2i,
Vec3d, Vec3f, Vec3i, Vec4d, Vec4f, Vec4i,
};
7 changes: 7 additions & 0 deletions crates/core/src/player.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
pub enum Hand {
Main,
Offhand,
}
10 changes: 10 additions & 0 deletions crates/core/src/positions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,13 @@ impl From<BlockPosition> for ChunkPosition {
}
}
}

#[derive(Debug, Serialize, Deserialize)]
pub enum BlockFace {
Bottom,
Top,
North,
South,
West,
East,
}

0 comments on commit 58c1e40

Please sign in to comment.