mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-06 07:46:08 +00:00
Only compute if absent/present if compute is not needed (locking opts)
This commit is contained in:
@@ -144,7 +144,7 @@ public class IrisBiomeCustom {
|
||||
KMap<IrisBiomeCustomSpawnType, JSONArray> groups = new KMap<>();
|
||||
|
||||
for (IrisBiomeCustomSpawn i : getSpawns()) {
|
||||
JSONArray g = groups.compute(i.getGroup(), (k, v) -> v != null ? v : new JSONArray());
|
||||
JSONArray g = groups.computeIfAbsent(i.getGroup(), (k) -> new JSONArray());
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("type", "minecraft:" + i.getType().name().toLowerCase());
|
||||
o.put("weight", i.getWeight());
|
||||
|
||||
@@ -81,11 +81,7 @@ public class IrisObjectScale {
|
||||
return origin;
|
||||
}
|
||||
|
||||
return cache.compute(origin, (k, v) -> {
|
||||
if (v != null) {
|
||||
return v;
|
||||
}
|
||||
|
||||
return cache.computeIfAbsent(origin, (k) -> {
|
||||
KList<IrisObject> c = new KList<>();
|
||||
for (double i = minimumScale; i < maximumScale; i += (maximumScale - minimumScale) / (double) (Math.min(variations, 32))) {
|
||||
c.add(origin.scaled(i, getInterpolation()));
|
||||
|
||||
Reference in New Issue
Block a user