From dd557c8f293dbef3e2e881bcb1a85a7697a1ebbb Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 23 Feb 2025 08:47:17 +0000 Subject: fix memory leak in simulation tests (lol) also, change some vecs into boxed slices, and add RelativeEntityUpdate::new --- azalea-entity/src/plugin/relative_updates.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'azalea-entity') 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, } +impl RelativeEntityUpdate { + pub fn new( + partial_world: Arc>, + 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 -- cgit v1.2.3