diff options
| author | mat <git@matdoes.dev> | 2025-02-23 08:47:17 +0000 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-02-23 08:47:17 +0000 |
| commit | dd557c8f293dbef3e2e881bcb1a85a7697a1ebbb (patch) | |
| tree | 9878084875ac8ca7259db26b2c16776f212802a3 /azalea-entity/src/plugin | |
| parent | e21e1b97bf9337e9f4747cd1b545b1b3a03e2ce7 (diff) | |
| download | azalea-drasl-dd557c8f293dbef3e2e881bcb1a85a7697a1ebbb.tar.xz | |
fix memory leak in simulation tests (lol)
also, change some vecs into boxed slices, and add RelativeEntityUpdate::new
Diffstat (limited to 'azalea-entity/src/plugin')
| -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 |
