An unofficial collection of APIs used in FreeJam games and mods
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

12345678910111213141516
  1. use std::io::Read;
  2. use crate::techblox::{Parsable, SerializedEntityDescriptor};
  3. #[cfg(debug_assertions)]
  4. use crate::techblox::blocks::*;
  5. pub fn lookup_hashname(hash: u32, data: &mut dyn Read) -> std::io::Result<Box<dyn SerializedEntityDescriptor>> {
  6. Ok(match hash {
  7. 1357220432 /*StandardBlockEntityDescriptorV4*/ => Box::new(BlockEntity::parse(data)?),
  8. _ => {
  9. #[cfg(debug_assertions)]
  10. println!("Unknown hash ID {}", hash);
  11. return Err(std::io::Error::new(std::io::ErrorKind::Other, format!("Unrecognised hash {}", hash)))
  12. }
  13. })
  14. }