This commit is contained in:
Daniel Mills 2021-08-03 20:01:21 -04:00
parent ea8d1100ac
commit f4191ad984
7 changed files with 27 additions and 15 deletions

View File

@ -23,6 +23,7 @@ import com.volmit.iris.core.project.loader.IrisData;
import com.volmit.iris.core.tools.IrisWorlds; import com.volmit.iris.core.tools.IrisWorlds;
import com.volmit.iris.engine.framework.IrisAccess; import com.volmit.iris.engine.framework.IrisAccess;
import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisRegion; import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.format.C; import com.volmit.iris.util.format.C;
@ -82,6 +83,7 @@ public class CommandIrisStudioGoto extends MortarCommand {
IrisAccess g = IrisWorlds.access(world); IrisAccess g = IrisWorlds.access(world);
IrisBiome b = IrisData.loadAnyBiome(args[0]); IrisBiome b = IrisData.loadAnyBiome(args[0]);
IrisRegion r = IrisData.loadAnyRegion(args[0]); IrisRegion r = IrisData.loadAnyRegion(args[0]);
IrisJigsawStructure s = IrisData.loadAnyJigsawStructure(args[0]);
if (b != null) { if (b != null) {
J.a(() -> { J.a(() -> {
@ -105,6 +107,17 @@ public class CommandIrisStudioGoto extends MortarCommand {
J.s(() -> sender.player().teleport(l)); J.s(() -> sender.player().teleport(l));
} }
}); });
}else if (s != null) {
J.a(() -> {
Location l = g.lookForRegion(r, 60000, (v) -> sender.sendMessage(C.BOLD + "" + C.WHITE + r.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
if (l == null) {
sender.sendMessage("Couldn't find " + r.getName() + ".");
} else {
sender.sendMessage("Found " + r.getName() + "!");
J.s(() -> sender.player().teleport(l));
}
});
} else { } else {
sender.sendMessage(args[0] + " is not a biome or region in this dimension. (Biome teleportation works best!"); sender.sendMessage(args[0] + " is not a biome or region in this dimension. (Biome teleportation works best!");
} }

View File

@ -45,7 +45,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
@Data @Data
public class IrisComplex implements DataProvider { public class IrisComplex implements DataProvider {
public static AtomicBoolean cacheLock = new AtomicBoolean(false);
private RNG rng; private RNG rng;
private double fluidHeight; private double fluidHeight;
private IrisData data; private IrisData data;

View File

@ -26,6 +26,8 @@ import com.volmit.iris.engine.data.DataProvider;
import com.volmit.iris.engine.data.mca.NBTWorld; import com.volmit.iris.engine.data.mca.NBTWorld;
import com.volmit.iris.engine.headless.HeadlessGenerator; import com.volmit.iris.engine.headless.HeadlessGenerator;
import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisJigsawStructurePlacement;
import com.volmit.iris.engine.object.IrisRegion; import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.common.IrisWorld; import com.volmit.iris.engine.object.common.IrisWorld;
import com.volmit.iris.engine.parallel.MultiBurst; import com.volmit.iris.engine.parallel.MultiBurst;
@ -124,7 +126,6 @@ public interface IrisAccess extends Hotloadable, DataProvider {
return null; return null;
} }
IrisComplex.cacheLock.set(true);
ChronoLatch cl = new ChronoLatch(250, false); ChronoLatch cl = new ChronoLatch(250, false);
long s = M.ms(); long s = M.ms();
int cpus = (Runtime.getRuntime().availableProcessors()); int cpus = (Runtime.getRuntime().availableProcessors());
@ -137,7 +138,6 @@ public interface IrisAccess extends Hotloadable, DataProvider {
} }
if (engines.isEmpty()) { if (engines.isEmpty()) {
IrisComplex.cacheLock.set(false);
return null; return null;
} }
@ -193,12 +193,10 @@ public interface IrisAccess extends Hotloadable, DataProvider {
if (M.ms() - s > timeout) { if (M.ms() - s > timeout) {
running.set(false); running.set(false);
IrisComplex.cacheLock.set(false);
return null; return null;
} }
} }
IrisComplex.cacheLock.set(false);
running.set(false); running.set(false);
return location.get(); return location.get();
} }
@ -209,7 +207,6 @@ public interface IrisAccess extends Hotloadable, DataProvider {
return null; return null;
} }
IrisComplex.cacheLock.set(true);
ChronoLatch cl = new ChronoLatch(3000, false); ChronoLatch cl = new ChronoLatch(3000, false);
long s = M.ms(); long s = M.ms();
int cpus = (Runtime.getRuntime().availableProcessors()); int cpus = (Runtime.getRuntime().availableProcessors());
@ -222,7 +219,6 @@ public interface IrisAccess extends Hotloadable, DataProvider {
} }
if (engines.isEmpty()) { if (engines.isEmpty()) {
IrisComplex.cacheLock.set(false);
return null; return null;
} }
@ -269,13 +265,11 @@ public interface IrisAccess extends Hotloadable, DataProvider {
if (M.ms() - s > timeout) { if (M.ms() - s > timeout) {
triesc.accept(tries.get()); triesc.accept(tries.get());
running.set(false); running.set(false);
IrisComplex.cacheLock.set(false);
return null; return null;
} }
} }
triesc.accept(tries.get()); triesc.accept(tries.get());
IrisComplex.cacheLock.set(false);
running.set(false); running.set(false);
return location.get(); return location.get();
} }

