diff options
Diffstat (limited to 'azalea-entity/src/plugin/relative_updates.rs')
| -rw-r--r-- | azalea-entity/src/plugin/relative_updates.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/azalea-entity/src/plugin/relative_updates.rs b/azalea-entity/src/plugin/relative_updates.rs index 63b00195..5ad7d7a0 100644 --- a/azalea-entity/src/plugin/relative_updates.rs +++ b/azalea-entity/src/plugin/relative_updates.rs @@ -46,6 +46,17 @@ pub struct RelativeEntityUpdate { // a function that takes the entity and updates it pub update: Box<dyn FnOnce(&mut EntityWorldMut) + Send + Sync>, } +impl RelativeEntityUpdate { + pub fn new( + partial_world: Arc<RwLock<PartialInstance>>, + update: impl FnOnce(&mut EntityWorldMut) + Send + Sync + 'static, + ) -> Self { + Self { + partial_world, + update: Box::new(update), + } + } +} /// A component that counts the number of times this entity has been modified. /// This is used for making sure two clients don't do the same relative update |
