mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-23 16:44:06 +00:00
Only compute if absent/present if compute is not needed (locking opts)
This commit is contained in:
1 parent
ca961e8498
commit
eeab12ed86
18 files changed
+25
-64
No files matched your search
@@ -103,8 +103,8 @@ public class EntityMatter extends RawMatter<MatterEntityGroup> {
|
||||
entityCache = new KMap<>();
|
||||
|
||||
for (Entity i : ((World) w).getNearbyEntities(new BoundingBox(x, y, z, x + getWidth(), y + getHeight(), z + getHeight()))) {
|
||||
entityCache.compute(new IrisPosition(i.getLocation()),
|
||||
(k, v) -> v == null ? new KList<>() : v).add(i);
|
||||
entityCache.computeIfAbsent(new IrisPosition(i.getLocation()),
|
||||
k -> new KList<>()).add(i);
|
||||
}
|
||||
|
||||
for (IrisPosition i : entityCache.keySet()) {
|
||||
|
||||
Reference in new issue
Block a user