diff options
| author | mat <github@matdoes.dev> | 2022-10-02 14:52:48 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-10-02 14:52:48 -0500 |
| commit | 37f9f1c6feda676be30bef31291eaed2a5fc82ce (patch) | |
| tree | 9e61a94766d0477eeb861165fa721f8b42bb9a85 /azalea-block | |
| parent | c9b4dccd7eaeed68ce96cf5167916417d0baa6a7 (diff) | |
| download | azalea-drasl-37f9f1c6feda676be30bef31291eaed2a5fc82ce.tar.xz | |
add jumping
Diffstat (limited to 'azalea-block')
| -rw-r--r-- | azalea-block/src/behavior.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/azalea-block/src/behavior.rs b/azalea-block/src/behavior.rs index db357632..18854fff 100644 --- a/azalea-block/src/behavior.rs +++ b/azalea-block/src/behavior.rs @@ -1,7 +1,17 @@ -#[derive(Default)] pub struct BlockBehavior { pub has_collision: bool, pub friction: f32, + pub jump_factor: f32, +} + +impl Default for BlockBehavior { + fn default() -> Self { + Self { + has_collision: true, + friction: 0.6, + jump_factor: 1.0, + } + } } impl BlockBehavior { @@ -16,4 +26,10 @@ impl BlockBehavior { self.friction = friction; self } + + #[inline] + pub fn jump_factor(mut self, jump_factor: f32) -> Self { + self.jump_factor = jump_factor; + self + } } |
