This commit is contained in:
Daniel Mills 2021-07-27 17:34:51 -04:00
parent 8f7db7e52f
commit fc678684f5
9 changed files with 23 additions and 46 deletions

View File

@ -216,8 +216,7 @@ public class IrisProject {
try { try {
KList<Report> reports = scanForErrors(); KList<Report> reports = scanForErrors();
if(reports.isNotEmpty()) if (reports.isNotEmpty()) {
{
sender.sendMessage("There are " + reports.size() + " problems detected with this project. See console!"); sender.sendMessage("There are " + reports.size() + " problems detected with this project. See console!");
Iris.error("==========================================================="); Iris.error("===========================================================");
for (Report i : reports) { for (Report i : reports) {

View File

@ -122,7 +122,7 @@ public class TreeManager implements Listener {
BlockState state = b.getState(); BlockState state = b.getState();
state.setBlockData(d); state.setBlockData(d);
blockStateList.add(b.getState()); blockStateList.add(b.getState());
dataCache.put(new Location(event.getWorld(), x,y,z), d); dataCache.put(new Location(event.getWorld(), x, y, z), d);
} }
@Override @Override
@ -188,8 +188,7 @@ public class TreeManager implements Listener {
for (BlockState block : iGrow.getBlocks()) { for (BlockState block : iGrow.getBlocks()) {
Location l = block.getLocation(); Location l = block.getLocation();
if(dataCache.containsKey(l)) if (dataCache.containsKey(l)) {
{
l.getBlock().setBlockData(dataCache.get(l), false); l.getBlock().setBlockData(dataCache.get(l), false);
} }
} }
@ -274,7 +273,7 @@ public class TreeManager implements Listener {
} }
Iris.debug("Blocks: " + blockPositions.size()); Iris.debug("Blocks: " + blockPositions.size());
Iris.debug("Min: " + a.toString() + " Max: " + b.toString()); Iris.debug("Min: " + a + " Max: " + b);
// Create a cuboid with the size calculated before // Create a cuboid with the size calculated before
Cuboid cuboid = new Cuboid(a.toBlock(world).getLocation(), b.toBlock(world).getLocation()); Cuboid cuboid = new Cuboid(a.toBlock(world).getLocation(), b.toBlock(world).getLocation());

View File

@ -75,7 +75,7 @@ public class SyndicatePregenMethod implements PregeneratorMethod {
.seed(seed) .seed(seed)
.build()) .build())
.output((o) -> { .output((o) -> {
File to = new File(Iris.getTemp(), "send-" + pack.toString() + ".zip"); File to = new File(Iris.getTemp(), "send-" + pack + ".zip");
ZipUtil.pack(dimension.getLoader().getDataFolder(), to); ZipUtil.pack(dimension.getLoader().getDataFolder(), to);
try { try {

View File

@ -169,8 +169,7 @@ public class IrisEngine extends BlockPopulator implements Engine {
Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t)); Hunk<BlockData> blocks = vblocks.listen((xx, y, zz, t) -> catchBlockUpdates(x + xx, y + getMinHeight(), z + zz, t));
PrecisionStopwatch px = PrecisionStopwatch.start(); PrecisionStopwatch px = PrecisionStopwatch.start();
if(multicore) if (multicore) {
{
BurstExecutor b = burst().burst(16); BurstExecutor b = burst().burst(16);
for (int i = 0; i < vblocks.getWidth(); i++) { for (int i = 0; i < vblocks.getWidth(); i++) {
int finalI = i; int finalI = i;
@ -205,15 +204,12 @@ public class IrisEngine extends BlockPopulator implements Engine {
} }
getMetrics().getTotal().put(p.getMilliseconds()); getMetrics().getTotal().put(p.getMilliseconds());
if(IrisSettings.get().getGeneral().isDebug()) if (IrisSettings.get().getGeneral().isDebug()) {
{
KList<String> v = new KList<>(); KList<String> v = new KList<>();
KMap<String, Double> g = getMetrics().pull(); KMap<String, Double> g = getMetrics().pull();
for(String i : g.sortKNumber()) for (String i : g.sortKNumber()) {
{ if (g.get(i) != null) {
if(g.get(i) != null)
{
v.add(C.RESET + "" + C.LIGHT_PURPLE + i + ": " + C.UNDERLINE + C.BLUE + Form.duration(g.get(i), 0) + C.RESET + C.GRAY + ""); v.add(C.RESET + "" + C.LIGHT_PURPLE + i + ": " + C.UNDERLINE + C.BLUE + Form.duration(g.get(i), 0) + C.RESET + C.GRAY + "");
} }
} }

View File

@ -25,7 +25,6 @@ import com.volmit.iris.engine.framework.EngineParallaxManager;
import com.volmit.iris.engine.object.IrisFeaturePositional; import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.documentation.BlockCoordinates; import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.scheduling.IrisLock;
import lombok.Getter; import lombok.Getter;
import org.bukkit.util.Consumer; import org.bukkit.util.Consumer;
@ -62,13 +61,12 @@ public class IrisEngineParallax implements EngineParallaxManager {
@Override @Override
@BlockCoordinates @BlockCoordinates
public KList<IrisFeaturePositional> forEachFeature(double x, double z) { public KList<IrisFeaturePositional> forEachFeature(double x, double z) {
int cx = ((int)x) >> 4; int cx = ((int) x) >> 4;
int cz = ((int)x) >> 4; int cz = ((int) x) >> 4;
long key = Cache.key(cx, cz); long key = Cache.key(cx, cz);
return featureCache.compute(key, (k, v) -> { return featureCache.compute(key, (k, v) -> {
if(v != null) if (v != null) {
{
return v; return v;
} }

View File

@ -54,8 +54,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
public void onActuate(int x, int z, Hunk<BlockData> h, boolean multicore) { public void onActuate(int x, int z, Hunk<BlockData> h, boolean multicore) {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
if(multicore) if (multicore) {
{
BurstExecutor e = getEngine().burst().burst(h.getWidth()); BurstExecutor e = getEngine().burst().burst(h.getWidth());
for (int xf = 0; xf < h.getWidth(); xf++) { for (int xf = 0; xf < h.getWidth(); xf++) {
int finalXf = xf; int finalXf = xf;
@ -63,10 +62,7 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
} }
e.complete(); e.complete();
} } else {
else
{
for (int xf = 0; xf < h.getWidth(); xf++) { for (int xf = 0; xf < h.getWidth(); xf++) {
terrainSliver(x, z, xf, h); terrainSliver(x, z, xf, h);
} }
@ -77,10 +73,11 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
/** /**
* This is calling 1/16th of a chunk x/z slice. It is a plane from sky to bedrock 1 thick in the x direction. * This is calling 1/16th of a chunk x/z slice. It is a plane from sky to bedrock 1 thick in the x direction.
* @param x the chunk x in blocks *
* @param z the chunk z in blocks * @param x the chunk x in blocks
* @param z the chunk z in blocks
* @param xf the current x slice * @param xf the current x slice
* @param h the blockdata * @param h the blockdata
*/ */
@BlockCoordinates @BlockCoordinates
public void terrainSliver(int x, int z, int xf, Hunk<BlockData> h) { public void terrainSliver(int x, int z, int xf, Hunk<BlockData> h) {

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.framework; package com.volmit.iris.engine.framework;
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisDataManager; import com.volmit.iris.core.IrisDataManager;
import com.volmit.iris.engine.IrisComplex; import com.volmit.iris.engine.IrisComplex;
@ -42,7 +41,6 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.format.Form; import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.function.Consumer4; import com.volmit.iris.util.function.Consumer4;
import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.scheduling.IrisLock;
import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.PrecisionStopwatch; import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import org.bukkit.Chunk; import org.bukkit.Chunk;

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.modifier; package com.volmit.iris.engine.modifier;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.B; import com.volmit.iris.engine.data.B;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.framework.EngineAssignedModifier; import com.volmit.iris.engine.framework.EngineAssignedModifier;
@ -56,8 +55,7 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData> {
} }
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
if(multicore) if (multicore) {
{
BurstExecutor e = getEngine().burst().burst(a.getWidth()); BurstExecutor e = getEngine().burst().burst(a.getWidth());
for (int i = 0; i < a.getWidth(); i++) { for (int i = 0; i < a.getWidth(); i++) {
int finalI = i; int finalI = i;
@ -65,10 +63,7 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData> {
} }
e.complete(); e.complete();
} } else {
else
{
for (int i = 0; i < a.getWidth(); i++) { for (int i = 0; i < a.getWidth(); i++) {
modifySliver(x, z, i, a); modifySliver(x, z, i, a);
} }
@ -77,8 +72,7 @@ public class IrisCaveModifier extends EngineAssignedModifier<BlockData> {
getEngine().getMetrics().getCave().put(p.getMilliseconds()); getEngine().getMetrics().getCave().put(p.getMilliseconds());
} }
public void modifySliver(int x, int z, int finalI, Hunk<BlockData> a) public void modifySliver(int x, int z, int finalI, Hunk<BlockData> a) {
{
for (int j = 0; j < a.getDepth(); j++) { for (int j = 0; j < a.getDepth(); j++) {
KList<CaveResult> caves = genCaves(x + finalI, z + j, finalI, j, a); KList<CaveResult> caves = genCaves(x + finalI, z + j, finalI, j, a);
int he = (int) Math.round(getComplex().getHeightStream().get(x + finalI, z + j)); int he = (int) Math.round(getComplex().getHeightStream().get(x + finalI, z + j));

View File

@ -51,8 +51,7 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
int i; int i;
AtomicInteger j = new AtomicInteger(); AtomicInteger j = new AtomicInteger();
if(multicore) if (multicore) {
{
BurstExecutor e = getEngine().burst().burst(output.getWidth()); BurstExecutor e = getEngine().burst().burst(output.getWidth());
for (i = 0; i < output.getWidth(); i++) { for (i = 0; i < output.getWidth(); i++) {
int finalI = i; int finalI = i;
@ -63,10 +62,7 @@ public class IrisPostModifier extends EngineAssignedModifier<BlockData> {
}); });
} }
e.complete(); e.complete();
} } else {
else
{
for (i = 0; i < output.getWidth(); i++) { for (i = 0; i < output.getWidth(); i++) {
for (j.set(0); j.get() < output.getDepth(); j.getAndIncrement()) { for (j.set(0); j.get() < output.getDepth(); j.getAndIncrement()) {
post(i, j.get(), output, i + x, j.get() + z); post(i, j.get(), output, i + x, j.get() + z);