View File

@ -44,6 +44,7 @@ import org.bukkit.util.BlockVector;
public class PlannedPiece { public class PlannedPiece {
private IrisPosition position; private IrisPosition position;
private IrisObject object; private IrisObject object;
private IrisObject ogObject;
private IrisJigsawPiece piece; private IrisJigsawPiece piece;
private IrisObjectRotation rotation; private IrisObjectRotation rotation;
private IrisData data; private IrisData data;
@ -65,10 +66,12 @@ public class PlannedPiece {
this.position = position; this.position = position;
this.data = piece.getLoader(); this.data = piece.getLoader();
this.setRotation(rot); this.setRotation(rot);
this.ogObject = data.getObjectLoader().load(piece.getObject());
this.object = structure.rotated(piece, rotation); this.object = structure.rotated(piece, rotation);
this.piece = rotation.rotateCopy(piece); this.piece = rotation.rotateCopy(piece);
this.piece.setLoadKey(piece.getLoadKey()); this.piece.setLoadKey(piece.getLoadKey());
this.object.setLoadKey(piece.getObject()); this.object.setLoadKey(piece.getObject());
this.ogObject.setLoadKey(piece.getObject());
this.connected = new KList<>(); this.connected = new KList<>();
} }
@ -150,11 +153,12 @@ public class PlannedPiece {
minY--; //If the dimension has no bedrock, allow it to go a block lower minY--; //If the dimension has no bedrock, allow it to go a block lower
} }
getPiece().getPlacementOptions().getRotation().setEnabled(false); getPiece().getPlacementOptions().setRotation(rotation);
int finalMinY = minY; int finalMinY = minY;
RNG rng = getStructure().getRng().nextParallelRNG(37555); RNG rng = getStructure().getRng().nextParallelRNG(37555);
// TODO: REAL CLASSES!!!!!!! // TODO: REAL CLASSES!!!!!!!
getObject().place(position.getX() + getObject().getCenter().getBlockX(), position.getY() + getObject().getCenter().getBlockY(), position.getZ() + getObject().getCenter().getBlockZ(), new IObjectPlacer() { getOgObject().place(position.getX() + getObject().getCenter().getBlockX(), position.getY() + getObject().getCenter().getBlockY(), position.getZ() + getObject().getCenter().getBlockZ(), new IObjectPlacer() {
@Override @Override
public int getHighest(int x, int z, IrisData data) { public int getHighest(int x, int z, IrisData data) {
return position.getY(); return position.getY();

View File

@ -97,6 +97,7 @@ public class PlannedStructure {
options.setMode(i.getPiece().getPlaceMode()); options.setMode(i.getPiece().getPlaceMode());
} }
IrisObject vo = i.getOgObject();
IrisObject v = i.getObject(); IrisObject v = i.getObject();
int sx = (v.getW() / 2); int sx = (v.getW() / 2);
int sz = (v.getD() / 2); int sz = (v.getD() / 2);
@ -111,7 +112,7 @@ public class PlannedStructure {
int id = rng.i(0, Integer.MAX_VALUE); int id = rng.i(0, Integer.MAX_VALUE);
int h = v.place(xx, height, zz, placer, options, rng, (b) -> { int h = vo.place(xx, height, zz, placer, options, rng, (b) -> {
int xf = b.getX(); int xf = b.getX();
int yf = b.getY(); int yf = b.getY();
int zf = b.getZ(); int zf = b.getZ();

View File

@ -725,13 +725,14 @@ public class IrisObject extends IrisRegistrant {
KMap<BlockVector, BlockData> d = new KMap<>(); KMap<BlockVector, BlockData> d = new KMap<>();
for (BlockVector i : getBlocks().keySet()) { for (BlockVector i : getBlocks().keySet()) {
d.put(r.rotate(i.clone(), spinx, spiny, spinz), r.rotate(Objects.requireNonNull(getBlocks().get(i)).clone(), spinx, spiny, spinz)); d.put(r.rotate(i.clone(), spinx, spiny, spinz), r.rotate(getBlocks().get(i).clone(),
spinx, spiny, spinz));
} }
KMap<BlockVector, TileData<? extends TileState>> dx = new KMap<>(); KMap<BlockVector, TileData<? extends TileState>> dx = new KMap<>();
for (BlockVector i : getStates().keySet()) { for (BlockVector i : getStates().keySet()) {
dx.put(r.rotate(i.clone(), spinx, spiny, spinz), Objects.requireNonNull(getStates().get(i))); dx.put(r.rotate(i.clone(), spinx, spiny, spinz), getStates().get(i));
} }
blocks = d; blocks = d;

View File

@ -30,6 +30,7 @@ import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.block.data.*; import org.bukkit.block.data.*;
import org.bukkit.util.BlockVector; import org.bukkit.util.BlockVector;
import org.bukkit.util.Vector;
import java.util.List; import java.util.List;
@ -395,7 +396,6 @@ public class IrisObjectRotation {
} }
} }
return v; return v;
} }