Merge remote-tracking branch 'origin/master'

This commit is contained in:
Daniel Mills 2021-07-22 19:23:35 -04:00
commit 80136b4aff
4 changed files with 35 additions and 13 deletions

View File

@ -171,7 +171,7 @@ public class ProjectManager {
Iris.info("Assuming URL " + url); Iris.info("Assuming URL " + url);
String branch = "master"; String branch = "master";
String[] nodes = url.split("\\Q/\\E"); String[] nodes = url.split("\\Q/\\E");
String repo = nodes[0] + "/" + nodes[1]; String repo = nodes.length == 1 ? "IrisDimensions/" + nodes[0] : nodes[0] + "/" + nodes[1];
branch = nodes.length > 2 ? nodes[2] : branch; branch = nodes.length > 2 ? nodes[2] : branch;
download(sender, repo, branch, trim, forceOverwrite); download(sender, repo, branch, trim, forceOverwrite);
} catch (Throwable e) { } catch (Throwable e) {
@ -192,6 +192,13 @@ public class ProjectManager {
File temp = Iris.getTemp(); File temp = Iris.getTemp();
File work = new File(temp, "dl-" + UUID.randomUUID()); File work = new File(temp, "dl-" + UUID.randomUUID());
File packs = getWorkspaceFolder(); File packs = getWorkspaceFolder();
if (zip == null || !zip.exists()) {
sender.sendMessage("Failed to find pack at " + url);
sender.sendMessage("Make sure you specified the correct repo and branch!");
sender.sendMessage("For example: /iris download IrisDimensions/overworld branch=master");
return;
}
sender.sendMessage("Unpacking " + repo); sender.sendMessage("Unpacking " + repo);
try { try {
ZipUtil.unpack(zip, work); ZipUtil.unpack(zip, work);

View File

@ -25,6 +25,8 @@ import com.volmit.iris.util.plugin.MortarCommand;
import com.volmit.iris.util.plugin.VolmitSender; import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.J;
import java.util.Arrays;
public class CommandIrisDownload extends MortarCommand { public class CommandIrisDownload extends MortarCommand {
public CommandIrisDownload() { public CommandIrisDownload() {
super("download", "down", "dl"); super("download", "down", "dl");
@ -42,28 +44,44 @@ public class CommandIrisDownload extends MortarCommand {
@Override @Override
public boolean handle(VolmitSender sender, String[] args) { public boolean handle(VolmitSender sender, String[] args) {
if (args.length < 1) { if (args.length < 1) {
sender.sendMessage("/iris dl " + C.BOLD + "<NAME>"); sender.sendMessage("/iris dl " + C.BOLD + "<NAME> [BRANCH=master]");
return true; return true;
} }
boolean trim = false; boolean trim = false;
String branch = "master";
for (String i : args) { for (String i : Arrays.copyOfRange(args, 1, args.length)) {
if (i.equals("-t") || i.equals("--trim")) { if (i.equals("-t") || i.equals("--trim")) {
trim = true; trim = true;
break; break;
} else if (i.startsWith("-")) {
sender.sendMessage("Invalid parameter.");
sender.sendMessage("/iris dl " + C.BOLD + "<NAME> [BRANCH=master]");
return true;
} else {
branch = i;
if (branch.toLowerCase().startsWith("branch=")) branch = branch.substring(7);
} }
} }
boolean btrim = trim; boolean btrim = trim;
J.a(() -> Iris.proj.downloadSearch(sender, args[0], btrim)); String pack = args[0];
if (!pack.contains("/")) {
pack = "IrisDimensions/" + pack;
}
final String finalPack = pack + "/" + branch;
J.a(() -> Iris.proj.downloadSearch(sender, finalPack, btrim));
return true; return true;
} }
@Override @Override
protected String getArgsUsage() { protected String getArgsUsage() {
return "<name> [-t/--trim]"; return "<name> [branch=master] [-t/--trim]";
} }
} }

View File

@ -50,7 +50,6 @@ public class IrisGenerator extends IrisRegistrant {
@Desc("The opacity, essentially a multiplier on the output.") @Desc("The opacity, essentially a multiplier on the output.")
private double opacity = 1; private double opacity = 1;
@Desc("Multiply the compsites instead of adding them") @Desc("Multiply the compsites instead of adding them")
private boolean multiplicitive = false; private boolean multiplicitive = false;
@ -80,12 +79,10 @@ public class IrisGenerator extends IrisRegistrant {
private double offsetZ = 0; private double offsetZ = 0;
@Required @Required
@Desc("The seed for this generator") @Desc("The seed for this generator")
private long seed = 1; private long seed = 1;
@Required @Required
@Desc("The interpolator to use when smoothing this generator into other regions & generators") @Desc("The interpolator to use when smoothing this generator into other regions & generators")
private IrisInterpolator interpolator = new IrisInterpolator(); private IrisInterpolator interpolator = new IrisInterpolator();
@ -227,12 +224,11 @@ public class IrisGenerator extends IrisRegistrant {
} }
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ); int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
double h = 0; double h = multiplicitive ? 1 : 0;
double tp = multiplicitive ? 1 : 0; double tp = 0;
for (IrisNoiseGenerator i : composite) { for (IrisNoiseGenerator i : composite) {
if (multiplicitive) { if (multiplicitive) {
tp *= i.getOpacity();
h *= i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom); h *= i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
} else { } else {
tp += i.getOpacity(); tp += i.getOpacity();

View File

@ -23,6 +23,7 @@ import com.volmit.iris.engine.interpolation.IrisInterpolation;
import com.volmit.iris.engine.noise.CNG; import com.volmit.iris.engine.noise.CNG;
import com.volmit.iris.engine.object.annotations.ArrayType; import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc; import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.MaxNumber;
import com.volmit.iris.engine.object.annotations.MinNumber; import com.volmit.iris.engine.object.annotations.MinNumber;
import com.volmit.iris.engine.object.annotations.Required; import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
@ -48,6 +49,7 @@ public class IrisNoiseGenerator {
private boolean negative = false; private boolean negative = false;
@MinNumber(0) @MinNumber(0)
@MaxNumber(1)
@Desc("The output multiplier") @Desc("The output multiplier")
private double opacity = 1; private double opacity = 1;
@ -56,7 +58,7 @@ public class IrisNoiseGenerator {
private double offsetX = 0; private double offsetX = 0;
@Desc("Height output offset y") @Desc("Height output offset y. Avoid using with terrain generation.")
private double offsetY = 0; private double offsetY = 0;
@ -64,7 +66,6 @@ public class IrisNoiseGenerator {
private double offsetZ = 0; private double offsetZ = 0;
@Required @Required
@Desc("The seed") @Desc("The seed")
private long seed = 0; private long seed = 0;