@@ -6,21 +6,21 @@ use tokio::sync::RwLock;
66pub struct Entities {
77 eid_counter : std:: sync:: atomic:: AtomicU32 ,
88 uuid_counter : std:: sync:: atomic:: AtomicU64 ,
9- pub entities : RwLock < HashMap < Eid , AnyEntity > > ,
10- pub tasks : RwLock < HashMap < Eid , EntityTask > > ,
9+ tasks : RwLock < HashMap < Eid , EntityTask > > ,
10+ entities : RwLock < HashMap < Eid , AnyEntity > > ,
1111
1212 /// A hashmap of chunk positions to get a list of entities in a chunk
13- pub chunks : RwLock < HashMap < ChunkColumnPosition , HashSet < Eid > > > ,
14- pub uuids : RwLock < HashMap < UUID , Eid > > ,
13+ chunks : RwLock < HashMap < ChunkColumnPosition , HashSet < Eid > > > ,
14+ uuids : RwLock < HashMap < UUID , Eid > > ,
1515}
1616
1717impl Entities {
1818 pub fn new ( ) -> Entities {
1919 Entities {
2020 eid_counter : std:: sync:: atomic:: AtomicU32 :: new ( 0 ) ,
2121 uuid_counter : std:: sync:: atomic:: AtomicU64 :: new ( 0 ) ,
22- entities : RwLock :: new ( HashMap :: new ( ) ) ,
2322 tasks : RwLock :: new ( HashMap :: new ( ) ) ,
23+ entities : RwLock :: new ( HashMap :: new ( ) ) ,
2424 chunks : RwLock :: new ( HashMap :: new ( ) ) ,
2525 uuids : RwLock :: new ( HashMap :: new ( ) ) ,
2626 }
@@ -77,8 +77,8 @@ impl Entities {
7777 let task = entity. init_task ( ) . await ;
7878 let eid = self . eid_counter . fetch_add ( 1 , std:: sync:: atomic:: Ordering :: SeqCst ) ;
7979 let uuid = self . uuid_counter . fetch_add ( 1 , std:: sync:: atomic:: Ordering :: SeqCst ) as u128 ;
80- let mut entities = self . entities . write ( ) . await ;
8180 let mut tasks = self . tasks . write ( ) . await ;
81+ let mut entities = self . entities . write ( ) . await ;
8282 let mut chunks = self . chunks . write ( ) . await ;
8383 let mut uuids = self . uuids . write ( ) . await ;
8484 chunks. entry ( entity. as_entity ( ) . position . chunk_column ( ) ) . or_insert ( HashSet :: new ( ) ) . insert ( eid) ;
0 commit comments