An unofficial collection of APIs used in FreeJam games and mods
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
598B

  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. }