Locky overrides

This commit is contained in:
cyberpwn 2021-08-22 03:30:39 -04:00
parent 5bf6687f1f
commit 4a6d58c36e
5 changed files with 64 additions and 34 deletions

View File

@ -39,6 +39,7 @@ import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.data.B;
import com.volmit.iris.util.exceptions.IrisException;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
@ -514,26 +515,6 @@ public class IrisProject {
files(getPath(), files);
filesObjects(getPath(), objects);
jobs.add(new ParallelQueueJob<File>() {
@Override
public void execute(File f) {
try {
JSONObject p = new JSONObject(IO.readAll(f));
fixBlocks(p);
scanForErrors(data, f, p, sender);
IO.writeAll(f, p.toString(4));
} catch (Throwable e) {
sender.sendMessage(C.RED + "JSON Error "+ f.getPath() + ": " + e.getMessage());
}
}
@Override
public String getName() {
return "JSON";
}
}.queue(files));
jobs.add(new ParallelQueueJob<File>() {
@Override
public void execute(File f) {
@ -543,12 +524,16 @@ public class IrisProject {
if(o.getBlocks().isEmpty())
{
sender.sendMessage(C.RED + "IOB " + f.getPath() + " has 0 blocks!");
sender.sendMessageRaw("<hover:show_text:'Error:\n" +
"<yellow>" + f.getPath() +
"'><red>- IOB " + f.getName() + " has 0 blocks!");
}
if(o.getW() == 0 || o.getH() == 0 || o.getD() == 0)
{
sender.sendMessage(C.RED + "IOB " + f.getPath() + " is not 3D!");
sender.sendMessageRaw("<hover:show_text:'Error:\n" +
"<yellow>" + f.getPath() + "\n<red>The width height or depth has a zero in it (bad format)" +
"'><red>- IOB " + f.getName() + " is not 3D!");
}
} catch (IOException e) {
e.printStackTrace();
@ -560,6 +545,30 @@ public class IrisProject {
return "IOB";
}
}.queue(objects));
jobs.add(new ParallelQueueJob<File>() {
@Override
public void execute(File f) {
try {
JSONObject p = new JSONObject(IO.readAll(f));
fixBlocks(p);
scanForErrors(data, f, p, sender);
IO.writeAll(f, p.toString(4));
} catch (Throwable e) {
sender.sendMessageRaw("<hover:show_text:'Error:\n" +
"<yellow>" + f.getPath() +
"\n<red>" +e.getMessage() +
"'><red>- JSON Error " + f.getName());
}
}
@Override
public String getName() {
return "JSON";
}
}.queue(files));
new JobCollection("Compile", jobs).execute(sender);
}
@ -569,14 +578,28 @@ public class IrisProject {
if(loader == null)
{
sender.sendMessage("Can't find loader for " + f.getPath());
sender.sendMessageBasic("Can't find loader for " + f.getPath());
return;
}
IrisRegistrant load = loader.load(key);
compare(load.getClass(), p, sender, new KList<>());
load.scanForErrors(p, sender);
}
public void compare(Class<?> c, JSONObject j, VolmitSender sender, KList<String> path)
{
try
{
Object o = c.getClass().getConstructor().newInstance();
}
catch(Throwable e)
{
}
}
public void files(File clean, KList<File> files) {
if (clean.isDirectory()) {
for (File i : clean.listFiles()) {

View File

@ -114,9 +114,9 @@ public class PlannedStructure {
int xx = i.getPosition().getX() + sx;
int zz = i.getPosition().getZ() + sz;
int offset = i.getPosition().getY() - startHeight;
int height = (i.getStructure().getStructure().getLockY() != -1
? i.getStructure().getStructure().getLockY()
: placer.getHighest(xx, zz, getData())) + offset + (v.getH() / 2);
int height = (i.getStructure().getStructure().getLockY() == -1 ? i.getStructure().getStructure().getOverrideYRange() != null
? (int)i.getStructure().getStructure().getOverrideYRange().get(rng, xx, zz, getData())
: i.getStructure().getStructure().getLockY() : placer.getHighest(xx, zz, getData())) + offset + (v.getH() / 2);
if (options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum()) {
height = -1;

View File

@ -23,6 +23,7 @@ import com.volmit.iris.core.project.loader.IrisRegistrant;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.engine.object.feature.IrisFeature;
import com.volmit.iris.engine.object.noise.IrisStyledRange;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.json.JSONObject;
import com.volmit.iris.util.plugin.VolmitSender;
@ -61,7 +62,10 @@ public class IrisJigsawStructure extends IrisRegistrant {
@Desc("If set to true, iris will look for any pieces with only one connector in valid pools for edge connectors and attach them to 'terminate' the paths/piece connectors. Essentially it caps off ends. For example in a village, Iris would add houses to the ends of roads where possible. For terminators to be selected, they can only have one connector or they wont be chosen.")
private boolean terminate = true;
@Desc("Set to lock the starting peice to a y coordinate, otherwise the surface will be used.")
@Desc("Override the y range instead of placing on the height map")
private IrisStyledRange overrideYRange = null;
@Desc("Force Y to a specific value")
private int lockY = -1;
private transient AtomicCache<Integer> maxDimension = new AtomicCache<>();

View File

@ -26,8 +26,6 @@ import com.volmit.iris.util.scheduling.ChronoLatch;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
import it.unimi.dsi.fastutil.ints.IntSet;
import it.unimi.dsi.fastutil.ints.IntSets;
import it.unimi.dsi.fastutil.objects.ReferenceLinkedOpenHashSet;
import it.unimi.dsi.fastutil.objects.ReferenceSet;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
@ -64,8 +62,6 @@ public class B {
ALLIUM,
AZURE_BLUET,
BLUE_ORCHID,
POPPY,
DANDELION,
OXEYE_DAISY,
LILY_OF_THE_VALLEY,
WITHER_ROSE,
@ -91,7 +87,6 @@ public class B {
private static IntSet buildDecorantCache() {
IntSet b = new IntOpenHashSet();
Arrays.stream(new Material[]{
GRASS,
TALL_GRASS,
FERN,
@ -147,6 +142,7 @@ public class B {
TORCH,
SOUL_TORCH
}).forEach((i) -> b.add(i.ordinal()));
b.addAll(foliageCache);
return IntSets.unmodifiable(b);
}
@ -168,6 +164,7 @@ public class B {
JACK_O_LANTERN,
REDSTONE_LAMP,
MAGMA_BLOCK,
LIGHT,
SHROOMLIGHT,
SEA_LANTERN,
SOUL_LANTERN,
@ -184,7 +181,8 @@ public class B {
private static IntSet buildStorageCache() {
IntSet b = new IntOpenHashSet();
Arrays.stream(new Material[]{
CHEST, SMOKER,
CHEST,
SMOKER,
TRAPPED_CHEST,
SHULKER_BOX,
WHITE_SHULKER_BOX,
@ -230,7 +228,9 @@ public class B {
}
}
if (onto.equals(Material.AIR) || onto.equals(B.getMaterial("CAVE_AIR")) || onto.equals(B.getMaterial("VOID_AIR"))) {
if (onto.equals(Material.AIR) ||
onto.equals(B.getMaterial("CAVE_AIR"))
|| onto.equals(B.getMaterial("VOID_AIR"))) {
return false;
}

View File

@ -309,6 +309,9 @@ public class VolmitSender implements CommandSender {
}
}
public void sendMessageBasic(String message) {
s.sendMessage(C.translateAlternateColorCodes('&', getTag() + message));
}
public void sendMessageRaw(String message) {
if (message.contains("<NOMINI>")) {