mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-26 02:29:14 +00:00
Schema system
This commit is contained in:
@@ -7,25 +7,35 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.command.CommandIris;
|
||||
import com.volmit.iris.command.PermissionIris;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.post.Post;
|
||||
import com.volmit.iris.gen.post.PostFloatingNibDeleter;
|
||||
import com.volmit.iris.gen.post.PostNibSmoother;
|
||||
import com.volmit.iris.gen.post.PostPotholeFiller;
|
||||
import com.volmit.iris.gen.post.PostSlabber;
|
||||
import com.volmit.iris.gen.post.PostWallPatcher;
|
||||
import com.volmit.iris.gen.post.PostWaterlogger;
|
||||
import com.volmit.iris.object.DecorationPart;
|
||||
import com.volmit.iris.object.Dispersion;
|
||||
import com.volmit.iris.object.Envelope;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.StructureTileCondition;
|
||||
import com.volmit.iris.util.BiomeResult;
|
||||
import com.volmit.iris.util.BoardManager;
|
||||
import com.volmit.iris.util.BoardProvider;
|
||||
@@ -40,6 +50,7 @@ import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.IrisStructureResult;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.JSONArray;
|
||||
import com.volmit.iris.util.JSONException;
|
||||
import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.JarScanner;
|
||||
@@ -47,6 +58,7 @@ import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.MortarPlugin;
|
||||
import com.volmit.iris.util.Permission;
|
||||
import com.volmit.iris.util.Required;
|
||||
import com.volmit.iris.util.RollingSequence;
|
||||
import com.volmit.iris.util.ScoreDirection;
|
||||
|
||||
@@ -230,9 +242,9 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
|
||||
public void writeDocs() throws IOException, JSONException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException
|
||||
{
|
||||
JarScanner j = new JarScanner(getFile(), "ninja.bytecode.iris.object");
|
||||
JarScanner j = new JarScanner(getFile(), "com.volmit.iris.object");
|
||||
j.scan();
|
||||
File of = new File(getDataFolder(), "packs");
|
||||
File of = new File(getDataFolder(), "docs");
|
||||
of.mkdirs();
|
||||
KMap<String, String> files = new KMap<>();
|
||||
|
||||
@@ -240,7 +252,15 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
{
|
||||
if(i.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
JSONObject schema = new JSONObject();
|
||||
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
|
||||
schema.put("$id", "http://volmit.com/iris-schema/" + i.getSimpleName().toLowerCase() + ".json");
|
||||
schema.put("title", i.getSimpleName().replaceAll("\\QIris\\E", ""));
|
||||
schema.put("type", "object");
|
||||
|
||||
Desc d = i.getAnnotation(Desc.class);
|
||||
schema.put("description", d.value());
|
||||
|
||||
KList<String> page = new KList<>();
|
||||
page.add("# " + i.getSimpleName());
|
||||
page.add("> " + d.value());
|
||||
@@ -250,24 +270,160 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
page.add("```");
|
||||
|
||||
page.add("");
|
||||
|
||||
JSONObject properties = new JSONObject();
|
||||
JSONArray req = new JSONArray();
|
||||
|
||||
for(java.lang.reflect.Field k : i.getDeclaredFields())
|
||||
{
|
||||
JSONObject prop = new JSONObject();
|
||||
|
||||
if(k.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
page.add("## " + k.getName());
|
||||
page.add("> " + k.getAnnotation(Desc.class).value());
|
||||
page.add("");
|
||||
|
||||
String tp = "object";
|
||||
|
||||
if(k.getType().equals(int.class) || k.getType().equals(long.class))
|
||||
{
|
||||
tp = "integer";
|
||||
}
|
||||
|
||||
if(k.getType().equals(double.class) || k.getType().equals(float.class))
|
||||
{
|
||||
tp = "number";
|
||||
}
|
||||
|
||||
if(k.getType().equals(boolean.class))
|
||||
{
|
||||
tp = "boolean";
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class))
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class))
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().isEnum())
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().equals(KList.class))
|
||||
{
|
||||
tp = "array";
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(Required.class))
|
||||
{
|
||||
req.put(k.getName());
|
||||
}
|
||||
|
||||
prop.put("description", k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
}
|
||||
}
|
||||
|
||||
schema.put("properties", properties);
|
||||
schema.put("required", req);
|
||||
String pge = page.toString("\n");
|
||||
files.put(i.getSimpleName(), pge);
|
||||
files.put(i.getSimpleName() + ".md", pge);
|
||||
files.put("schema/" + i.getSimpleName() + ".json", schema.toString(4));
|
||||
}
|
||||
}
|
||||
|
||||
KList<String> m = new KList<>();
|
||||
|
||||
for(Biome i : Biome.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/biomes.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Particle i : Particle.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/particles.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Dispersion i : Dispersion.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/dispersion.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(DecorationPart i : DecorationPart.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/decoration-part.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Envelope i : Envelope.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/envelope.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Environment i : Environment.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/environment.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(StructureTileCondition i : StructureTileCondition.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/structure-tile-condition.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(InterpolationMethod i : InterpolationMethod.values())
|
||||
{
|
||||
m.add(i.name());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/interpolation-method.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Class<? extends IrisPostBlockFilter> i : Iris.postProcessors)
|
||||
{
|
||||
m.add(i.getDeclaredAnnotation(Post.class).value());
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/post-processors.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(PotionEffectType i : PotionEffectType.values())
|
||||
{
|
||||
m.add(i.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
|
||||
}
|
||||
|
||||
IO.writeAll(new File(of, "types/potion-effect.txt"), m.toString("\n"));
|
||||
|
||||
for(String i : files.k())
|
||||
{
|
||||
IO.writeAll(new File(of, i + ".md"), files.get(i));
|
||||
IO.writeAll(new File(of, i), files.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.volmit.iris;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -10,29 +11,40 @@ import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.object.InterpolationMethod;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisBiomeGeneratorLink;
|
||||
import com.volmit.iris.object.IrisBiomeMutation;
|
||||
import com.volmit.iris.object.IrisDimension;
|
||||
import com.volmit.iris.object.IrisGenerator;
|
||||
import com.volmit.iris.object.IrisNoiseGenerator;
|
||||
import com.volmit.iris.object.IrisObjectPlacement;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.object.IrisStructure;
|
||||
import com.volmit.iris.object.IrisStructureTile;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.IO;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.JSONArray;
|
||||
import com.volmit.iris.util.JSONException;
|
||||
import com.volmit.iris.util.JSONObject;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.M;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
import com.volmit.iris.util.O;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -71,6 +83,8 @@ public class ProjectManager
|
||||
{
|
||||
if(i.getName().endsWith(".code-workspace"))
|
||||
{
|
||||
sender.sendMessage("Updating Workspace");
|
||||
updateWorkspace(i);
|
||||
Desktop.getDesktop().open(i);
|
||||
break;
|
||||
}
|
||||
@@ -404,4 +418,430 @@ public class ProjectManager
|
||||
sender.sendMessage("Failed!");
|
||||
return null;
|
||||
}
|
||||
|
||||
public void create(MortarSender sender, String s)
|
||||
{
|
||||
IrisDimension dimension = new IrisDimension();
|
||||
dimension.setLoadKey(s);
|
||||
dimension.setName(Form.capitalizeWords(s.replaceAll("\\Q-\\E", " ")));
|
||||
|
||||
if(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json").exists())
|
||||
{
|
||||
sender.sendMessage("Project Already Exists! Open it instead!");
|
||||
return;
|
||||
}
|
||||
sender.sendMessage("Creating New Project \"" + dimension.getName() + "\"...");
|
||||
IrisRegion exampleRegion = new IrisRegion();
|
||||
exampleRegion.setName("Example Region");
|
||||
exampleRegion.setLoadKey("example-region");
|
||||
IrisBiome exampleLand1 = new IrisBiome();
|
||||
exampleLand1.setName("Example Land 1");
|
||||
exampleLand1.setLoadKey("land-1");
|
||||
IrisBiome exampleShore1 = new IrisBiome();
|
||||
exampleShore1.setName("Example Shore");
|
||||
exampleShore1.setLoadKey("shore");
|
||||
IrisBiome exampleOcean1 = new IrisBiome();
|
||||
exampleOcean1.setName("Example Sea");
|
||||
exampleOcean1.setLoadKey("sea");
|
||||
IrisBiome exampleLand2 = new IrisBiome();
|
||||
exampleLand2.setName("Example Land 2");
|
||||
exampleLand2.setLoadKey("land-2");
|
||||
exampleLand2.setRarity(4);
|
||||
dimension.setSeaZoom(1);
|
||||
dimension.setLandZoom(1.5);
|
||||
IrisGenerator gen = new IrisGenerator();
|
||||
IrisNoiseGenerator gg = new IrisNoiseGenerator(true);
|
||||
gen.setInterpolationFunction(InterpolationMethod.HERMITE);
|
||||
gen.setInterpolationScale(185);
|
||||
gen.getComposite().add(gg);
|
||||
gen.setLoadKey("example-generator");
|
||||
IrisBiomeGeneratorLink b1 = new IrisBiomeGeneratorLink();
|
||||
b1.setGenerator(gen.getLoadKey());
|
||||
b1.setMin(3);
|
||||
b1.setMax(7);
|
||||
IrisBiomeGeneratorLink b2 = new IrisBiomeGeneratorLink();
|
||||
b2.setGenerator(gen.getLoadKey());
|
||||
b2.setMin(12);
|
||||
b2.setMax(35);
|
||||
IrisBiomeGeneratorLink b3 = new IrisBiomeGeneratorLink();
|
||||
b3.setGenerator(gen.getLoadKey());
|
||||
b3.setMin(-1);
|
||||
b3.setMax(1);
|
||||
IrisBiomeGeneratorLink b4 = new IrisBiomeGeneratorLink();
|
||||
b4.setGenerator(gen.getLoadKey());
|
||||
b4.setMin(-5);
|
||||
b4.setMax(-38);
|
||||
exampleLand2.getLayers().get(0).getPalette().clear();
|
||||
exampleLand2.getLayers().get(0).getPalette().add("RED_SAND");
|
||||
exampleShore1.getLayers().get(0).getPalette().clear();
|
||||
exampleShore1.getLayers().get(0).getPalette().add("SAND");
|
||||
exampleOcean1.getLayers().get(0).getPalette().clear();
|
||||
exampleOcean1.getLayers().get(0).getPalette().add("SAND");
|
||||
exampleLand1.getGenerators().clear();
|
||||
exampleLand1.getGenerators().add(b1);
|
||||
exampleLand2.getGenerators().clear();
|
||||
exampleLand2.getGenerators().add(b2);
|
||||
exampleShore1.getGenerators().clear();
|
||||
exampleShore1.getGenerators().add(b3);
|
||||
exampleOcean1.getGenerators().clear();
|
||||
exampleOcean1.getGenerators().add(b4);
|
||||
exampleRegion.getLandBiomes().add(exampleLand1.getLoadKey());
|
||||
exampleRegion.getLandBiomes().add(exampleLand2.getLoadKey());
|
||||
exampleRegion.getShoreBiomes().add(exampleShore1.getLoadKey());
|
||||
exampleRegion.getSeaBiomes().add(exampleOcean1.getLoadKey());
|
||||
dimension.getRegions().add(exampleRegion.getLoadKey());
|
||||
|
||||
try
|
||||
{
|
||||
JSONObject ws = newWorkspaceConfig();
|
||||
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(dimension)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "regions", exampleRegion.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleRegion)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleLand1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand1)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleLand2.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand2)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleShore1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleShore1)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleOcean1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleOcean1)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "generators", gen.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(gen)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), dimension.getLoadKey() + ".code-workspace"), ws.toString(4));
|
||||
Iris.proj.open(sender, dimension.getName());
|
||||
}
|
||||
|
||||
catch(JSONException | IOException e)
|
||||
{
|
||||
sender.sendMessage("Failed! Check the console.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private JSONObject newWorkspaceConfig()
|
||||
{
|
||||
JSONObject ws = new JSONObject();
|
||||
JSONArray folders = new JSONArray();
|
||||
JSONObject folder = new JSONObject();
|
||||
folder.put("path", ".");
|
||||
folders.put(folder);
|
||||
ws.put("folders", folders);
|
||||
|
||||
JSONObject settings = new JSONObject();
|
||||
settings.put("workbench.colorTheme", "Monokai");
|
||||
settings.put("workbench.preferredDarkColorTheme", "Solarized Dark");
|
||||
settings.put("workbench.tips.enabled", false);
|
||||
settings.put("workbench.tree.indent", 24);
|
||||
settings.put("files.autoSave", "onFocusChange");
|
||||
|
||||
JSONArray schemas = buildSchemas();
|
||||
settings.put("json.schemas", schemas);
|
||||
ws.put("settings", settings);
|
||||
|
||||
return ws;
|
||||
}
|
||||
|
||||
public void updateWorkspace(File ws)
|
||||
{
|
||||
try
|
||||
{
|
||||
JSONObject j = new JSONObject(IO.readAll(ws));
|
||||
JSONObject s = j.getJSONObject("settings");
|
||||
s.put("json.schemas", buildSchemas());
|
||||
j.put("settings", s);
|
||||
IO.writeAll(ws, j.toString(4));
|
||||
Iris.info("Updating Project " + ws.getAbsolutePath());
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
Iris.warn("Project invalid: " + ws.getAbsolutePath() + " Re-creating. You may loose some vs-code workspace settings! But not your actual project!");
|
||||
|
||||
try
|
||||
{
|
||||
IO.writeAll(ws, newWorkspaceConfig());
|
||||
}
|
||||
|
||||
catch(IOException e1)
|
||||
{
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private JSONArray buildSchemas()
|
||||
{
|
||||
JSONArray schemas = new JSONArray();
|
||||
schemas.put(getSchemaEntry(IrisDimension.class, "/dimensions/*.json"));
|
||||
schemas.put(getSchemaEntry(IrisBiome.class, "/biomes/*.json"));
|
||||
schemas.put(getSchemaEntry(IrisRegion.class, "/regions/*.json"));
|
||||
schemas.put(getSchemaEntry(IrisGenerator.class, "/generators/*.json"));
|
||||
schemas.put(getSchemaEntry(IrisStructure.class, "/structures/*.json"));
|
||||
return schemas;
|
||||
}
|
||||
|
||||
public JSONObject getSchemaEntry(Class<?> i, String... fileMatch)
|
||||
{
|
||||
JSONObject o = new JSONObject();
|
||||
o.put("fileMatch", new JSONArray(fileMatch));
|
||||
o.put("schema", getSchemaFor(i));
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
public JSONObject getSchemaFor(Class<?> i)
|
||||
{
|
||||
KMap<String, JSONObject> def = new KMap<>();
|
||||
JSONObject s = getSchemaFor(i, 7, def);
|
||||
JSONObject defx = new JSONObject();
|
||||
for(String v : def.k())
|
||||
{
|
||||
defx.put(v, def.get(v));
|
||||
}
|
||||
|
||||
s.put("definitions", defx);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
public JSONObject getSchemaFor(Class<?> i, int step, KMap<String, JSONObject> def)
|
||||
{
|
||||
if(step <= 0)
|
||||
{
|
||||
JSONObject m = new JSONObject();
|
||||
m.put("properties", new JSONObject());
|
||||
return m;
|
||||
}
|
||||
|
||||
JSONObject schema = new JSONObject();
|
||||
if(i.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
|
||||
schema.put("$id", "http://volmit.com/iris-schema/" + i.getSimpleName().toLowerCase() + ".json");
|
||||
schema.put("title", i.getSimpleName().replaceAll("\\QIris\\E", ""));
|
||||
schema.put("type", "object");
|
||||
|
||||
Desc d = i.getAnnotation(Desc.class);
|
||||
schema.put("description", d.value());
|
||||
|
||||
JSONObject properties = new JSONObject();
|
||||
JSONArray req = new JSONArray();
|
||||
|
||||
for(java.lang.reflect.Field k : i.getDeclaredFields())
|
||||
{
|
||||
JSONObject prop = new JSONObject();
|
||||
|
||||
if(k.isAnnotationPresent(Desc.class))
|
||||
{
|
||||
String tp = "object";
|
||||
|
||||
if(k.getType().equals(int.class) || k.getType().equals(long.class))
|
||||
{
|
||||
tp = "integer";
|
||||
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("minimum", (int) k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("maximum", (int) k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
}
|
||||
|
||||
if(k.getType().equals(double.class) || k.getType().equals(float.class))
|
||||
{
|
||||
tp = "number";
|
||||
|
||||
if(k.isAnnotationPresent(MinNumber.class))
|
||||
{
|
||||
prop.put("minimum", k.getDeclaredAnnotation(MinNumber.class).value());
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(MaxNumber.class))
|
||||
{
|
||||
prop.put("maximum", k.getDeclaredAnnotation(MaxNumber.class).value());
|
||||
}
|
||||
}
|
||||
|
||||
if(k.getType().equals(boolean.class))
|
||||
{
|
||||
tp = "boolean";
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class))
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class))
|
||||
{
|
||||
tp = "string";
|
||||
}
|
||||
|
||||
if(k.getType().isEnum())
|
||||
{
|
||||
tp = "string";
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(Object gg : k.getType().getEnumConstants())
|
||||
{
|
||||
a.put(((Enum<?>) gg).name());
|
||||
}
|
||||
|
||||
prop.put("enum", a);
|
||||
}
|
||||
|
||||
if(k.getType().equals(String.class) && k.getName().equals("potionEffect"))
|
||||
{
|
||||
tp = "string";
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(PotionEffectType gg : PotionEffectType.values())
|
||||
{
|
||||
a.put(gg.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
|
||||
}
|
||||
|
||||
prop.put("enum", a);
|
||||
}
|
||||
|
||||
if(k.getType().equals(KList.class))
|
||||
{
|
||||
tp = "array";
|
||||
}
|
||||
|
||||
if(k.isAnnotationPresent(Required.class))
|
||||
{
|
||||
req.put(k.getName());
|
||||
}
|
||||
|
||||
if(tp.equals("object"))
|
||||
{
|
||||
if(k.getType().isAnnotationPresent(Desc.class))
|
||||
{
|
||||
prop.put("properties", getSchemaFor(k.getType(), step - 1, def).getJSONObject("properties"));
|
||||
}
|
||||
}
|
||||
|
||||
if(tp.equals("array"))
|
||||
{
|
||||
ArrayType t = k.getDeclaredAnnotation(ArrayType.class);
|
||||
|
||||
if(t.min() > 0)
|
||||
{
|
||||
prop.put("minItems", t.min());
|
||||
}
|
||||
|
||||
if(t != null)
|
||||
{
|
||||
String tx = "object";
|
||||
|
||||
if(t.type().equals(int.class) || k.getType().equals(long.class))
|
||||
{
|
||||
tx = "integer";
|
||||
}
|
||||
|
||||
if(t.type().equals(double.class) || k.getType().equals(float.class))
|
||||
{
|
||||
tx = "number";
|
||||
}
|
||||
|
||||
if(t.type().equals(boolean.class))
|
||||
{
|
||||
tx = "boolean";
|
||||
}
|
||||
|
||||
if(t.type().equals(String.class))
|
||||
{
|
||||
tx = "string";
|
||||
}
|
||||
|
||||
if(t.type().isEnum())
|
||||
{
|
||||
tx = "string";
|
||||
JSONArray a = new JSONArray();
|
||||
|
||||
for(Object gg : t.type().getEnumConstants())
|
||||
{
|
||||
a.put(((Enum<?>) gg).name());
|
||||
}
|
||||
|
||||
String name = "enum" + t.type().getSimpleName().toLowerCase();
|
||||
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
deff.put("type", tx);
|
||||
deff.put("enum", a);
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
prop.put("items", items);
|
||||
}
|
||||
|
||||
if(t.type().isEnum())
|
||||
{
|
||||
tx = "string";
|
||||
}
|
||||
|
||||
if(t.type().equals(KList.class))
|
||||
{
|
||||
tx = "array";
|
||||
}
|
||||
|
||||
JSONObject items = new JSONObject();
|
||||
|
||||
if(tx.equals("object"))
|
||||
{
|
||||
if(t.type().isAnnotationPresent(Desc.class))
|
||||
{
|
||||
String name = t.type().getSimpleName().toLowerCase();
|
||||
|
||||
if(!def.containsKey(name))
|
||||
{
|
||||
JSONObject deff = new JSONObject();
|
||||
JSONObject scv = getSchemaFor(t.type(), step - 1, def);
|
||||
deff.put("type", tx);
|
||||
deff.put("description", t.type().getDeclaredAnnotation(Desc.class).value());
|
||||
deff.put("properties", scv.getJSONObject("properties"));
|
||||
if(scv.has("required"))
|
||||
{
|
||||
deff.put("required", scv.getJSONArray("required"));
|
||||
}
|
||||
def.put(name, deff);
|
||||
}
|
||||
|
||||
items.put("$ref", "#/definitions/" + name);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
items.put("type", tx);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
items.put("type", tx);
|
||||
}
|
||||
|
||||
prop.put("items", items);
|
||||
}
|
||||
|
||||
if(tp.getClass().isAnnotationPresent(Desc.class))
|
||||
{
|
||||
prop.put("properties", getSchemaFor(tp.getClass(), step - 1, def).getJSONObject("properties"));
|
||||
}
|
||||
}
|
||||
|
||||
prop.put("description", k.getAnnotation(Desc.class).value());
|
||||
prop.put("type", tp);
|
||||
properties.put(k.getName(), prop);
|
||||
}
|
||||
}
|
||||
|
||||
schema.put("properties", properties);
|
||||
schema.put("required", req);
|
||||
}
|
||||
|
||||
return schema;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CommandIrisGoto extends MortarCommand
|
||||
}
|
||||
}
|
||||
|
||||
IrisBiome biome = g.loadBiome(args[0]);
|
||||
IrisBiome biome = args[0].equals("this") ? g.sampleTrueBiome(p.getLocation().getBlockX(), p.getLocation().getBlockZ()).getBiome() : g.loadBiome(args[0]);
|
||||
|
||||
if(biome == null)
|
||||
{
|
||||
|
||||
@@ -31,6 +31,13 @@ public class CommandIrisObjectSave extends MortarCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
if(args.length < 2)
|
||||
{
|
||||
sender.sendMessage("/iris o save <PROJECT> <object>");
|
||||
sender.sendMessage("I.e. /iris o save overworld some-tree/tree1");
|
||||
return true;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
boolean overwrite = false;
|
||||
|
||||
@@ -40,95 +40,7 @@ public class CommandIrisStudioCreate extends MortarCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
IrisDimension dimension = new IrisDimension();
|
||||
dimension.setLoadKey(args[0]);
|
||||
dimension.setName(Form.capitalizeWords(args[0].replaceAll("\\Q-\\E", " ")));
|
||||
|
||||
if(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json").exists())
|
||||
{
|
||||
sender.sendMessage("Project Already Exists! Open it instead!");
|
||||
return true;
|
||||
}
|
||||
sender.sendMessage("Creating New Project \"" + dimension.getName() + "\"...");
|
||||
IrisRegion exampleRegion = new IrisRegion();
|
||||
exampleRegion.setName("Example Region");
|
||||
exampleRegion.setLoadKey("example-region");
|
||||
IrisBiome exampleLand1 = new IrisBiome();
|
||||
exampleLand1.setName("Example Land 1");
|
||||
exampleLand1.setLoadKey("land-1");
|
||||
IrisBiome exampleShore1 = new IrisBiome();
|
||||
exampleShore1.setName("Example Shore");
|
||||
exampleShore1.setLoadKey("shore");
|
||||
IrisBiome exampleOcean1 = new IrisBiome();
|
||||
exampleOcean1.setName("Example Sea");
|
||||
exampleOcean1.setLoadKey("sea");
|
||||
IrisBiome exampleLand2 = new IrisBiome();
|
||||
exampleLand2.setName("Example Land 2");
|
||||
exampleLand2.setLoadKey("land-2");
|
||||
exampleLand2.setRarity(4);
|
||||
dimension.setSeaZoom(1);
|
||||
dimension.setLandZoom(1.5);
|
||||
IrisGenerator gen = new IrisGenerator();
|
||||
IrisNoiseGenerator gg = new IrisNoiseGenerator(true);
|
||||
gen.setInterpolationFunction(InterpolationMethod.HERMITE);
|
||||
gen.setInterpolationScale(185);
|
||||
gen.getComposite().add(gg);
|
||||
gen.setLoadKey("example-generator");
|
||||
IrisBiomeGeneratorLink b1 = new IrisBiomeGeneratorLink();
|
||||
b1.setGenerator(gen.getLoadKey());
|
||||
b1.setMin(3);
|
||||
b1.setMax(7);
|
||||
IrisBiomeGeneratorLink b2 = new IrisBiomeGeneratorLink();
|
||||
b2.setGenerator(gen.getLoadKey());
|
||||
b2.setMin(12);
|
||||
b2.setMax(35);
|
||||
IrisBiomeGeneratorLink b3 = new IrisBiomeGeneratorLink();
|
||||
b3.setGenerator(gen.getLoadKey());
|
||||
b3.setMin(-1);
|
||||
b3.setMax(1);
|
||||
IrisBiomeGeneratorLink b4 = new IrisBiomeGeneratorLink();
|
||||
b4.setGenerator(gen.getLoadKey());
|
||||
b4.setMin(-5);
|
||||
b4.setMax(-38);
|
||||
exampleLand2.getLayers().get(0).getPalette().clear();
|
||||
exampleLand2.getLayers().get(0).getPalette().add("RED_SAND");
|
||||
exampleShore1.getLayers().get(0).getPalette().clear();
|
||||
exampleShore1.getLayers().get(0).getPalette().add("SAND");
|
||||
exampleOcean1.getLayers().get(0).getPalette().clear();
|
||||
exampleOcean1.getLayers().get(0).getPalette().add("SAND");
|
||||
exampleLand1.getGenerators().clear();
|
||||
exampleLand1.getGenerators().add(b1);
|
||||
exampleLand2.getGenerators().clear();
|
||||
exampleLand2.getGenerators().add(b2);
|
||||
exampleShore1.getGenerators().clear();
|
||||
exampleShore1.getGenerators().add(b3);
|
||||
exampleOcean1.getGenerators().clear();
|
||||
exampleOcean1.getGenerators().add(b4);
|
||||
exampleRegion.getLandBiomes().add(exampleLand1.getLoadKey());
|
||||
exampleRegion.getLandBiomes().add(exampleLand2.getLoadKey());
|
||||
exampleRegion.getShoreBiomes().add(exampleShore1.getLoadKey());
|
||||
exampleRegion.getSeaBiomes().add(exampleOcean1.getLoadKey());
|
||||
dimension.getRegions().add(exampleRegion.getLoadKey());
|
||||
|
||||
try
|
||||
{
|
||||
String g = "{\"folders\": [{\"path\": \".\"}],\"settings\": {\"workbench.colorTheme\": \"Monokai\",\"workbench.preferredHighContrastColorTheme\": \"Solarized Dark\",\"workbench.preferredDarkColorTheme\": \"Solarized Dark\",\"workbench.statusBar.visible\": false,\"workbench.tips.enabled\": false,\"workbench.tree.indent\": 24,\"files.autoSave\": \"onFocusChange\"}}";
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "dimensions", dimension.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(dimension)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "regions", exampleRegion.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleRegion)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleLand1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand1)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleLand2.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleLand2)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleShore1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleShore1)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "biomes", exampleOcean1.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(exampleOcean1)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), "generators", gen.getLoadKey() + ".json"), new JSONObject(new Gson().toJson(gen)).toString(4));
|
||||
IO.writeAll(Iris.instance.getDataFile("packs", dimension.getLoadKey(), dimension.getLoadKey() + ".code-workspace"), new JSONObject(g).toString(4));
|
||||
Iris.proj.open(sender, dimension.getName());
|
||||
}
|
||||
|
||||
catch(JSONException | IOException e)
|
||||
{
|
||||
sender.sendMessage("Failed! Check the console.");
|
||||
e.printStackTrace();
|
||||
}
|
||||
Iris.proj.create(sender, args[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.io.File;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.object.InferredType;
|
||||
@@ -33,6 +34,16 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
|
||||
this.dimensionName = dimensionName;
|
||||
}
|
||||
|
||||
public void onPlayerLeft(Player p)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onTick(int m)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void onInit(World world, RNG masterRandom)
|
||||
{
|
||||
if(dimensionName.isEmpty())
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@@ -11,6 +12,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.IrisContext;
|
||||
import com.volmit.iris.gen.atomics.AtomicRegionData;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.object.IrisEffect;
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.BiomeResult;
|
||||
import com.volmit.iris.util.CNG;
|
||||
@@ -87,9 +89,25 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onTick(int ticks)
|
||||
public void onTick(int ticks)
|
||||
{
|
||||
super.onTick(ticks);
|
||||
for(Player i : getWorld().getPlayers())
|
||||
{
|
||||
Location l = i.getLocation();
|
||||
IrisRegion r = sampleRegion(l.getBlockX(), l.getBlockZ());
|
||||
IrisBiome b = sampleTrueBiome(l.getBlockX(), l.getBlockY(), l.getBlockZ()).getBiome();
|
||||
|
||||
for(IrisEffect j : r.getEffects())
|
||||
{
|
||||
j.apply(i, this);
|
||||
}
|
||||
|
||||
for(IrisEffect j : b.getEffects())
|
||||
{
|
||||
j.apply(i, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,9 +165,9 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPlayerLeft(Player p)
|
||||
public void onPlayerLeft(Player p)
|
||||
{
|
||||
|
||||
super.onPlayerLeft(p);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,6 +220,6 @@ public class IrisChunkGenerator extends CeilingChunkGenerator implements IrisCon
|
||||
@Override
|
||||
public boolean shouldGenerateStructures()
|
||||
{
|
||||
return false;
|
||||
return getDimension().isVanillaStructures();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,9 @@ package com.volmit.iris.object;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.M;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -14,14 +17,23 @@ public class IrisAxisRotationClamp
|
||||
@Desc("Should this axis be rotated at all?")
|
||||
private boolean enabled = false;
|
||||
|
||||
@Required
|
||||
@MinNumber(-360)
|
||||
@MaxNumber(360)
|
||||
@DontObfuscate
|
||||
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees")
|
||||
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
||||
private double min = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-360)
|
||||
@MaxNumber(360)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees")
|
||||
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
|
||||
private double max = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(360)
|
||||
@DontObfuscate
|
||||
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees")
|
||||
private double interval = 0;
|
||||
|
||||
@@ -6,14 +6,18 @@ import org.bukkit.block.data.BlockData;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IRare;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.RarityCellGenerator;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -24,14 +28,21 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisBiome extends IrisRegistrant implements IRare
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("This is the human readable name for this biome. This can and should be different than the file name. This is not used for loading biomes in other objects.")
|
||||
private String name = "A Biome";
|
||||
|
||||
@ArrayType(min = 1, type = IrisEffect.class)
|
||||
@DontObfuscate
|
||||
@Desc("The name of the region")
|
||||
private KList<IrisEffect> effects = new KList<>();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen")
|
||||
private Dispersion biomeDispersion = Dispersion.SCATTER;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("This zooms in the biome colors if multiple derivatives are chosen")
|
||||
private double biomeZoom = 1;
|
||||
@@ -40,18 +51,23 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
@Desc("Layers no longer descend from the surface block, they descend from the max possible height the biome can produce (constant) creating mesa like layers.")
|
||||
private boolean lockLayers = false;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("The rarity of this biome (integer)")
|
||||
private int rarity = 1;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The raw derivative of this biome. This is required or the terrain will not properly generate. Use any vanilla biome type. Look in examples/biome-list.txt")
|
||||
private Biome derivative = Biome.THE_VOID;
|
||||
|
||||
@ArrayType(min = 1, type = Biome.class)
|
||||
@DontObfuscate
|
||||
@Desc("You can instead specify multiple biome derivatives to randomly scatter colors in this biome")
|
||||
private KList<Biome> biomeScatter = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = Biome.class)
|
||||
@DontObfuscate
|
||||
@Desc("Since 1.13 supports 3D biomes, you can add different derivative colors for anything above the terrain. (Think swampy tree leaves with a desert looking grass surface)")
|
||||
private KList<Biome> biomeSkyScatter = new KList<>();
|
||||
@@ -60,6 +76,7 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
@Desc("If this biome has children biomes, and the gen layer chooses one of this biomes children, how much smaller will it be (inside of this biome). Higher values means a smaller biome relative to this biome's size. Set higher than 1.0 and below 3.0 for best results.")
|
||||
private double childShrinkFactor = 1.5;
|
||||
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("List any biome names (file names without.json) here as children. Portions of this biome can sometimes morph into their children. Iris supports cyclic relationships such as A > B > A > B. Iris will stop checking 9 biomes down the tree.")
|
||||
private KList<String> children = new KList<>();
|
||||
@@ -72,30 +89,39 @@ public class IrisBiome extends IrisRegistrant implements IRare
|
||||
@Desc("The default wall if iris decides to place a wall higher than 2 blocks (steep hills or possibly cliffs)")
|
||||
private IrisBiomePaletteLayer wall = new IrisBiomePaletteLayer().zero();
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
||||
@DontObfuscate
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
private KList<IrisBiomePaletteLayer> layers = new KList<IrisBiomePaletteLayer>().qadd(new IrisBiomePaletteLayer());
|
||||
|
||||
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
||||
@DontObfuscate
|
||||
@Desc("This defines the layers of materials in this biome. Each layer has a palette and min/max height and some other properties. Usually a grassy/sandy layer then a dirt layer then a stone layer. Iris will fill in the remaining blocks below your layers with stone.")
|
||||
private KList<IrisBiomePaletteLayer> seaLayers = new KList<IrisBiomePaletteLayer>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisBiomeDecorator.class)
|
||||
@DontObfuscate
|
||||
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
||||
private KList<IrisBiomeDecorator> decorators = new KList<IrisBiomeDecorator>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
||||
@DontObfuscate
|
||||
@Desc("Objects define what schematics (iob files) iris will place in this biome")
|
||||
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
|
||||
@DontObfuscate
|
||||
@Desc("Generators for this biome. Multiple generators with different interpolation sizes will mix with other biomes how you would expect. This defines your biome height relative to the fluid height. Use negative for oceans.")
|
||||
private KList<IrisBiomeGeneratorLink> generators = new KList<IrisBiomeGeneratorLink>().qadd(new IrisBiomeGeneratorLink());
|
||||
|
||||
@ArrayType(min = 1, type = IrisStructurePlacement.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of structure tilesets")
|
||||
private KList<IrisStructurePlacement> structures = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisDepositGenerator.class)
|
||||
@DontObfuscate
|
||||
@Desc("Define biome deposit generators that add onto the existing regional and global deposit generators")
|
||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||
|
||||
@@ -3,13 +3,17 @@ package com.volmit.iris.object;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -33,26 +37,37 @@ public class IrisBiomeDecorator
|
||||
@Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE or SEA_SURFACE")
|
||||
private DecorationPart partOf = DecorationPart.NONE;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
|
||||
private int stackMin = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum repeat stack height")
|
||||
private int stackMax = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("The zoom is for zooming in or out wispy dispersions. Makes patches bigger the higher this zoom value is/")
|
||||
private double zoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("The vertical zoom is for wispy stack heights. Zooming this in makes stack heights more slowly change over a distance")
|
||||
private double verticalZoom = 1;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The chance for this decorator to decorate at a given X,Y coordinate. This is hit 256 times per chunk (per surface block)")
|
||||
private double chance = 0.1;
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("The palette of blocks to pick from when this decorator needs to place.")
|
||||
private KList<String> palette = new KList<String>().qadd("GRASS");
|
||||
|
||||
@@ -6,6 +6,9 @@ import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -17,10 +20,16 @@ public class IrisBiomeGeneratorLink
|
||||
@Desc("The generator id")
|
||||
private String generator = "default";
|
||||
|
||||
@Required
|
||||
@MinNumber(-256)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The min block value (value + fluidHeight)")
|
||||
private int min = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-256)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The max block value (value + fluidHeight)")
|
||||
private int max = 0;
|
||||
|
||||
@@ -2,10 +2,14 @@ package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -13,22 +17,33 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisBiomeMutation
|
||||
{
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("One of The following biomes or regions must show up")
|
||||
private KList<String> sideA = new KList<>();
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("One of The following biomes or regions must show up")
|
||||
private KList<String> sideB = new KList<>();
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(1024)
|
||||
@DontObfuscate
|
||||
@Desc("The scan radius for placing this mutator")
|
||||
private int radius = 1;
|
||||
private int radius = 16;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(32)
|
||||
@DontObfuscate
|
||||
@Desc("How many tries per chunk to check for this mutation")
|
||||
private int checks = 2;
|
||||
|
||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
||||
@DontObfuscate
|
||||
@Desc("Objects define what schematics (iob files) iris will place in this biome mutation")
|
||||
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
|
||||
|
||||
@@ -3,12 +3,16 @@ package com.volmit.iris.object;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -20,18 +24,25 @@ public class IrisBiomePaletteLayer
|
||||
@Desc("The dispersion of materials from the palette")
|
||||
private Dispersion dispersion = Dispersion.SCATTER;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The min thickness of this layer")
|
||||
private int minHeight = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The max thickness of this layer")
|
||||
private int maxHeight = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
||||
private double terrainZoom = 5;
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("The palette of blocks to be used in this layer")
|
||||
private KList<String> palette = new KList<String>().qadd("GRASS_BLOCK");
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -14,13 +15,18 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisCompatabilityFilter
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("When iris sees this block, and it's not reconized")
|
||||
private String when;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
|
||||
private String supplement;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("If exact is true, it compares block data for example minecraft:some_log[axis=x]")
|
||||
private boolean exact = false;
|
||||
|
||||
private transient AtomicCache<BlockData> findData = new AtomicCache<>(true);
|
||||
|
||||
@@ -7,48 +7,75 @@ import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.gen.TerrainChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Desc("Creates ore & other block deposits underground")
|
||||
@Data
|
||||
public class IrisDepositGenerator
|
||||
{
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The minimum height this deposit can generate at")
|
||||
private int minHeight = 7;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum height this deposit can generate at")
|
||||
private int maxHeight = 55;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(32)
|
||||
@DontObfuscate
|
||||
@Desc("The minimum amount of deposit blocks per clump")
|
||||
private int minSize = 3;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(32)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum amount of deposit blocks per clump")
|
||||
private int maxSize = 5;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(128)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum amount of clumps per chunk")
|
||||
private int maxPerChunk = 3;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@DontObfuscate
|
||||
@Desc("The minimum amount of clumps per chunk")
|
||||
private int minPerChunk = 1;
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("The palette of blocks to be used in this deposit generator")
|
||||
private KList<String> palette = new KList<String>();
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(64)
|
||||
@DontObfuscate
|
||||
@Desc("Ore varience is how many different objects clumps iris will create")
|
||||
private int varience = 8;
|
||||
private int varience = 3;
|
||||
|
||||
private transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
|
||||
private transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.ChunkPosition;
|
||||
@@ -17,7 +18,10 @@ import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -30,30 +34,31 @@ public class IrisDimension extends IrisRegistrant
|
||||
public static final BlockData STONE = Material.STONE.createBlockData();
|
||||
public static final BlockData WATER = Material.WATER.createBlockData();
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The human readable name of this dimension")
|
||||
private String name = "A Dimension";
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The interpolation function for splicing noise maxes together")
|
||||
private InterpolationMethod interpolationFunction = InterpolationMethod.BICUBIC;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The interpolation distance scale. Increase = more smooth, less detail")
|
||||
private double interpolationScale = 63;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(64)
|
||||
@DontObfuscate
|
||||
@Desc("The Thickness scale of cave veins")
|
||||
private double caveThickness = 1D;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The version of this dimension. Changing this will stop users from accidentally upgrading (and breaking their worlds).")
|
||||
private int version = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("The cave web scale. Smaller values means scaled up vein networks.")
|
||||
private double caveScale = 1D;
|
||||
|
||||
@MinNumber(-256)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("Shift the Y value of the cave networks up or down.")
|
||||
private double caveShift = 0D;
|
||||
@@ -66,22 +71,32 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("Carve terrain or not")
|
||||
private double carvingZoom = 3.5;
|
||||
|
||||
@MinNumber(-256)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("Carving starts at this height")
|
||||
private int carvingMin = 115;
|
||||
|
||||
@MinNumber(-256)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum height carving happens at")
|
||||
private int carvingMax = 239;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The thickness of carvings (vertical)")
|
||||
private double carvingSliverThickness = 5.5D;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("The thickness of ripples on carved walls")
|
||||
private double carvingRippleThickness = 3D;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("How much of 3D space is carved out. Higher values make carvings cross into 3d space more often (bigger)")
|
||||
private double carvingEnvelope = 0.335D;
|
||||
@@ -90,6 +105,10 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("Carve terrain or not")
|
||||
private boolean carving = true;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Generate vanilla structures")
|
||||
private boolean vanillaStructures = false;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Generate decorations or not")
|
||||
private boolean decorate = true;
|
||||
@@ -98,10 +117,12 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("Use post processing or not")
|
||||
private boolean postProcessing = true;
|
||||
|
||||
@ArrayType(min=1,type=IrisPostProcessor.class)
|
||||
@DontObfuscate
|
||||
@Desc("Post Processors")
|
||||
private KList<IrisPostProcessor> postProcessors = getDefaultPostProcessors();
|
||||
|
||||
@ArrayType(min=1,type=IrisCompatabilityFilter.class)
|
||||
@DontObfuscate
|
||||
@Desc("Compatability filters")
|
||||
private KList<IrisCompatabilityFilter> compatability = getDefaultCompatability();
|
||||
@@ -114,14 +135,20 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("Mirrors the generator floor into the ceiling. Think nether but worse...")
|
||||
private boolean mirrorCeiling = false;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The world environment")
|
||||
private Environment environment = Environment.NORMAL;
|
||||
|
||||
@Required
|
||||
@ArrayType(min=1,type=String.class)
|
||||
@DontObfuscate
|
||||
@Desc("Define all of the regions to include in this dimension. Dimensions -> Regions -> Biomes -> Objects etc")
|
||||
private KList<String> regions = new KList<>();
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(255)
|
||||
@DontObfuscate
|
||||
@Desc("The fluid height for this dimension")
|
||||
private int fluidHeight = 63;
|
||||
@@ -130,62 +157,68 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("Keep this either undefined or empty. Setting any biome name into this will force iris to only generate the specified biome. Great for testing.")
|
||||
private String focus = "";
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
|
||||
private double biomeZoom = 5D;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("Zoom in or out the terrain. This stretches the terrain. Due to performance improvements, Higher than 2.0 may cause weird rounding artifacts. Lower = more terrain changes per block. Its a true zoom-out.")
|
||||
private double terrainZoom = 2D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(360)
|
||||
@DontObfuscate
|
||||
@Desc("You can rotate the input coordinates by an angle. This can make terrain appear more natural (less sharp corners and lines). This literally rotates the entire dimension by an angle. Hint: Try 12 degrees or something not on a 90 or 45 degree angle.")
|
||||
private double dimensionAngleDeg = 0;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Iris adds a few roughness filters to noise. Increasing this smooths it out. Decreasing this makes it bumpier/scratchy")
|
||||
private double roughnessZoom = 2D;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The height of the roughness filters")
|
||||
private int roughnessHeight = 3;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("Coordinate fracturing applies noise to the input coordinates. This creates the 'iris swirls' and wavy features. The distance pushes these waves further into places they shouldnt be. This is a block value multiplier.")
|
||||
private double coordFractureDistance = 20;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("Coordinate fracturing zoom. Higher = less frequent warping, Lower = more frequent and rapid warping / swirls.")
|
||||
private double coordFractureZoom = 8;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("This zooms in the land space")
|
||||
private double landZoom = 1;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("This zooms in the cave biome space")
|
||||
private double caveBiomeZoom = 1;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("This can zoom the shores")
|
||||
private double shoreZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("This zooms oceanic biomes")
|
||||
private double seaZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("Zoom in continents")
|
||||
private double continentZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("Change the size of regions")
|
||||
private double regionZoom = 1;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("The shuffle of regions")
|
||||
private double regionShuffle = 11;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("The shuffle of land vs sea")
|
||||
private double continentalShuffle = 99;
|
||||
@@ -198,26 +231,32 @@ public class IrisDimension extends IrisRegistrant
|
||||
@Desc("Prevent Leaf decay as if placed in creative mode")
|
||||
private boolean preventLeafDecay = false;
|
||||
|
||||
@ArrayType(min=1,type=IrisDepositGenerator.class)
|
||||
@DontObfuscate
|
||||
@Desc("Define global deposit generators")
|
||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The dispersion of materials for the rock palette")
|
||||
private Dispersion dispersion = Dispersion.SCATTER;
|
||||
private Dispersion rockDispersion = Dispersion.SCATTER;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("The rock zoom mostly for zooming in on a wispy palette")
|
||||
private double rockZoom = 5;
|
||||
|
||||
@ArrayType(min=1,type=String.class)
|
||||
@DontObfuscate
|
||||
@Desc("The palette of blocks for 'stone'")
|
||||
private KList<String> rockPalette = new KList<String>().qadd("STONE");
|
||||
|
||||
@ArrayType(min=1,type=String.class)
|
||||
@DontObfuscate
|
||||
@Desc("The palette of blocks for 'water'")
|
||||
private KList<String> fluidPalette = new KList<String>().qadd("WATER");
|
||||
|
||||
@ArrayType(min=1,type=IrisBiomeMutation.class)
|
||||
@DontObfuscate
|
||||
@Desc("Define biome mutations for this dimension")
|
||||
private KList<IrisBiomeMutation> mutations = new KList<>();
|
||||
@@ -432,7 +471,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
return getRockData().get(0);
|
||||
}
|
||||
|
||||
if(dispersion.equals(Dispersion.SCATTER))
|
||||
if(rockDispersion.equals(Dispersion.SCATTER))
|
||||
{
|
||||
return getRockData().get(getRockGenerator(rng).fit(0, 30000000, x, y, z) % getRockData().size());
|
||||
}
|
||||
@@ -449,7 +488,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
{
|
||||
RNG rngx = rng.nextParallelRNG((int) (getRockData().size() * getRegions().size() * getCaveScale() * getLandZoom() * 10357));
|
||||
CNG rockLayerGenerator = new CNG(rng);
|
||||
switch(dispersion)
|
||||
switch(rockDispersion)
|
||||
{
|
||||
case SCATTER:
|
||||
rockLayerGenerator = CNG.signature(rngx).freq(1000000);
|
||||
@@ -493,7 +532,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
return getFluidData().get(0);
|
||||
}
|
||||
|
||||
if(dispersion.equals(Dispersion.SCATTER))
|
||||
if(rockDispersion.equals(Dispersion.SCATTER))
|
||||
{
|
||||
return getFluidData().get(getFluidGenerator(rng).fit(0, 30000000, x, y, z) % getFluidData().size());
|
||||
}
|
||||
@@ -510,7 +549,7 @@ public class IrisDimension extends IrisRegistrant
|
||||
{
|
||||
RNG rngx = rng.nextParallelRNG(getFluidData().size() * (int) (getRockData().size() * getRegions().size() * getCaveScale() * getLandZoom() * 10357));
|
||||
CNG fluidLayerGenerator = new CNG(rng);
|
||||
switch(dispersion)
|
||||
switch(rockDispersion)
|
||||
{
|
||||
case SCATTER:
|
||||
fluidLayerGenerator = CNG.signature(rngx).freq(1000000);
|
||||
|
||||
254
src/main/java/com/volmit/iris/object/IrisEffect.java
Normal file
254
src/main/java/com/volmit/iris/object/IrisEffect.java
Normal file
@@ -0,0 +1,254 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ChronoLatch;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Desc("An iris effect")
|
||||
@Data
|
||||
public class IrisEffect
|
||||
{
|
||||
@DontObfuscate
|
||||
@Desc("The potion effect to apply in this area")
|
||||
private String potionEffect = "";
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The particle effect to apply in the area")
|
||||
private Particle particleEffect = null;
|
||||
|
||||
@MinNumber(-32)
|
||||
@MaxNumber(32)
|
||||
@DontObfuscate
|
||||
@Desc("Randomly offset from the surface to this surface+value")
|
||||
private int particleOffset = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@DontObfuscate
|
||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltX = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@DontObfuscate
|
||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltY = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@DontObfuscate
|
||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||
private double particleAltZ = 0;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Randomize the altX by -altX to altX")
|
||||
private boolean randomAltX = true;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Randomize the altY by -altY to altY")
|
||||
private boolean randomAltY = false;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Randomize the altZ by -altZ to altZ")
|
||||
private boolean randomAltZ = true;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("The sound to play")
|
||||
private Sound sound = null;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("The max distance from the player the sound will play")
|
||||
private int soundDistance = 12;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@DontObfuscate
|
||||
@Desc("The minimum sound pitch")
|
||||
private double minPitch = 0.5D;
|
||||
|
||||
@MinNumber(0.01)
|
||||
@MaxNumber(1.99)
|
||||
@DontObfuscate
|
||||
@Desc("The max sound pitch")
|
||||
private double maxPitch = 1.5D;
|
||||
|
||||
@MinNumber(0.001)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("The sound volume.")
|
||||
private double volume = 1.5D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(512)
|
||||
@DontObfuscate
|
||||
@Desc("The particle count. Try setting to zero for using the alt xyz to a motion value instead of an offset")
|
||||
private int particleCount = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(64)
|
||||
@DontObfuscate
|
||||
@Desc("How far away from the player particles can play")
|
||||
private int particleDistance = 20;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(128)
|
||||
@DontObfuscate
|
||||
@Desc("How wide the particles can play (player's view left and right) RADIUS")
|
||||
private int particleDistanceWidth = 24;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
|
||||
private double extra = 0;
|
||||
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(1024)
|
||||
@DontObfuscate
|
||||
@Desc("The Potion Strength or -1 to disable")
|
||||
private int potionStrength = -1;
|
||||
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The max time the potion will last for")
|
||||
private int potionTicksMax = 155;
|
||||
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The min time the potion will last for")
|
||||
private int potionTicksMin = 75;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The effect interval in milliseconds")
|
||||
private int interval = 150;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(16)
|
||||
@DontObfuscate
|
||||
@Desc("The effect distance start away")
|
||||
private int particleAway = 5;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The chance is 1 in CHANCE per interval")
|
||||
private int chance = 50;
|
||||
|
||||
private transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
|
||||
private transient AtomicCache<ChronoLatch> latch = new AtomicCache<>();
|
||||
|
||||
public IrisEffect()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean canTick()
|
||||
{
|
||||
return latch.aquire(() -> new ChronoLatch(interval)).flip();
|
||||
}
|
||||
|
||||
public PotionEffectType getRealType()
|
||||
{
|
||||
return pt.aquire(() ->
|
||||
{
|
||||
PotionEffectType t = PotionEffectType.LUCK;
|
||||
|
||||
if(getPotionEffect().isEmpty())
|
||||
{
|
||||
return t;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
for(PotionEffectType i : PotionEffectType.values())
|
||||
{
|
||||
if(i.getName().toUpperCase().replaceAll("\\Q \\E", "_").equals(getPotionEffect()))
|
||||
{
|
||||
t = i;
|
||||
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Iris.warn("Unknown Potion Effect Type: " + getPotionEffect());
|
||||
|
||||
return t;
|
||||
});
|
||||
}
|
||||
|
||||
public void apply(Player p, IrisChunkGenerator g)
|
||||
{
|
||||
if(!canTick())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(RNG.r.nextInt(chance) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(sound != null)
|
||||
{
|
||||
Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance));
|
||||
p.playSound(part, getSound(), (float) volume, (float) RNG.r.d(minPitch, maxPitch));
|
||||
}
|
||||
|
||||
if(particleEffect != null)
|
||||
{
|
||||
Location part = p.getLocation().clone().add(p.getLocation().getDirection().clone().multiply(RNG.r.i(particleDistance) + particleAway)).clone().add(p.getLocation().getDirection().clone().rotateAroundY(Math.toRadians(90)).multiply(RNG.r.d(-particleDistanceWidth, particleDistanceWidth)));
|
||||
|
||||
part.setY(Math.round(g.getTerrainHeight(part.getBlockX(), part.getBlockZ())) + 1);
|
||||
part.add(RNG.r.d(), 0, RNG.r.d());
|
||||
if(extra != 0)
|
||||
{
|
||||
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset), part.getZ(), particleCount, randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX, randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY, randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ, extra);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset), part.getZ(), particleCount, randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX, randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY, randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ);
|
||||
}
|
||||
}
|
||||
|
||||
if(potionStrength > -1)
|
||||
{
|
||||
if(p.hasPotionEffect(getRealType()))
|
||||
{
|
||||
PotionEffect e = p.getPotionEffect(getRealType());
|
||||
if(e.getAmplifier() > getPotionStrength())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
p.removePotionEffect(getRealType());
|
||||
}
|
||||
|
||||
p.addPotionEffect(new PotionEffect(getRealType(), RNG.r.i(Math.min(potionTicksMax, potionTicksMin), Math.max(potionTicksMax, potionTicksMin)), getPotionStrength(), true, false, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,16 @@ package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.CellGenerator;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -17,18 +21,22 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisGenerator extends IrisRegistrant
|
||||
{
|
||||
@MinNumber(0.001)
|
||||
@DontObfuscate
|
||||
@Desc("The zoom or frequency.")
|
||||
private double zoom = 1;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The opacity, essentially a multiplier on the output.")
|
||||
private double opacity = 1;
|
||||
|
||||
@MinNumber(0.001)
|
||||
@DontObfuscate
|
||||
@Desc("The size of the cell fractures")
|
||||
private double cellFractureZoom = 1D;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("Cell Fracture Coordinate Shuffling")
|
||||
private double cellFractureShuffle = 12D;
|
||||
@@ -37,6 +45,8 @@ public class IrisGenerator extends IrisRegistrant
|
||||
@Desc("The height of fracture cells. Set to 0 to disable")
|
||||
private double cellFractureHeight = 0D;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("How big are the cells (X,Z) relative to the veins that touch them. Between 0 and 1. 0.1 means thick veins, small cells.")
|
||||
private double cellPercentSize = 0.75D;
|
||||
@@ -49,26 +59,36 @@ public class IrisGenerator extends IrisRegistrant
|
||||
@Desc("The offset to shift this noise z")
|
||||
private double offsetZ = 0;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The seed for this generator")
|
||||
private long seed = 1;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The interpolation method when two biomes use different heights but this same generator")
|
||||
private InterpolationMethod interpolationFunction = InterpolationMethod.BICUBIC;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("The interpolation distance scale (blocks) when two biomes use different heights but this same generator")
|
||||
private double interpolationScale = 7;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("Cliff Height Max. Disable with 0 for min and max")
|
||||
private double cliffHeightMax = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8192)
|
||||
@DontObfuscate
|
||||
@Desc("Cliff Height Min. Disable with 0 for min and max")
|
||||
private double cliffHeightMin = 0;
|
||||
|
||||
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
|
||||
@DontObfuscate
|
||||
@Desc("The list of noise gens this gen contains.")
|
||||
private KList<IrisNoiseGenerator> composite = new KList<IrisNoiseGenerator>();
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisInterpolation;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -14,6 +17,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisNoiseGenerator
|
||||
{
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("The coordinate input zoom")
|
||||
private double zoom = 1;
|
||||
@@ -22,6 +26,7 @@ public class IrisNoiseGenerator
|
||||
@Desc("Reverse the output. So that noise = -noise + opacity")
|
||||
private boolean negative = false;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The output multiplier")
|
||||
private double opacity = 1;
|
||||
@@ -38,6 +43,7 @@ public class IrisNoiseGenerator
|
||||
@Desc("Coordinate offset z")
|
||||
private double offsetZ = 0;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The seed")
|
||||
private long seed = 0;
|
||||
@@ -66,10 +72,12 @@ public class IrisNoiseGenerator
|
||||
@Desc("If this generator uses the default iris swirly/wispy noise generator. Set to false for pure simplex.")
|
||||
private boolean irisBased = true;
|
||||
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("Multiple octaves for multple generators of changing zooms added together")
|
||||
private int octaves = 1;
|
||||
|
||||
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
|
||||
@DontObfuscate
|
||||
@Desc("Apply a child noise generator to fracture the input coordinates of this generator")
|
||||
private KList<IrisNoiseGenerator> fracture = new KList<>();
|
||||
|
||||
@@ -2,20 +2,28 @@ package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Desc("Represents an iris object placer. It places objects.")
|
||||
@Data
|
||||
public class IrisObjectPlacement
|
||||
{
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("List of objects to place")
|
||||
private KList<String> place = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisObjectReplace.class)
|
||||
@DontObfuscate
|
||||
@Desc("Find and replace blocks")
|
||||
private KList<IrisObjectReplace> edit = new KList<>();
|
||||
@@ -28,14 +36,20 @@ public class IrisObjectPlacement
|
||||
@Desc("Rotate this objects placement")
|
||||
private IrisObjectRotation rotation = new IrisObjectRotation();
|
||||
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
|
||||
private double snow = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")
|
||||
private double chance = 1;
|
||||
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("If the chance check passes, place this many in a single chunk")
|
||||
private int density = 1;
|
||||
@@ -49,7 +63,7 @@ public class IrisObjectPlacement
|
||||
private boolean onwater = false;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("If set to true, this object will only place parts of itself where blocks already exist.")
|
||||
@Desc("If set to true, this object will only place parts of itself where blocks already exist. Warning: Melding is very performance intensive!")
|
||||
private boolean meld = false;
|
||||
|
||||
@DontObfuscate
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -13,12 +14,17 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisObjectReplace
|
||||
{
|
||||
@Required
|
||||
@Desc("Find this block")
|
||||
@DontObfuscate
|
||||
private String find;
|
||||
|
||||
@Required
|
||||
@Desc("Replace it with this block")
|
||||
@DontObfuscate
|
||||
private String replace;
|
||||
|
||||
@Desc("Exactly match the block data or not")
|
||||
@DontObfuscate
|
||||
private boolean exact = false;
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ import org.bukkit.util.BlockVector;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -11,17 +14,24 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisObjectTranslate
|
||||
{
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@DontObfuscate
|
||||
@Desc("The x shift in blocks")
|
||||
private int x;
|
||||
private int x = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(-256)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The x shift in blocks")
|
||||
private int y;
|
||||
private int y = 0;
|
||||
|
||||
@MinNumber(-8)
|
||||
@MaxNumber(8)
|
||||
@DontObfuscate
|
||||
@Desc("The x shift in blocks")
|
||||
private int z;
|
||||
private int z = 0;
|
||||
|
||||
public IrisObjectTranslate()
|
||||
{
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -11,10 +14,14 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisPostProcessor
|
||||
{
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(8)
|
||||
@DontObfuscate
|
||||
@Desc("The phase to run this filter in. Filters in the same phase iterate across x z chunks all at once per block. Seperate phases run another entire iteration across the chunk after the previous phase has finished.")
|
||||
private int phase = 0;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The processor to use. Take a look at the list of processors in docs.")
|
||||
private String processor = "";
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.volmit.iris.object;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.ContextualChunkGenerator;
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
@@ -10,7 +11,10 @@ import com.volmit.iris.util.IRare;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -20,98 +24,133 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisRegion extends IrisRegistrant implements IRare
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The name of the region")
|
||||
private String name = "A Region";
|
||||
|
||||
@ArrayType(min = 1, type = IrisEffect.class)
|
||||
@DontObfuscate
|
||||
@Desc("The name of the region")
|
||||
private KList<IrisEffect> effects = new KList<>();
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(256)
|
||||
@DontObfuscate
|
||||
@Desc("The rarity of the region")
|
||||
private int rarity = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The shore ration (How much percent of land should be a shore)")
|
||||
private double shoreRatio = 0.13;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The min shore height")
|
||||
private double shoreHeightMin = 1.2;
|
||||
@DontObfuscate
|
||||
|
||||
@MinNumber(0)
|
||||
@Desc("The scrambling between biomes")
|
||||
private double biomeShuffle = 11;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The the max shore height")
|
||||
private double shoreHeightMax = 3.2;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("The varience of the shore height")
|
||||
private double shoreHeightZoom = 3.14;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large land biomes are in this region")
|
||||
private double landBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large shore biomes are in this region")
|
||||
private double shoreBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large sea biomes are in this region")
|
||||
private double seaBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large island biomes are in this region")
|
||||
private double islandBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large cave biomes are in this region")
|
||||
private double caveBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("How large skyland biomes are in this region")
|
||||
private double skylandBiomeZoom = 1;
|
||||
|
||||
@MinNumber(0.0001)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The biome implosion ratio, how much to implode biomes into children (chance)")
|
||||
private double biomeImplosionRatio = 0.4;
|
||||
|
||||
@ArrayType(min = 1, type = IrisStructurePlacement.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of structure tilesets")
|
||||
private KList<IrisStructurePlacement> structures = new KList<>();
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> landBiomes = new KList<>();
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> seaBiomes = new KList<>();
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> shoreBiomes = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> caveBiomes = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> islandBiomes = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("A list of root-level biomes in this region. Don't specify child biomes of other biomes here. Just the root parents.")
|
||||
private KList<String> skylandBiomes = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisRegionRidge.class)
|
||||
@DontObfuscate
|
||||
@Desc("Ridge biomes create a vein-like network like rivers through this region")
|
||||
private KList<IrisRegionRidge> ridgeBiomes = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisRegionSpot.class)
|
||||
@DontObfuscate
|
||||
@Desc("Spot biomes splotch themselves across this region like lakes")
|
||||
private KList<IrisRegionSpot> spotBiomes = new KList<>();
|
||||
|
||||
@ArrayType(min = 1, type = IrisDepositGenerator.class)
|
||||
@Desc("Define regional deposit generators that add onto the global deposit generators")
|
||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||
|
||||
|
||||
@@ -4,7 +4,10 @@ import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.CellGenerator;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -12,10 +15,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisRegionRidge
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The biome name")
|
||||
private String biome;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The type this biome should override (land sea or shore)")
|
||||
private InferredType type = InferredType.LAND;
|
||||
@@ -28,10 +33,14 @@ public class IrisRegionRidge
|
||||
@Desc("Use the distance from cell value to add or remove noise value. (Forces depth or height)")
|
||||
private double noiseMultiplier = 0;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The chance this biome will be placed in a given spot")
|
||||
private double chance = 0.75;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The scale of the biome ridge. Higher values = wider veins & bigger connected cells")
|
||||
private double scale = 5;
|
||||
@@ -40,14 +49,17 @@ public class IrisRegionRidge
|
||||
@Desc("The chance scale (cell chances)")
|
||||
private double chanceScale = 4;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The shuffle, how 'natural' this looks. Compared to pure polygons")
|
||||
private double shuffle = 16;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The chance shuffle (polygon cell chances)")
|
||||
private double chanceShuffle = 128;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The thickness of the vein")
|
||||
private double thickness = 0.125;
|
||||
|
||||
@@ -4,7 +4,9 @@ import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.CellGenerator;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -12,10 +14,12 @@ import lombok.Data;
|
||||
@Data
|
||||
public class IrisRegionSpot
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The biome to be placed")
|
||||
private String biome;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Where this spot overrides. Land sea or shore")
|
||||
private InferredType type = InferredType.LAND;
|
||||
@@ -28,14 +32,18 @@ public class IrisRegionSpot
|
||||
@Desc("Use the distance from cell value to add or remove noise value. (Forces depth or height)")
|
||||
private double noiseMultiplier = 0;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The scale of splotches")
|
||||
private double scale = 1;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("Rarity is how often this splotch appears. higher = less often")
|
||||
private double rarity = 1;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The shuffle or how natural the splotch looks like (anti-polygon)")
|
||||
private double shuffle = 128;
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.BlockPosition;
|
||||
import com.volmit.iris.util.CNG;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -17,30 +21,44 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisStructure extends IrisRegistrant
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("This is the human readable name for this structure. Such as Red Dungeon or Tropical Village.")
|
||||
private String name = "A Structure Type";
|
||||
|
||||
@Required
|
||||
@MinNumber(3)
|
||||
@MaxNumber(64)
|
||||
@DontObfuscate
|
||||
@Desc("This is the x and z size of each grid cell")
|
||||
private int gridSize = 11;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@MaxNumber(255)
|
||||
@DontObfuscate
|
||||
@Desc("This is the y size of each grid cell")
|
||||
private int gridHeight = 5;
|
||||
|
||||
@MinNumber(1)
|
||||
@MaxNumber(82)
|
||||
@DontObfuscate
|
||||
@Desc("This is the maximum layers iris will generate for (height cells)")
|
||||
private int maxLayers = 1;
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("This is the wall chance. Higher values makes more rooms and less open halls")
|
||||
private double wallChance = 0.25;
|
||||
|
||||
@DontObfuscate
|
||||
@Desc("Edges of tiles replace each other instead of having their own.")
|
||||
private boolean mergeEdges = true;
|
||||
private boolean mergeEdges = false;
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = IrisStructureTile.class)
|
||||
@DontObfuscate
|
||||
@Desc("The tiles")
|
||||
private KList<IrisStructureTile> tiles = new KList<>();
|
||||
|
||||
@@ -7,33 +7,47 @@ import com.volmit.iris.gen.atomics.AtomicCache;
|
||||
import com.volmit.iris.util.CellGenerator;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.MaxNumber;
|
||||
import com.volmit.iris.util.MinNumber;
|
||||
import com.volmit.iris.util.RNG;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Desc("Represents a structure placement")
|
||||
@Data
|
||||
public class IrisStructurePlacement
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("The structure tileset to use")
|
||||
private String tileset = "";
|
||||
|
||||
@Required
|
||||
@MinNumber(0.0001)
|
||||
@DontObfuscate
|
||||
@Desc("The structure chance zoom. Higher = bigger cells, further away")
|
||||
private double zoom = 1D;
|
||||
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The ratio. Lower values means cells can get closer to other cells. Negative values means make veins of structures")
|
||||
private double ratio = 0.25D;
|
||||
|
||||
@Required
|
||||
@MinNumber(1)
|
||||
@DontObfuscate
|
||||
@Desc("The rarity for this structure")
|
||||
private int rarity = 4;
|
||||
|
||||
@MinNumber(-1)
|
||||
@MaxNumber(255)
|
||||
@DontObfuscate
|
||||
@Desc("The height or -1 for surface")
|
||||
private int height = -1;
|
||||
|
||||
@MinNumber(0)
|
||||
@DontObfuscate
|
||||
@Desc("The chance cell shuffle (rougher edges)")
|
||||
private double shuffle = 22;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.volmit.iris.object;
|
||||
|
||||
import com.volmit.iris.util.ArrayType;
|
||||
import com.volmit.iris.util.Desc;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.KList;
|
||||
import com.volmit.iris.util.Required;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -13,30 +15,38 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class IrisStructureTile
|
||||
{
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Is this structure allowed to place if there is supposed to be a ceiling?")
|
||||
private StructureTileCondition ceiling = StructureTileCondition.AGNOSTIC;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Is this structure allowed to place if there is supposed to be a floor?")
|
||||
private StructureTileCondition floor = StructureTileCondition.REQUIRED;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Is this structure allowed to place if there is supposed to be a north wall?")
|
||||
private StructureTileCondition north = StructureTileCondition.AGNOSTIC;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Is this structure allowed to place if there is supposed to be a south wall?")
|
||||
private StructureTileCondition south = StructureTileCondition.AGNOSTIC;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Is this structure allowed to place if there is supposed to be a east wall?")
|
||||
private StructureTileCondition east = StructureTileCondition.AGNOSTIC;
|
||||
|
||||
@Required
|
||||
@DontObfuscate
|
||||
@Desc("Is this structure allowed to place if there is supposed to be a west wall?")
|
||||
private StructureTileCondition west = StructureTileCondition.AGNOSTIC;
|
||||
|
||||
@Required
|
||||
@ArrayType(min = 1, type = String.class)
|
||||
@DontObfuscate
|
||||
@Desc("List of objects to place centered in this tile")
|
||||
private KList<String> objects = new KList<>();
|
||||
@@ -45,15 +55,10 @@ public class IrisStructureTile
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String toString()
|
||||
{
|
||||
return (ceiling.required() ? "C" : "") +
|
||||
(floor.required() ? "F" : "") + "| "+
|
||||
(north.required() ? "X" : "-") +
|
||||
(south.required() ? "X" : "-") +
|
||||
(east.required() ? "X" : "-") +
|
||||
(west.required() ? "X" : "-") + " |";
|
||||
return (ceiling.required() ? "C" : "") + (floor.required() ? "F" : "") + "| " + (north.required() ? "X" : "-") + (south.required() ? "X" : "-") + (east.required() ? "X" : "-") + (west.required() ? "X" : "-") + " |";
|
||||
}
|
||||
|
||||
public boolean likeAGlove(boolean floor, boolean ceiling, KList<StructureTileFace> walls)
|
||||
|
||||
16
src/main/java/com/volmit/iris/util/ArrayType.java
Normal file
16
src/main/java/com/volmit/iris/util/ArrayType.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface ArrayType
|
||||
{
|
||||
Class<?> type();
|
||||
|
||||
int min() default 0;
|
||||
}
|
||||
14
src/main/java/com/volmit/iris/util/MaxNumber.java
Normal file
14
src/main/java/com/volmit/iris/util/MaxNumber.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({FIELD})
|
||||
public @interface MaxNumber
|
||||
{
|
||||
double value();
|
||||
}
|
||||
14
src/main/java/com/volmit/iris/util/MinNumber.java
Normal file
14
src/main/java/com/volmit/iris/util/MinNumber.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({FIELD})
|
||||
public @interface MinNumber
|
||||
{
|
||||
double value();
|
||||
}
|
||||
@@ -10,6 +10,7 @@ public class RNG extends Random
|
||||
private static final long serialVersionUID = 5222938581174415179L;
|
||||
public static final RNG r = new RNG();
|
||||
private final long sx;
|
||||
|
||||
public RNG()
|
||||
{
|
||||
super();
|
||||
@@ -32,12 +33,12 @@ public class RNG extends Random
|
||||
{
|
||||
this(UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).getLeastSignificantBits() + UUID.nameUUIDFromBytes(seed.getBytes(StandardCharsets.UTF_8)).getMostSignificantBits() + (seed.length() * 32564));
|
||||
}
|
||||
|
||||
|
||||
public RNG nextParallelRNG(int signature)
|
||||
{
|
||||
return new RNG(sx + signature);
|
||||
}
|
||||
|
||||
|
||||
@Deprecated
|
||||
public RNG nextRNG()
|
||||
{
|
||||
@@ -116,7 +117,7 @@ public class RNG extends Random
|
||||
|
||||
public double d(double lowerBound, double upperBound)
|
||||
{
|
||||
return lowerBound + (nextDouble() * ((upperBound - lowerBound)));
|
||||
return M.lerp(lowerBound, upperBound, nextDouble());
|
||||
}
|
||||
|
||||
public double d(double upperBound)
|
||||
@@ -136,7 +137,7 @@ public class RNG extends Random
|
||||
|
||||
public int i(int upperBound)
|
||||
{
|
||||
return i(0, upperBound);
|
||||
return i(Math.min(upperBound, 0), Math.max(0, upperBound));
|
||||
}
|
||||
|
||||
public long l(long lowerBound, long upperBound)
|
||||
|
||||
14
src/main/java/com/volmit/iris/util/Required.java
Normal file
14
src/main/java/com/volmit/iris/util/Required.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import static java.lang.annotation.ElementType.*;
|
||||
import static java.lang.annotation.RetentionPolicy.*;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface Required
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user