Its faster to be sync when you're already mutlicore...

This commit is contained in:
Daniel Mills 2021-07-15 00:38:57 -04:00
parent d3c47fe1a4
commit c99c7ee6c9

View File

@ -62,48 +62,41 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
@Override @Override
public void onActuate(int x, int z, Hunk<Biome> h) { public void onActuate(int x, int z, Hunk<Biome> h) {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
int zf, hh; int zf;
BurstExecutor burst = MultiBurst.burst.burst(h.getWidth() * h.getDepth());
for (int xf = 0; xf < h.getWidth(); xf++) { for (int xf = 0; xf < h.getWidth(); xf++) {
for (zf = 0; zf < h.getDepth(); zf++) { for (zf = 0; zf < h.getDepth(); zf++) {
int xxf = xf;
int zzf = zf;
burst.queue(() -> { IrisBiome ib = getComplex().getTrueBiomeStream().get(modX(xf + x), modZ(zf + z));
IrisBiome ib = getComplex().getTrueBiomeStream().get(modX(xxf + x), modZ(zzf + z));
if (ib.isCustom()) { if (ib.isCustom()) {
try { try {
IrisBiomeCustom custom = ib.getCustomBiome(rng, x, 0, z); IrisBiomeCustom custom = ib.getCustomBiome(rng, x, 0, z);
Object biomeBase = INMS.get().getCustomBiomeBaseFor(getDimension().getLoadKey() + ":" + custom.getId()); Object biomeBase = INMS.get().getCustomBiomeBaseFor(getDimension().getLoadKey() + ":" + custom.getId());
if (!injectBiome(h, x, 0, z, biomeBase)) { if (!injectBiome(h, x, 0, z, biomeBase)) {
throw new RuntimeException("Cant inject biome!"); throw new RuntimeException("Cant inject biome!");
}
for (int i = 0; i < h.getHeight(); i++) {
injectBiome(h, xxf, i, zzf, biomeBase);
}
} catch (Throwable e) {
e.printStackTrace();
Biome v = ib.getSkyBiome(rng, x, 0, z);
for (int i = 0; i < h.getHeight(); i++) {
h.set(xxf, i, zzf, v);
}
} }
} else {
for (int i = 0; i < h.getHeight(); i++) {
injectBiome(h, xf, i, zf, biomeBase);
}
} catch (Throwable e) {
e.printStackTrace();
Biome v = ib.getSkyBiome(rng, x, 0, z); Biome v = ib.getSkyBiome(rng, x, 0, z);
for (int i = 0; i < h.getHeight(); i++) { for (int i = 0; i < h.getHeight(); i++) {
h.set(xxf, i, zzf, v); h.set(xf, i, zf, v);
} }
} }
}); } else {
Biome v = ib.getSkyBiome(rng, x, 0, z);
for (int i = 0; i < h.getHeight(); i++) {
h.set(xf, i, zf, v);
}
}
} }
} }
burst.complete();
getEngine().getMetrics().getBiome().put(p.getMilliseconds()); getEngine().getMetrics().getBiome().put(p.getMilliseconds());
} }
} }