-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16a211e
commit 3c113bc
Showing
5 changed files
with
52 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use mchprs_blocks::blocks::{noteblock_note_to_pitch, Block, Instrument}; | ||
use mchprs_blocks::{BlockFace, BlockPos}; | ||
|
||
use crate::world::World; | ||
|
||
pub fn is_noteblock_unblocked(world: &impl World, pos: BlockPos) -> bool { | ||
matches!(world.get_block(pos.offset(BlockFace::Top)), Block::Air {}) | ||
} | ||
|
||
pub fn get_noteblock_instrument(world: &impl World, pos: BlockPos) -> Instrument { | ||
Instrument::from_block_below(world.get_block(pos.offset(BlockFace::Bottom))) | ||
} | ||
|
||
pub fn play_note(world: &mut impl World, pos: BlockPos, instrument: Instrument, note: u32) { | ||
world.play_sound( | ||
pos, | ||
instrument.to_sound_id(), | ||
2, // Sound Caregory ID for Records | ||
3.0, | ||
noteblock_note_to_pitch(note), | ||
); | ||
} |