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.

39 lines
986B

  1. use std::convert::AsRef;
  2. use crate::techblox::{SerializedEntityDescriptor, Parsable, SerializedEntityComponent,
  3. blocks::{BlockEntity, Block}};
  4. use libfj_parsable_macro_derive::*;
  5. /// Joint block entity descriptor
  6. #[derive(Copy, Clone, Parsable)]
  7. pub struct JointBlockEntity {
  8. /// parent block entity
  9. pub block: BlockEntity,
  10. }
  11. impl SerializedEntityDescriptor for JointBlockEntity {
  12. fn serialized_components() -> u8 {
  13. BlockEntity::serialized_components()
  14. }
  15. fn components<'a>(&'a self) -> Vec<&'a dyn SerializedEntityComponent> {
  16. self.block.components()
  17. }
  18. fn components_mut<'a>(&'a mut self) -> Vec<&'a mut dyn SerializedEntityComponent> {
  19. self.block.components_mut()
  20. }
  21. fn hash_name(&self) -> u32 {
  22. Self::hash("JointBlockEntityDescriptorV3") // 3586818581
  23. }
  24. }
  25. impl AsRef<BlockEntity> for JointBlockEntity {
  26. fn as_ref(&self) -> &BlockEntity {
  27. &self.block
  28. }
  29. }
  30. impl Block for JointBlockEntity {}