mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Merge remote-tracking branch 'upstream/master' into Fixes
This commit is contained in:
commit
d893537ae6
@ -22,7 +22,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'com.volmit.iris'
|
group 'com.volmit.iris'
|
||||||
version '1.8.6'
|
version '1.8.7'
|
||||||
def apiVersion = '1.17'
|
def apiVersion = '1.17'
|
||||||
def name = getRootProject().getName() // Defined in settings.gradle
|
def name = getRootProject().getName() // Defined in settings.gradle
|
||||||
def main = 'com.volmit.iris.Iris'
|
def main = 'com.volmit.iris.Iris'
|
||||||
@ -141,6 +141,7 @@ shadowJar {
|
|||||||
append("plugin.yml")
|
append("plugin.yml")
|
||||||
relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic'
|
relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic'
|
||||||
relocate 'io.papermc.lib', 'com.volmit.iris.util.paper'
|
relocate 'io.papermc.lib', 'com.volmit.iris.util.paper'
|
||||||
|
relocate 'net.kyori', 'com.volmit.iris.util.kyori'
|
||||||
dependencies {
|
dependencies {
|
||||||
include(dependency('io.papermc:paperlib'))
|
include(dependency('io.papermc:paperlib'))
|
||||||
include(dependency('com.dfsek:Paralithic'))
|
include(dependency('com.dfsek:Paralithic'))
|
||||||
@ -177,9 +178,9 @@ dependencies {
|
|||||||
// Shaded
|
// Shaded
|
||||||
implementation 'com.dfsek:Paralithic:0.4.0'
|
implementation 'com.dfsek:Paralithic:0.4.0'
|
||||||
implementation 'io.papermc:paperlib:1.0.5'
|
implementation 'io.papermc:paperlib:1.0.5'
|
||||||
implementation "net.kyori:adventure-text-minimessage:4.1.0-SNAPSHOT"
|
implementation "net.kyori:adventure-text-minimessage:4.2.0-SNAPSHOT"
|
||||||
implementation "net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"
|
implementation "net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT"
|
||||||
implementation 'net.kyori:adventure-api:4.8.1'
|
implementation 'net.kyori:adventure-api:4.9.1'
|
||||||
|
|
||||||
// Dynamically Loaded
|
// Dynamically Loaded
|
||||||
implementation 'io.timeandspace:smoothie-map:2.0.2'
|
implementation 'io.timeandspace:smoothie-map:2.0.2'
|
||||||
|
@ -26,7 +26,11 @@ import com.volmit.iris.core.link.OraxenLink;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.nms.INMS;
|
import com.volmit.iris.core.nms.INMS;
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiomeCustom;
|
||||||
|
import com.volmit.iris.engine.object.IrisCompat;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisWorld;
|
||||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||||
import com.volmit.iris.engine.platform.DummyChunkGenerator;
|
import com.volmit.iris.engine.platform.DummyChunkGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
@ -52,6 +56,8 @@ import com.volmit.iris.util.scheduling.J;
|
|||||||
import com.volmit.iris.util.scheduling.Queue;
|
import com.volmit.iris.util.scheduling.Queue;
|
||||||
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
import com.volmit.iris.util.scheduling.ShurikenQueue;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
import net.kyori.adventure.audience.Audience;
|
||||||
|
import net.kyori.adventure.key.Key;
|
||||||
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
import net.kyori.adventure.text.serializer.ComponentSerializer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -65,112 +71,54 @@ import org.bukkit.event.HandlerList;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
public class Iris extends VolmitPlugin implements Listener {
|
public class Iris extends VolmitPlugin implements Listener {
|
||||||
private KMap<Class<? extends IrisService>, IrisService> services;
|
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
||||||
public static Iris instance;
|
public static Iris instance;
|
||||||
public static BukkitAudiences audiences;
|
public static BukkitAudiences audiences;
|
||||||
public static MultiverseCoreLink linkMultiverseCore;
|
public static MultiverseCoreLink linkMultiverseCore;
|
||||||
public static OraxenLink linkOraxen;
|
public static OraxenLink linkOraxen;
|
||||||
public static MythicMobsLink linkMythicMobs;
|
public static MythicMobsLink linkMythicMobs;
|
||||||
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
|
|
||||||
public static IrisCompat compat;
|
public static IrisCompat compat;
|
||||||
public static FileWatcher configWatcher;
|
public static FileWatcher configWatcher;
|
||||||
private static VolmitSender sender;
|
private static VolmitSender sender;
|
||||||
private final KList<Runnable> postShutdown = new KList<>();
|
|
||||||
|
|
||||||
public static VolmitSender getSender() {
|
static {
|
||||||
return sender;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void preEnable() {
|
|
||||||
instance = this;
|
|
||||||
services = new KMap<>();
|
|
||||||
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
|
||||||
INMS.get();
|
|
||||||
IO.delete(new File("iris"));
|
|
||||||
installDataPacks();
|
|
||||||
fixShading();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void enable() {
|
|
||||||
audiences = BukkitAudiences.create(this);
|
|
||||||
sender = new VolmitSender(Bukkit.getConsoleSender());
|
|
||||||
sender.setTag(getTag());
|
|
||||||
instance = this;
|
|
||||||
compat = IrisCompat.configured(getDataFile("compat.json"));
|
|
||||||
linkMultiverseCore = new MultiverseCoreLink();
|
|
||||||
linkOraxen = new OraxenLink();
|
|
||||||
linkMythicMobs = new MythicMobsLink();
|
|
||||||
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
|
||||||
services.values().forEach(IrisService::onEnable);
|
|
||||||
services.values().forEach(this::registerListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void postShutdown(Runnable r) {
|
|
||||||
postShutdown.add(r);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void postEnable() {
|
|
||||||
J.a(() -> PaperLib.suggestPaper(this));
|
|
||||||
J.a(() -> IO.delete(getTemp()));
|
|
||||||
J.a(this::bstats);
|
|
||||||
J.ar(this::checkConfigHotload, 60);
|
|
||||||
J.sr(this::tickQueue, 0);
|
|
||||||
J.s(this::setupPapi);
|
|
||||||
J.a(this::verifyDataPacksPost, 20);
|
|
||||||
splash();
|
|
||||||
|
|
||||||
if (IrisSettings.get().getGeneral().isAutoStartDefaultStudio()) {
|
|
||||||
Iris.info("Starting up auto Studio!");
|
|
||||||
try {
|
try {
|
||||||
Player r = new KList<>(getServer().getOnlinePlayers()).getRandom();
|
InstanceState.updateInstanceId();
|
||||||
Iris.service(StudioSVC.class).open(r != null ? new VolmitSender(r) : sender, 1337, IrisSettings.get().getGenerator().getDefaultWorldType(), (w) -> {
|
} catch (Throwable ignored) {
|
||||||
J.s(() -> {
|
|
||||||
for (Player i : getServer().getOnlinePlayers()) {
|
|
||||||
i.setGameMode(GameMode.SPECTATOR);
|
|
||||||
i.teleport(new Location(w, 0, 200, 0));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} catch (IrisException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
private final KList<Runnable> postShutdown = new KList<>();
|
||||||
public static <T> T service(Class<T> c) {
|
private KMap<Class<? extends IrisService>, IrisService> services;
|
||||||
return (T) instance.services.get(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Iris() {
|
public Iris() {
|
||||||
preEnable();
|
preEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
public static VolmitSender getSender() {
|
||||||
public void onEnable() {
|
return sender;
|
||||||
enable();
|
|
||||||
super.onEnable();
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
|
||||||
J.s(this::postEnable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable() {
|
@SuppressWarnings("unchecked")
|
||||||
services.values().forEach(IrisService::onDisable);
|
public static <T> T service(Class<T> c) {
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
return (T) instance.services.get(c);
|
||||||
HandlerList.unregisterAll((Plugin) this);
|
|
||||||
postShutdown.forEach(Runnable::run);
|
|
||||||
services.clear();
|
|
||||||
MultiBurst.burst.close();
|
|
||||||
super.onDisable();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void callEvent(Event e) {
|
public static void callEvent(Event e) {
|
||||||
@ -219,306 +167,16 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
return initialize(s, null);
|
return initialize(s, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fixShading() {
|
|
||||||
ShadeFix.fix(ComponentSerializer.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupPapi() {
|
|
||||||
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
|
||||||
new IrisPapiExpansion().register();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getDatapacksFolder() {
|
|
||||||
if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
|
|
||||||
return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks");
|
|
||||||
}
|
|
||||||
|
|
||||||
File props = new File("server.properties");
|
|
||||||
|
|
||||||
if (props.exists()) {
|
|
||||||
try {
|
|
||||||
KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
|
|
||||||
|
|
||||||
for (String i : m) {
|
|
||||||
if (i.trim().startsWith("level-name=")) {
|
|
||||||
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void installDataPacks() {
|
|
||||||
Iris.info("Checking Data Packs...");
|
|
||||||
boolean reboot = false;
|
|
||||||
File packs = new File("plugins/Iris/packs");
|
|
||||||
File dpacks = getDatapacksFolder();
|
|
||||||
|
|
||||||
if (dpacks == null) {
|
|
||||||
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (packs.exists()) {
|
|
||||||
for (File i : packs.listFiles()) {
|
|
||||||
if (i.isDirectory()) {
|
|
||||||
Iris.verbose("Checking Pack: " + i.getPath());
|
|
||||||
IrisData data = IrisData.get(i);
|
|
||||||
File dims = new File(i, "dimensions");
|
|
||||||
|
|
||||||
if (dims.exists()) {
|
|
||||||
for (File j : dims.listFiles()) {
|
|
||||||
if (j.getName().endsWith(".json")) {
|
|
||||||
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
|
||||||
|
|
||||||
if (dim == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
|
||||||
if (dim.installDataPack(() -> data, dpacks)) {
|
|
||||||
reboot = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.info("Data Packs Setup!");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void start() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stop() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getTag(String subTag) {
|
|
||||||
return C.BOLD + "" + C.DARK_GRAY + "[" + C.BOLD + "" + C.IRIS + "Iris" + C.BOLD + C.DARK_GRAY + "]" + C.RESET + "" + C.GRAY + ": ";
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkConfigHotload() {
|
|
||||||
if (configWatcher.checkModified()) {
|
|
||||||
IrisSettings.invalidate();
|
|
||||||
IrisSettings.get();
|
|
||||||
configWatcher.checkModified();
|
|
||||||
Iris.info("Hotloaded settings.json ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sq(Runnable r) {
|
public static void sq(Runnable r) {
|
||||||
synchronized (syncJobs) {
|
synchronized (syncJobs) {
|
||||||
syncJobs.queue(r);
|
syncJobs.queue(r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tickQueue() {
|
|
||||||
synchronized (Iris.syncJobs) {
|
|
||||||
if (!Iris.syncJobs.hasNext()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
long ms = M.ms();
|
|
||||||
|
|
||||||
while (Iris.syncJobs.hasNext() && M.ms() - ms < 25) {
|
|
||||||
try {
|
|
||||||
Iris.syncJobs.next().run();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void bstats() {
|
|
||||||
if (IrisSettings.get().getGeneral().isPluginMetrics()) {
|
|
||||||
J.s(() -> new Metrics(Iris.instance, 8757));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getTemp() {
|
public static File getTemp() {
|
||||||
return instance.getDataFolder("cache", "temp");
|
return instance.getDataFolder("cache", "temp");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void verifyDataPacksPost() {
|
|
||||||
File packs = new File("plugins/Iris/packs");
|
|
||||||
File dpacks = getDatapacksFolder();
|
|
||||||
|
|
||||||
if (dpacks == null) {
|
|
||||||
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean bad = false;
|
|
||||||
if (packs.exists()) {
|
|
||||||
for (File i : packs.listFiles()) {
|
|
||||||
if (i.isDirectory()) {
|
|
||||||
Iris.verbose("Checking Pack: " + i.getPath());
|
|
||||||
IrisData data = IrisData.get(i);
|
|
||||||
File dims = new File(i, "dimensions");
|
|
||||||
|
|
||||||
if (dims.exists()) {
|
|
||||||
for (File j : dims.listFiles()) {
|
|
||||||
if (j.getName().endsWith(".json")) {
|
|
||||||
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
|
||||||
|
|
||||||
if (dim == null) {
|
|
||||||
Iris.error("Failed to load " + j.getPath() + " ");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!verifyDataPackInstalled(dim)) {
|
|
||||||
bad = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bad && INMS.get().supportsDataPacks()) {
|
|
||||||
Iris.error("============================================================================");
|
|
||||||
Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes.");
|
|
||||||
Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes.");
|
|
||||||
Iris.error("----------------------------------------------------------------------------");
|
|
||||||
Iris.error(C.UNDERLINE + "IT IS HIGHLY RECOMMENDED YOU RESTART THE SERVER BEFORE GENERATING!");
|
|
||||||
Iris.error("============================================================================");
|
|
||||||
|
|
||||||
for (Player i : Bukkit.getOnlinePlayers()) {
|
|
||||||
if (i.isOp() || i.hasPermission("iris.all")) {
|
|
||||||
VolmitSender sender = new VolmitSender(i, getTag("WARNING"));
|
|
||||||
sender.sendMessage("There are some Iris Packs that have custom biomes in them");
|
|
||||||
sender.sendMessage("You need to restart your server to use these packs.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
J.sleep(3000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean verifyDataPackInstalled(IrisDimension dimension) {
|
|
||||||
IrisData idm = IrisData.get(getDataFolder("packs", dimension.getLoadKey()));
|
|
||||||
KSet<String> keys = new KSet<>();
|
|
||||||
boolean warn = false;
|
|
||||||
|
|
||||||
for (IrisBiome i : dimension.getAllBiomes(() -> idm)) {
|
|
||||||
if (i.isCustom()) {
|
|
||||||
for (IrisBiomeCustom j : i.getCustomDerivitives()) {
|
|
||||||
keys.add(dimension.getLoadKey() + ":" + j.getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!INMS.get().supportsDataPacks()) {
|
|
||||||
if (!keys.isEmpty()) {
|
|
||||||
Iris.warn("===================================================================================");
|
|
||||||
Iris.warn("Pack " + dimension.getLoadKey() + " has " + keys.size() + " custom biome(s). ");
|
|
||||||
Iris.warn("Your server version does not yet support datapacks for iris.");
|
|
||||||
Iris.warn("The world will generate these biomes as backup biomes.");
|
|
||||||
Iris.warn("====================================================================================");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String i : keys) {
|
|
||||||
Object o = INMS.get().getCustomBiomeBaseFor(i);
|
|
||||||
|
|
||||||
if (o == null) {
|
|
||||||
Iris.warn("The Biome " + i + " is not registered on the server.");
|
|
||||||
warn = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warn) {
|
|
||||||
Iris.error("The Pack " + dimension.getLoadKey() + " is INCAPABLE of generating custom biomes, restart your server before generating with this pack!");
|
|
||||||
}
|
|
||||||
|
|
||||||
return !warn;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
|
||||||
return super.onCommand(sender, command, label, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void imsg(CommandSender s, String msg) {
|
|
||||||
s.sendMessage(C.IRIS + "[" + C.DARK_GRAY + "Iris" + C.IRIS + "]" + C.GRAY + ": " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
|
||||||
if (worldName.equals("test")) {
|
|
||||||
try {
|
|
||||||
throw new RuntimeException();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.info(e.getStackTrace()[1].getClassName());
|
|
||||||
if (e.getStackTrace()[1].getClassName().contains("com.onarandombox.MultiverseCore")) {
|
|
||||||
Iris.debug("MVC Test detected, Quick! Send them the dummy!");
|
|
||||||
return new DummyChunkGenerator();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisDimension dim;
|
|
||||||
if (id == null || id.isEmpty()) {
|
|
||||||
dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
|
|
||||||
} else {
|
|
||||||
dim = IrisData.loadAnyDimension(id);
|
|
||||||
}
|
|
||||||
Iris.debug("Generator ID: " + id + " requested by bukkit/plugin");
|
|
||||||
|
|
||||||
if (dim == null) {
|
|
||||||
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
|
||||||
|
|
||||||
service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
|
||||||
dim = IrisData.loadAnyDimension(id);
|
|
||||||
|
|
||||||
if (dim == null) {
|
|
||||||
throw new RuntimeException("Can't find dimension " + id + "!");
|
|
||||||
} else {
|
|
||||||
Iris.info("Resolved missing dimension, proceeding with generation.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.debug("Assuming IrisDimension: " + dim.getName());
|
|
||||||
|
|
||||||
IrisWorld w = IrisWorld.builder()
|
|
||||||
.name(worldName)
|
|
||||||
.seed(1337)
|
|
||||||
.environment(dim.getEnvironment())
|
|
||||||
.worldFolder(new File(worldName))
|
|
||||||
.minHeight(0)
|
|
||||||
.maxHeight(256)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Iris.debug("Generator Config: " + w.toString());
|
|
||||||
|
|
||||||
File ff = new File(w.worldFolder(), "iris/pack");
|
|
||||||
if (!ff.exists() || ff.listFiles().length == 0) {
|
|
||||||
ff.mkdirs();
|
|
||||||
service(StudioSVC.class).installIntoWorld(sender, dim.getLoadKey(), ff.getParentFile());
|
|
||||||
}
|
|
||||||
|
|
||||||
return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void msg(String string) {
|
public static void msg(String string) {
|
||||||
try {
|
try {
|
||||||
sender.sendMessage(string);
|
sender.sendMessage(string);
|
||||||
@ -642,30 +300,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
msg(C.WHITE + string);
|
msg(C.WHITE + string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void splash() {
|
|
||||||
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// @NoArgsConstructor
|
|
||||||
String padd = Form.repeat(" ", 8);
|
|
||||||
String padd2 = Form.repeat(" ", 4);
|
|
||||||
String[] info = {"", "", "", "", "", padd2 + C.IRIS + " Iris", padd2 + C.GRAY + " by " + "<rainbow>Volmit Software", padd2 + C.GRAY + " v" + C.IRIS + getDescription().getVersion(),
|
|
||||||
};
|
|
||||||
String[] splash = {padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@", padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.IRIS + " .(((()))). ", padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.IRIS + " .((((((())))))). ", padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.IRIS + " ((((((((())))))))) " + C.GRAY + " @", padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.IRIS + " ((((((((-))))))))) " + C.GRAY + " @@", padd + C.GRAY + "@@@&&" + C.IRIS + " ((((((({ })))))))) " + C.GRAY + " &&@@@", padd + C.GRAY + "@@" + C.IRIS + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@", padd + C.GRAY + "@" + C.IRIS + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@", padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
|
|
||||||
};
|
|
||||||
//@done
|
|
||||||
Iris.info("Server type & version: " + Bukkit.getVersion());
|
|
||||||
Iris.info("Bukkit version: " + Bukkit.getBukkitVersion());
|
|
||||||
Iris.info("Java version: " + getJavaVersion());
|
|
||||||
Iris.info("Custom Biomes: " + INMS.get().countCustomBiomes());
|
|
||||||
for (int i = 0; i < info.length; i++) {
|
|
||||||
splash[i] += info[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
Iris.info("\n\n " + new KList<>(splash).toString("\n") + "\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void later(NastyRunnable object) {
|
public static void later(NastyRunnable object) {
|
||||||
Bukkit.getScheduler().scheduleAsyncDelayedTask(instance, () ->
|
Bukkit.getScheduler().scheduleAsyncDelayedTask(instance, () ->
|
||||||
@ -702,10 +336,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
return Integer.parseInt(version);
|
return Integer.parseInt(version);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isMCA() {
|
|
||||||
return IrisSettings.get().getGenerator().isHeadlessPregeneration();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void reportErrorChunk(int x, int z, Throwable e, String extra) {
|
public static void reportErrorChunk(int x, int z, Throwable e, String extra) {
|
||||||
if (IrisSettings.get().getGeneral().isDebug()) {
|
if (IrisSettings.get().getGeneral().isDebug()) {
|
||||||
File f = instance.getDataFile("debug", "chunk-errors", "chunk." + x + "." + z + ".txt");
|
File f = instance.getDataFile("debug", "chunk-errors", "chunk." + x + "." + z + ".txt");
|
||||||
@ -748,14 +378,6 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static {
|
|
||||||
try {
|
|
||||||
InstanceState.updateInstanceId();
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void dump() {
|
public static void dump() {
|
||||||
try {
|
try {
|
||||||
File fi = Iris.instance.getDataFile("dump", "td-" + new java.sql.Date(M.ms()) + ".txt");
|
File fi = Iris.instance.getDataFile("dump", "td-" + new java.sql.Date(M.ms()) + ".txt");
|
||||||
@ -781,4 +403,464 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void preEnable() {
|
||||||
|
instance = this;
|
||||||
|
services = new KMap<>();
|
||||||
|
initialize("com.volmit.iris.core.service").forEach((i) -> services.put((Class<? extends IrisService>) i.getClass(), (IrisService) i));
|
||||||
|
INMS.get();
|
||||||
|
IO.delete(new File("iris"));
|
||||||
|
installDataPacks();
|
||||||
|
fixShading();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enable() {
|
||||||
|
setupAudience();
|
||||||
|
sender = new VolmitSender(Bukkit.getConsoleSender());
|
||||||
|
sender.setTag(getTag());
|
||||||
|
instance = this;
|
||||||
|
compat = IrisCompat.configured(getDataFile("compat.json"));
|
||||||
|
linkMultiverseCore = new MultiverseCoreLink();
|
||||||
|
linkOraxen = new OraxenLink();
|
||||||
|
linkMythicMobs = new MythicMobsLink();
|
||||||
|
configWatcher = new FileWatcher(getDataFile("settings.json"));
|
||||||
|
services.values().forEach(IrisService::onEnable);
|
||||||
|
services.values().forEach(this::registerListener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupAudience() {
|
||||||
|
try {
|
||||||
|
audiences = BukkitAudiences.create(this);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Audience dummy = new Audience() {
|
||||||
|
};
|
||||||
|
IrisSettings.get().getGeneral().setUseConsoleCustomColors(false);
|
||||||
|
IrisSettings.get().getGeneral().setUseCustomColorsIngame(false);
|
||||||
|
Iris.error("Failed to setup Adventure API... No custom colors :(");
|
||||||
|
audiences = new BukkitAudiences() {
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience sender(@NotNull CommandSender sender) {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience player(@NotNull Player player) {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience filter(@NotNull Predicate<CommandSender> filter) {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience all() {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience console() {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience players() {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience player(@NotNull UUID playerId) {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience permission(@NotNull String permission) {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience world(@NotNull Key world) {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Audience server(@NotNull String serverName) {
|
||||||
|
return dummy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void close() {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postShutdown(Runnable r) {
|
||||||
|
postShutdown.add(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void postEnable() {
|
||||||
|
J.a(() -> PaperLib.suggestPaper(this));
|
||||||
|
J.a(() -> IO.delete(getTemp()));
|
||||||
|
J.a(this::bstats);
|
||||||
|
J.ar(this::checkConfigHotload, 60);
|
||||||
|
J.sr(this::tickQueue, 0);
|
||||||
|
J.s(this::setupPapi);
|
||||||
|
J.a(this::verifyDataPacksPost, 20);
|
||||||
|
splash();
|
||||||
|
|
||||||
|
if (IrisSettings.get().getGeneral().isAutoStartDefaultStudio()) {
|
||||||
|
Iris.info("Starting up auto Studio!");
|
||||||
|
try {
|
||||||
|
Player r = new KList<>(getServer().getOnlinePlayers()).getRandom();
|
||||||
|
Iris.service(StudioSVC.class).open(r != null ? new VolmitSender(r) : sender, 1337, IrisSettings.get().getGenerator().getDefaultWorldType(), (w) -> {
|
||||||
|
J.s(() -> {
|
||||||
|
for (Player i : getServer().getOnlinePlayers()) {
|
||||||
|
i.setGameMode(GameMode.SPECTATOR);
|
||||||
|
i.teleport(new Location(w, 0, 200, 0));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} catch (IrisException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void onEnable() {
|
||||||
|
enable();
|
||||||
|
super.onEnable();
|
||||||
|
Bukkit.getPluginManager().registerEvents(this, this);
|
||||||
|
J.s(this::postEnable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDisable() {
|
||||||
|
services.values().forEach(IrisService::onDisable);
|
||||||
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
|
HandlerList.unregisterAll((Plugin) this);
|
||||||
|
postShutdown.forEach(Runnable::run);
|
||||||
|
services.clear();
|
||||||
|
MultiBurst.burst.close();
|
||||||
|
super.onDisable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fixShading() {
|
||||||
|
ShadeFix.fix(ComponentSerializer.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setupPapi() {
|
||||||
|
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
|
||||||
|
new IrisPapiExpansion().register();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getDatapacksFolder() {
|
||||||
|
if (!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
|
||||||
|
return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks");
|
||||||
|
}
|
||||||
|
|
||||||
|
File props = new File("server.properties");
|
||||||
|
|
||||||
|
if (props.exists()) {
|
||||||
|
try {
|
||||||
|
KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
|
||||||
|
|
||||||
|
for (String i : m) {
|
||||||
|
if (i.trim().startsWith("level-name=")) {
|
||||||
|
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void installDataPacks() {
|
||||||
|
Iris.info("Checking Data Packs...");
|
||||||
|
boolean reboot = false;
|
||||||
|
File packs = new File("plugins/Iris/packs");
|
||||||
|
File dpacks = getDatapacksFolder();
|
||||||
|
|
||||||
|
if (dpacks == null) {
|
||||||
|
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (packs.exists()) {
|
||||||
|
for (File i : packs.listFiles()) {
|
||||||
|
if (i.isDirectory()) {
|
||||||
|
Iris.verbose("Checking Pack: " + i.getPath());
|
||||||
|
IrisData data = IrisData.get(i);
|
||||||
|
File dims = new File(i, "dimensions");
|
||||||
|
|
||||||
|
if (dims.exists()) {
|
||||||
|
for (File j : dims.listFiles()) {
|
||||||
|
if (j.getName().endsWith(".json")) {
|
||||||
|
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
||||||
|
|
||||||
|
if (dim == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
||||||
|
if (dim.installDataPack(() -> data, dpacks)) {
|
||||||
|
reboot = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.info("Data Packs Setup!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag(String subTag) {
|
||||||
|
return C.BOLD + "" + C.DARK_GRAY + "[" + C.BOLD + "" + C.IRIS + "Iris" + C.BOLD + C.DARK_GRAY + "]" + C.RESET + "" + C.GRAY + ": ";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkConfigHotload() {
|
||||||
|
if (configWatcher.checkModified()) {
|
||||||
|
IrisSettings.invalidate();
|
||||||
|
IrisSettings.get();
|
||||||
|
configWatcher.checkModified();
|
||||||
|
Iris.info("Hotloaded settings.json ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tickQueue() {
|
||||||
|
synchronized (Iris.syncJobs) {
|
||||||
|
if (!Iris.syncJobs.hasNext()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
long ms = M.ms();
|
||||||
|
|
||||||
|
while (Iris.syncJobs.hasNext() && M.ms() - ms < 25) {
|
||||||
|
try {
|
||||||
|
Iris.syncJobs.next().run();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Iris.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bstats() {
|
||||||
|
if (IrisSettings.get().getGeneral().isPluginMetrics()) {
|
||||||
|
J.s(() -> new Metrics(Iris.instance, 8757));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void verifyDataPacksPost() {
|
||||||
|
File packs = new File("plugins/Iris/packs");
|
||||||
|
File dpacks = getDatapacksFolder();
|
||||||
|
|
||||||
|
if (dpacks == null) {
|
||||||
|
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean bad = false;
|
||||||
|
if (packs.exists()) {
|
||||||
|
for (File i : packs.listFiles()) {
|
||||||
|
if (i.isDirectory()) {
|
||||||
|
Iris.verbose("Checking Pack: " + i.getPath());
|
||||||
|
IrisData data = IrisData.get(i);
|
||||||
|
File dims = new File(i, "dimensions");
|
||||||
|
|
||||||
|
if (dims.exists()) {
|
||||||
|
for (File j : dims.listFiles()) {
|
||||||
|
if (j.getName().endsWith(".json")) {
|
||||||
|
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
||||||
|
|
||||||
|
if (dim == null) {
|
||||||
|
Iris.error("Failed to load " + j.getPath() + " ");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!verifyDataPackInstalled(dim)) {
|
||||||
|
bad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bad && INMS.get().supportsDataPacks()) {
|
||||||
|
Iris.error("============================================================================");
|
||||||
|
Iris.error(C.ITALIC + "You need to restart your server to properly generate custom biomes.");
|
||||||
|
Iris.error(C.ITALIC + "By continuing, Iris will use backup biomes in place of the custom biomes.");
|
||||||
|
Iris.error("----------------------------------------------------------------------------");
|
||||||
|
Iris.error(C.UNDERLINE + "IT IS HIGHLY RECOMMENDED YOU RESTART THE SERVER BEFORE GENERATING!");
|
||||||
|
Iris.error("============================================================================");
|
||||||
|
|
||||||
|
for (Player i : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (i.isOp() || i.hasPermission("iris.all")) {
|
||||||
|
VolmitSender sender = new VolmitSender(i, getTag("WARNING"));
|
||||||
|
sender.sendMessage("There are some Iris Packs that have custom biomes in them");
|
||||||
|
sender.sendMessage("You need to restart your server to use these packs.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
J.sleep(3000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean verifyDataPackInstalled(IrisDimension dimension) {
|
||||||
|
IrisData idm = IrisData.get(getDataFolder("packs", dimension.getLoadKey()));
|
||||||
|
KSet<String> keys = new KSet<>();
|
||||||
|
boolean warn = false;
|
||||||
|
|
||||||
|
for (IrisBiome i : dimension.getAllBiomes(() -> idm)) {
|
||||||
|
if (i.isCustom()) {
|
||||||
|
for (IrisBiomeCustom j : i.getCustomDerivitives()) {
|
||||||
|
keys.add(dimension.getLoadKey() + ":" + j.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!INMS.get().supportsDataPacks()) {
|
||||||
|
if (!keys.isEmpty()) {
|
||||||
|
Iris.warn("===================================================================================");
|
||||||
|
Iris.warn("Pack " + dimension.getLoadKey() + " has " + keys.size() + " custom biome(s). ");
|
||||||
|
Iris.warn("Your server version does not yet support datapacks for iris.");
|
||||||
|
Iris.warn("The world will generate these biomes as backup biomes.");
|
||||||
|
Iris.warn("====================================================================================");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String i : keys) {
|
||||||
|
Object o = INMS.get().getCustomBiomeBaseFor(i);
|
||||||
|
|
||||||
|
if (o == null) {
|
||||||
|
Iris.warn("The Biome " + i + " is not registered on the server.");
|
||||||
|
warn = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warn) {
|
||||||
|
Iris.error("The Pack " + dimension.getLoadKey() + " is INCAPABLE of generating custom biomes, restart your server before generating with this pack!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return !warn;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
return super.onCommand(sender, command, label, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void imsg(CommandSender s, String msg) {
|
||||||
|
s.sendMessage(C.IRIS + "[" + C.DARK_GRAY + "Iris" + C.IRIS + "]" + C.GRAY + ": " + msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
|
||||||
|
if (worldName.equals("test")) {
|
||||||
|
try {
|
||||||
|
throw new RuntimeException();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.info(e.getStackTrace()[1].getClassName());
|
||||||
|
if (e.getStackTrace()[1].getClassName().contains("com.onarandombox.MultiverseCore")) {
|
||||||
|
Iris.debug("MVC Test detected, Quick! Send them the dummy!");
|
||||||
|
return new DummyChunkGenerator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IrisDimension dim;
|
||||||
|
if (id == null || id.isEmpty()) {
|
||||||
|
dim = IrisData.loadAnyDimension(IrisSettings.get().getGenerator().getDefaultWorldType());
|
||||||
|
} else {
|
||||||
|
dim = IrisData.loadAnyDimension(id);
|
||||||
|
}
|
||||||
|
Iris.debug("Generator ID: " + id + " requested by bukkit/plugin");
|
||||||
|
|
||||||
|
if (dim == null) {
|
||||||
|
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
||||||
|
|
||||||
|
service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
||||||
|
dim = IrisData.loadAnyDimension(id);
|
||||||
|
|
||||||
|
if (dim == null) {
|
||||||
|
throw new RuntimeException("Can't find dimension " + id + "!");
|
||||||
|
} else {
|
||||||
|
Iris.info("Resolved missing dimension, proceeding with generation.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.debug("Assuming IrisDimension: " + dim.getName());
|
||||||
|
|
||||||
|
IrisWorld w = IrisWorld.builder()
|
||||||
|
.name(worldName)
|
||||||
|
.seed(1337)
|
||||||
|
.environment(dim.getEnvironment())
|
||||||
|
.worldFolder(new File(worldName))
|
||||||
|
.minHeight(0)
|
||||||
|
.maxHeight(256)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
Iris.debug("Generator Config: " + w.toString());
|
||||||
|
|
||||||
|
File ff = new File(w.worldFolder(), "iris/pack");
|
||||||
|
if (!ff.exists() || ff.listFiles().length == 0) {
|
||||||
|
ff.mkdirs();
|
||||||
|
service(StudioSVC.class).installIntoWorld(sender, dim.getLoadKey(), ff.getParentFile());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void splash() {
|
||||||
|
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @NoArgsConstructor
|
||||||
|
String padd = Form.repeat(" ", 8);
|
||||||
|
String padd2 = Form.repeat(" ", 4);
|
||||||
|
String[] info = {"", "", "", "", "", padd2 + C.IRIS + " Iris", padd2 + C.GRAY + " by " + "<rainbow>Volmit Software", padd2 + C.GRAY + " v" + C.IRIS + getDescription().getVersion(),
|
||||||
|
};
|
||||||
|
String[] splash = {padd + C.GRAY + " @@@@@@@@@@@@@@" + C.DARK_GRAY + "@@@", padd + C.GRAY + " @@&&&&&&&&&" + C.DARK_GRAY + "&&&&&&" + C.IRIS + " .(((()))). ", padd + C.GRAY + "@@@&&&&&&&&" + C.DARK_GRAY + "&&&&&" + C.IRIS + " .((((((())))))). ", padd + C.GRAY + "@@@&&&&&" + C.DARK_GRAY + "&&&&&&&" + C.IRIS + " ((((((((())))))))) " + C.GRAY + " @", padd + C.GRAY + "@@@&&&&" + C.DARK_GRAY + "@@@@@&" + C.IRIS + " ((((((((-))))))))) " + C.GRAY + " @@", padd + C.GRAY + "@@@&&" + C.IRIS + " ((((((({ })))))))) " + C.GRAY + " &&@@@", padd + C.GRAY + "@@" + C.IRIS + " ((((((((-))))))))) " + C.DARK_GRAY + "&@@@@@" + C.GRAY + "&&&&@@@", padd + C.GRAY + "@" + C.IRIS + " ((((((((())))))))) " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '((((((()))))))' " + C.DARK_GRAY + "&&&&&" + C.GRAY + "&&&&&&&&@@@", padd + C.GRAY + "" + C.IRIS + " '(((())))' " + C.DARK_GRAY + "&&&&&&&&" + C.GRAY + "&&&&&&&@@", padd + C.GRAY + " " + C.DARK_GRAY + "@@@" + C.GRAY + "@@@@@@@@@@@@@@"
|
||||||
|
};
|
||||||
|
//@done
|
||||||
|
Iris.info("Server type & version: " + Bukkit.getVersion());
|
||||||
|
Iris.info("Bukkit version: " + Bukkit.getBukkitVersion());
|
||||||
|
Iris.info("Java version: " + getJavaVersion());
|
||||||
|
Iris.info("Custom Biomes: " + INMS.get().countCustomBiomes());
|
||||||
|
for (int i = 0; i < info.length; i++) {
|
||||||
|
splash[i] += info[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.info("\n\n " + new KList<>(splash).toString("\n") + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMCA() {
|
||||||
|
return IrisSettings.get().getGenerator().isHeadlessPregeneration();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,7 @@ import java.io.IOException;
|
|||||||
@Data
|
@Data
|
||||||
public class IrisSettings {
|
public class IrisSettings {
|
||||||
public static transient IrisSettings settings;
|
public static transient IrisSettings settings;
|
||||||
|
public int configurationVersion = 3;
|
||||||
private IrisSettingsCache cache = new IrisSettingsCache();
|
private IrisSettingsCache cache = new IrisSettingsCache();
|
||||||
private IrisSettingsConcurrency concurrency = new IrisSettingsConcurrency();
|
private IrisSettingsConcurrency concurrency = new IrisSettingsConcurrency();
|
||||||
private IrisSettingsParallax parallax = new IrisSettingsParallax();
|
private IrisSettingsParallax parallax = new IrisSettingsParallax();
|
||||||
@ -40,7 +41,71 @@ public class IrisSettings {
|
|||||||
private IrisSettingsGUI gui = new IrisSettingsGUI();
|
private IrisSettingsGUI gui = new IrisSettingsGUI();
|
||||||
private IrisSettingsGenerator generator = new IrisSettingsGenerator();
|
private IrisSettingsGenerator generator = new IrisSettingsGenerator();
|
||||||
private IrisSettingsStudio studio = new IrisSettingsStudio();
|
private IrisSettingsStudio studio = new IrisSettingsStudio();
|
||||||
public int configurationVersion = 3;
|
|
||||||
|
public static int getPriority(int c) {
|
||||||
|
return Math.max(Math.min(c, Thread.MAX_PRIORITY), Thread.MIN_PRIORITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getThreadCount(int c) {
|
||||||
|
if (c < 2 && c >= 0) {
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.max(2, c < 0 ? Runtime.getRuntime().availableProcessors() / -c : c);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IrisSettings get() {
|
||||||
|
if (settings != null) {
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
IrisSettings defaults = new IrisSettings();
|
||||||
|
JSONObject def = new JSONObject(new Gson().toJson(defaults));
|
||||||
|
if (settings == null) {
|
||||||
|
settings = new IrisSettings();
|
||||||
|
|
||||||
|
File s = Iris.instance.getDataFile("settings.json");
|
||||||
|
|
||||||
|
if (!s.exists()) {
|
||||||
|
try {
|
||||||
|
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
|
||||||
|
} catch (JSONException | IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Iris.reportError(e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
String ss = IO.readAll(s);
|
||||||
|
settings = new Gson().fromJson(ss, IrisSettings.class);
|
||||||
|
try {
|
||||||
|
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
} catch (Throwable ee) {
|
||||||
|
Iris.reportError(ee);
|
||||||
|
Iris.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!s.exists()) {
|
||||||
|
try {
|
||||||
|
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
|
||||||
|
} catch (JSONException | IOException e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void invalidate() {
|
||||||
|
synchronized (settings) {
|
||||||
|
settings = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isStudio() {
|
public boolean isStudio() {
|
||||||
return getStudio().isStudio();
|
return getStudio().isStudio();
|
||||||
@ -55,18 +120,6 @@ public class IrisSettings {
|
|||||||
return getParallax().getParallaxRegionEvictionMS();
|
return getParallax().getParallaxRegionEvictionMS();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getPriority(int c) {
|
|
||||||
return Math.max(Math.min(c, Thread.MAX_PRIORITY), Thread.MIN_PRIORITY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getThreadCount(int c) {
|
|
||||||
if (c < 2 && c >= 0) {
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.max(2, c < 0 ? Runtime.getRuntime().availableProcessors() / -c : c);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void forceSave() {
|
public void forceSave() {
|
||||||
File s = Iris.instance.getDataFile("settings.json");
|
File s = Iris.instance.getDataFile("settings.json");
|
||||||
|
|
||||||
@ -138,57 +191,4 @@ public class IrisSettings {
|
|||||||
public boolean openVSCode = true;
|
public boolean openVSCode = true;
|
||||||
public boolean disableTimeAndWeather = true;
|
public boolean disableTimeAndWeather = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisSettings get() {
|
|
||||||
if (settings != null) {
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisSettings defaults = new IrisSettings();
|
|
||||||
JSONObject def = new JSONObject(new Gson().toJson(defaults));
|
|
||||||
if (settings == null) {
|
|
||||||
settings = new IrisSettings();
|
|
||||||
|
|
||||||
File s = Iris.instance.getDataFile("settings.json");
|
|
||||||
|
|
||||||
if (!s.exists()) {
|
|
||||||
try {
|
|
||||||
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
String ss = IO.readAll(s);
|
|
||||||
settings = new Gson().fromJson(ss, IrisSettings.class);
|
|
||||||
try {
|
|
||||||
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
} catch (Throwable ee) {
|
|
||||||
Iris.reportError(ee);
|
|
||||||
Iris.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!s.exists()) {
|
|
||||||
try {
|
|
||||||
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
|
|
||||||
} catch (JSONException | IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void invalidate() {
|
|
||||||
synchronized (settings) {
|
|
||||||
settings = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,13 @@ import com.volmit.iris.core.loader.IrisData;
|
|||||||
import com.volmit.iris.core.service.ObjectSVC;
|
import com.volmit.iris.core.service.ObjectSVC;
|
||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacementScaleInterpolator;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectRotation;
|
||||||
|
import com.volmit.iris.engine.object.TileData;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||||
@ -16,7 +22,12 @@ import com.volmit.iris.util.format.C;
|
|||||||
import com.volmit.iris.util.math.Direction;
|
import com.volmit.iris.util.math.Direction;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.scheduling.Queue;
|
import com.volmit.iris.util.scheduling.Queue;
|
||||||
import org.bukkit.*;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.HeightMap;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
@ -27,12 +38,91 @@ import org.bukkit.util.Vector;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.TreeSet;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Decree(name = "object", aliases = "o", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris object manipulation")
|
@Decree(name = "object", aliases = "o", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris object manipulation")
|
||||||
public class CommandObject implements DecreeExecutor {
|
public class CommandObject implements DecreeExecutor {
|
||||||
|
|
||||||
|
private static final Set<Material> skipBlocks = Set.of(Material.GRASS, Material.SNOW, Material.VINE, Material.TORCH, Material.DEAD_BUSH,
|
||||||
|
Material.POPPY, Material.DANDELION);
|
||||||
|
|
||||||
|
public static IObjectPlacer createPlacer(World world, Map<Block, BlockData> futureBlockChanges) {
|
||||||
|
|
||||||
|
return new IObjectPlacer() {
|
||||||
|
@Override
|
||||||
|
public int getHighest(int x, int z, IrisData data) {
|
||||||
|
return world.getHighestBlockYAt(x, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
||||||
|
return world.getHighestBlockYAt(x, z, ignoreFluid ? HeightMap.OCEAN_FLOOR : HeightMap.MOTION_BLOCKING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void set(int x, int y, int z, BlockData d) {
|
||||||
|
Block block = world.getBlockAt(x, y, z);
|
||||||
|
|
||||||
|
//Prevent blocks being set in or bellow bedrock
|
||||||
|
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
||||||
|
|
||||||
|
futureBlockChanges.put(block, block.getBlockData());
|
||||||
|
|
||||||
|
block.setBlockData(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockData get(int x, int y, int z) {
|
||||||
|
return world.getBlockAt(x, y, z).getBlockData();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPreventingDecay() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isCarved(int x, int y, int z) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSolid(int x, int y, int z) {
|
||||||
|
return world.getBlockAt(x, y, z).getType().isSolid();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isUnderwater(int x, int z) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFluidHeight() {
|
||||||
|
return 63;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isDebugSmartBore() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
|
||||||
|
BlockState state = world.getBlockAt(xx, yy, zz).getState();
|
||||||
|
tile.toBukkitTry(state);
|
||||||
|
state.update();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@Decree(description = "Check the composition of an object")
|
@Decree(description = "Check the composition of an object")
|
||||||
public void analyze(
|
public void analyze(
|
||||||
@Param(description = "The object to analyze", customHandler = ObjectHandler.class)
|
@Param(description = "The object to analyze", customHandler = ObjectHandler.class)
|
||||||
@ -182,9 +272,6 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Set<Material> skipBlocks = Set.of(Material.GRASS, Material.SNOW, Material.VINE, Material.TORCH, Material.DEAD_BUSH,
|
|
||||||
Material.POPPY, Material.DANDELION);
|
|
||||||
|
|
||||||
@Decree(description = "Paste an object", sync = true)
|
@Decree(description = "Paste an object", sync = true)
|
||||||
public void paste(
|
public void paste(
|
||||||
@Param(description = "The object to paste", customHandler = ObjectHandler.class)
|
@Param(description = "The object to paste", customHandler = ObjectHandler.class)
|
||||||
@ -243,75 +330,6 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IObjectPlacer createPlacer(World world, Map<Block, BlockData> futureBlockChanges) {
|
|
||||||
|
|
||||||
return new IObjectPlacer() {
|
|
||||||
@Override
|
|
||||||
public int getHighest(int x, int z, IrisData data) {
|
|
||||||
return world.getHighestBlockYAt(x, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getHighest(int x, int z, IrisData data, boolean ignoreFluid) {
|
|
||||||
return world.getHighestBlockYAt(x, z, ignoreFluid ? HeightMap.OCEAN_FLOOR : HeightMap.MOTION_BLOCKING);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void set(int x, int y, int z, BlockData d) {
|
|
||||||
Block block = world.getBlockAt(x, y, z);
|
|
||||||
|
|
||||||
//Prevent blocks being set in or bellow bedrock
|
|
||||||
if (y <= world.getMinHeight() || block.getType() == Material.BEDROCK) return;
|
|
||||||
|
|
||||||
futureBlockChanges.put(block, block.getBlockData());
|
|
||||||
|
|
||||||
block.setBlockData(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockData get(int x, int y, int z) {
|
|
||||||
return world.getBlockAt(x, y, z).getBlockData();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPreventingDecay() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isCarved(int x, int y, int z) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSolid(int x, int y, int z) {
|
|
||||||
return world.getBlockAt(x, y, z).getType().isSolid();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isUnderwater(int x, int z) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getFluidHeight() {
|
|
||||||
return 63;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isDebugSmartBore() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setTile(int xx, int yy, int zz, TileData<? extends TileState> tile) {
|
|
||||||
BlockState state = world.getBlockAt(xx, yy, zz).getState();
|
|
||||||
tile.toBukkitTry(state);
|
|
||||||
state.update();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Decree(description = "Save an object")
|
@Decree(description = "Save an object")
|
||||||
public void save(
|
public void save(
|
||||||
@Param(description = "The dimension to store the object in", contextual = true)
|
@Param(description = "The dimension to store the object in", contextual = true)
|
||||||
|
@ -29,7 +29,22 @@ import com.volmit.iris.core.service.ConversionSVC;
|
|||||||
import com.volmit.iris.core.service.StudioSVC;
|
import com.volmit.iris.core.service.StudioSVC;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.InventorySlotType;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisEntity;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePositional;
|
||||||
|
import com.volmit.iris.engine.object.IrisGenerator;
|
||||||
|
import com.volmit.iris.engine.object.IrisInterpolator;
|
||||||
|
import com.volmit.iris.engine.object.IrisLootTable;
|
||||||
|
import com.volmit.iris.engine.object.IrisNoiseGenerator;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
|
import com.volmit.iris.engine.object.IrisScript;
|
||||||
|
import com.volmit.iris.engine.object.NoiseStyle;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
@ -58,13 +73,18 @@ import com.volmit.iris.util.scheduling.jobs.JobCollection;
|
|||||||
import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
import com.volmit.iris.util.scheduling.jobs.QueueJob;
|
||||||
import com.volmit.iris.util.scheduling.jobs.SingleJob;
|
import com.volmit.iris.util.scheduling.jobs.SingleJob;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.FluidCollisionMode;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.event.inventory.InventoryType;
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Desktop;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -81,6 +101,10 @@ import java.util.function.Supplier;
|
|||||||
|
|
||||||
@Decree(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", studio = true)
|
@Decree(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", studio = true)
|
||||||
public class CommandStudio implements DecreeExecutor {
|
public class CommandStudio implements DecreeExecutor {
|
||||||
|
public static String hrf(Duration duration) {
|
||||||
|
return duration.toString().substring(2).replaceAll("(\\d[HMS])(?!$)", "$1 ").toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
@Decree(description = "Open a new studio world", aliases = "o", sync = true)
|
@Decree(description = "Open a new studio world", aliases = "o", sync = true)
|
||||||
public void open(
|
public void open(
|
||||||
@Param(defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
|
@Param(defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
|
||||||
@ -261,7 +285,6 @@ public class CommandStudio implements DecreeExecutor {
|
|||||||
Iris.service(ConversionSVC.class).check(sender());
|
Iris.service(ConversionSVC.class).check(sender());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Decree(description = "Edit the biome you are currently in", aliases = {"ebiome", "eb"}, origin = DecreeOrigin.PLAYER)
|
@Decree(description = "Edit the biome you are currently in", aliases = {"ebiome", "eb"}, origin = DecreeOrigin.PLAYER)
|
||||||
public void editbiome(
|
public void editbiome(
|
||||||
@Param(contextual = true, description = "The biome to edit")
|
@Param(contextual = true, description = "The biome to edit")
|
||||||
@ -882,10 +905,6 @@ public class CommandStudio implements DecreeExecutor {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String hrf(Duration duration) {
|
|
||||||
return duration.toString().substring(2).replaceAll("(\\d[HMS])(?!$)", "$1 ").toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if server GUIs are not enabled
|
* @return true if server GUIs are not enabled
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,31 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
public class BlockSignal {
|
public class BlockSignal {
|
||||||
public static final AtomicInteger active = new AtomicInteger(0);
|
public static final AtomicInteger active = new AtomicInteger(0);
|
||||||
|
|
||||||
|
public BlockSignal(Block block, int ticks) {
|
||||||
|
active.incrementAndGet();
|
||||||
|
Location tg = block.getLocation().clone().add(0.5, 0, 0.5).clone();
|
||||||
|
FallingBlock e = block.getWorld().spawnFallingBlock(tg.clone(), block.getBlockData());
|
||||||
|
e.setGravity(false);
|
||||||
|
e.setInvulnerable(true);
|
||||||
|
e.setGlowing(true);
|
||||||
|
e.teleport(tg.clone());
|
||||||
|
e.setDropItem(false);
|
||||||
|
e.setHurtEntities(false);
|
||||||
|
e.setSilent(true);
|
||||||
|
e.setTicksLived(1);
|
||||||
|
e.setVelocity(new Vector(0, 0, 0));
|
||||||
|
J.s(() -> {
|
||||||
|
e.remove();
|
||||||
|
active.decrementAndGet();
|
||||||
|
BlockData type = block.getBlockData();
|
||||||
|
MultiBurst.burst.lazy(() -> {
|
||||||
|
for (Player i : block.getWorld().getPlayers()) {
|
||||||
|
i.sendBlockChange(block.getLocation(), block.getBlockData());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, ticks);
|
||||||
|
}
|
||||||
|
|
||||||
public static void of(Block block, int ticks) {
|
public static void of(Block block, int ticks) {
|
||||||
new BlockSignal(block, ticks);
|
new BlockSignal(block, ticks);
|
||||||
}
|
}
|
||||||
@ -80,29 +105,4 @@ public class BlockSignal {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockSignal(Block block, int ticks) {
|
|
||||||
active.incrementAndGet();
|
|
||||||
Location tg = block.getLocation().clone().add(0.5, 0, 0.5).clone();
|
|
||||||
FallingBlock e = block.getWorld().spawnFallingBlock(tg.clone(), block.getBlockData());
|
|
||||||
e.setGravity(false);
|
|
||||||
e.setInvulnerable(true);
|
|
||||||
e.setGlowing(true);
|
|
||||||
e.teleport(tg.clone());
|
|
||||||
e.setDropItem(false);
|
|
||||||
e.setHurtEntities(false);
|
|
||||||
e.setSilent(true);
|
|
||||||
e.setTicksLived(1);
|
|
||||||
e.setVelocity(new Vector(0, 0, 0));
|
|
||||||
J.s(() -> {
|
|
||||||
e.remove();
|
|
||||||
active.decrementAndGet();
|
|
||||||
BlockData type = block.getBlockData();
|
|
||||||
MultiBurst.burst.lazy(() -> {
|
|
||||||
for (Player i : block.getWorld().getPlayers()) {
|
|
||||||
i.sendBlockChange(block.getLocation(), block.getBlockData());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, ticks);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -41,24 +41,6 @@ public class DustRevealer {
|
|||||||
private final String key;
|
private final String key;
|
||||||
private final KList<BlockPosition> hits;
|
private final KList<BlockPosition> hits;
|
||||||
|
|
||||||
public static void spawn(Block block, VolmitSender sender) {
|
|
||||||
World world = block.getWorld();
|
|
||||||
Engine access = IrisToolbelt.access(world).getEngine();
|
|
||||||
|
|
||||||
if (access != null) {
|
|
||||||
String a = access.getObjectPlacementKey(block.getX(), block.getY(), block.getZ());
|
|
||||||
|
|
||||||
if (a != null) {
|
|
||||||
world.playSound(block.getLocation(), Sound.ITEM_LODESTONE_COMPASS_LOCK, 1f, 0.1f);
|
|
||||||
|
|
||||||
sender.sendMessage("Found object " + a);
|
|
||||||
J.a(() -> {
|
|
||||||
new DustRevealer(access, world, new BlockPosition(block.getX(), block.getY(), block.getZ()), a, new KList<>());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DustRevealer(Engine engine, World world, BlockPosition block, String key, KList<BlockPosition> hits) {
|
public DustRevealer(Engine engine, World world, BlockPosition block, String key, KList<BlockPosition> hits) {
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
this.world = world;
|
this.world = world;
|
||||||
@ -111,6 +93,24 @@ public class DustRevealer {
|
|||||||
}, RNG.r.i(2, 8));
|
}, RNG.r.i(2, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void spawn(Block block, VolmitSender sender) {
|
||||||
|
World world = block.getWorld();
|
||||||
|
Engine access = IrisToolbelt.access(world).getEngine();
|
||||||
|
|
||||||
|
if (access != null) {
|
||||||
|
String a = access.getObjectPlacementKey(block.getX(), block.getY(), block.getZ());
|
||||||
|
|
||||||
|
if (a != null) {
|
||||||
|
world.playSound(block.getLocation(), Sound.ITEM_LODESTONE_COMPASS_LOCK, 1f, 0.1f);
|
||||||
|
|
||||||
|
sender.sendMessage("Found object " + a);
|
||||||
|
J.a(() -> {
|
||||||
|
new DustRevealer(access, world, new BlockPosition(block.getX(), block.getY(), block.getZ()), a, new KList<>());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private boolean is(BlockPosition a) {
|
private boolean is(BlockPosition a) {
|
||||||
if (isValidTry(a) && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()) != null && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()).equals(key)) {
|
if (isValidTry(a) && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()) != null && engine.getObjectPlacementKey(a.getX(), a.getY(), a.getZ()).equals(key)) {
|
||||||
hits.add(a);
|
hits.add(a);
|
||||||
|
@ -21,7 +21,11 @@ package com.volmit.iris.core.edit;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.service.WandSVC;
|
import com.volmit.iris.core.service.WandSVC;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisDirection;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
@ -53,9 +57,9 @@ public class JigsawEditor implements Listener {
|
|||||||
private final Location origin;
|
private final Location origin;
|
||||||
private final Cuboid cuboid;
|
private final Cuboid cuboid;
|
||||||
private final int ticker;
|
private final int ticker;
|
||||||
private Location target;
|
|
||||||
private final KMap<IrisPosition, Runnable> falling = new KMap<>();
|
private final KMap<IrisPosition, Runnable> falling = new KMap<>();
|
||||||
private final ChronoLatch cl = new ChronoLatch(100);
|
private final ChronoLatch cl = new ChronoLatch(100);
|
||||||
|
private Location target;
|
||||||
|
|
||||||
public JigsawEditor(Player player, IrisJigsawPiece piece, IrisObject object, File saveLocation) {
|
public JigsawEditor(Player player, IrisJigsawPiece piece, IrisObject object, File saveLocation) {
|
||||||
if (editors.containsKey(player)) {
|
if (editors.containsKey(player)) {
|
||||||
|
@ -36,12 +36,12 @@ public class IrisEngineEvent extends Event {
|
|||||||
super(true);
|
super(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@ public class IrisEngineHotloadEvent extends IrisEngineEvent {
|
|||||||
super(engine);
|
super(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HandlerList getHandlerList() {
|
|
||||||
return handlers;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,24 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.JComboBox;
|
||||||
import java.awt.*;
|
import javax.swing.JComponent;
|
||||||
import java.awt.event.*;
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLayeredPane;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.JViewport;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.EventQueue;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseMotionListener;
|
||||||
|
import java.awt.event.MouseWheelEvent;
|
||||||
|
import java.awt.event.MouseWheelListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -50,13 +65,19 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
|||||||
|
|
||||||
static JComboBox<String> combo;
|
static JComboBox<String> combo;
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
|
static boolean hd = false;
|
||||||
|
static double ascale = 10;
|
||||||
|
static double oxp = 0;
|
||||||
|
static double ozp = 0;
|
||||||
|
static double mxx = 0;
|
||||||
|
static double mzz = 0;
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
|
static boolean down = false;
|
||||||
|
@SuppressWarnings("CanBeFinal")
|
||||||
RollingSequence r = new RollingSequence(20);
|
RollingSequence r = new RollingSequence(20);
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
boolean colorMode = true;
|
boolean colorMode = true;
|
||||||
double scale = 1;
|
double scale = 1;
|
||||||
@SuppressWarnings("CanBeFinal")
|
|
||||||
static boolean hd = false;
|
|
||||||
static double ascale = 10;
|
|
||||||
CNG cng = NoiseStyle.STATIC.create(new RNG(RNG.r.nextLong()));
|
CNG cng = NoiseStyle.STATIC.create(new RNG(RNG.r.nextLong()));
|
||||||
@SuppressWarnings("CanBeFinal")
|
@SuppressWarnings("CanBeFinal")
|
||||||
MultiBurst gx = MultiBurst.burst;
|
MultiBurst gx = MultiBurst.burst;
|
||||||
@ -66,16 +87,10 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
|||||||
int h = 0;
|
int h = 0;
|
||||||
Function2<Double, Double, Double> generator;
|
Function2<Double, Double, Double> generator;
|
||||||
Supplier<Function2<Double, Double, Double>> loader;
|
Supplier<Function2<Double, Double, Double>> loader;
|
||||||
static double oxp = 0;
|
|
||||||
static double ozp = 0;
|
|
||||||
double ox = 0; //Offset X
|
double ox = 0; //Offset X
|
||||||
double oz = 0; //Offset Y
|
double oz = 0; //Offset Y
|
||||||
double mx = 0;
|
double mx = 0;
|
||||||
double mz = 0;
|
double mz = 0;
|
||||||
static double mxx = 0;
|
|
||||||
static double mzz = 0;
|
|
||||||
@SuppressWarnings("CanBeFinal")
|
|
||||||
static boolean down = false;
|
|
||||||
double lx = Double.MAX_VALUE; //MouseX
|
double lx = Double.MAX_VALUE; //MouseX
|
||||||
double lz = Double.MAX_VALUE; //MouseY
|
double lz = Double.MAX_VALUE; //MouseY
|
||||||
double t;
|
double t;
|
||||||
@ -106,6 +121,77 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void createAndShowGUI(Supplier<Function2<Double, Double, Double>> loader, String genName) {
|
||||||
|
JFrame frame = new JFrame("Noise Explorer: " + genName);
|
||||||
|
NoiseExplorerGUI nv = new NoiseExplorerGUI();
|
||||||
|
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||||
|
JLayeredPane pane = new JLayeredPane();
|
||||||
|
nv.setSize(new Dimension(1440, 820));
|
||||||
|
pane.add(nv, 1, 0);
|
||||||
|
nv.loader = loader;
|
||||||
|
nv.generator = loader.get();
|
||||||
|
frame.add(pane);
|
||||||
|
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
||||||
|
|
||||||
|
if (file != null) {
|
||||||
|
try {
|
||||||
|
frame.setIconImage(ImageIO.read(file));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
frame.setSize(1440, 820);
|
||||||
|
frame.setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void createAndShowGUI() {
|
||||||
|
JFrame frame = new JFrame("Noise Explorer");
|
||||||
|
NoiseExplorerGUI nv = new NoiseExplorerGUI();
|
||||||
|
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||||
|
KList<String> li = new KList<>(NoiseStyle.values()).toStringList();
|
||||||
|
combo = new JComboBox<>(li.toArray(new String[0]));
|
||||||
|
combo.setSelectedItem("STATIC");
|
||||||
|
combo.setFocusable(false);
|
||||||
|
combo.addActionListener(e -> {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
String b = (String) (((JComboBox<String>) e.getSource()).getSelectedItem());
|
||||||
|
NoiseStyle s = NoiseStyle.valueOf(b);
|
||||||
|
nv.cng = s.create(RNG.r.nextParallelRNG(RNG.r.imax()));
|
||||||
|
});
|
||||||
|
|
||||||
|
combo.setSize(500, 30);
|
||||||
|
JLayeredPane pane = new JLayeredPane();
|
||||||
|
nv.setSize(new Dimension(1440, 820));
|
||||||
|
pane.add(nv, 1, 0);
|
||||||
|
pane.add(combo, 2, 0);
|
||||||
|
frame.add(pane);
|
||||||
|
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
||||||
|
|
||||||
|
if (file != null) {
|
||||||
|
try {
|
||||||
|
frame.setIconImage(ImageIO.read(file));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
frame.setSize(1440, 820);
|
||||||
|
frame.setVisible(true);
|
||||||
|
frame.addWindowListener(new java.awt.event.WindowAdapter() {
|
||||||
|
@Override
|
||||||
|
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
|
||||||
|
Iris.instance.unregisterListener(nv);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void launch(Supplier<Function2<Double, Double, Double>> gen, String genName) {
|
||||||
|
EventQueue.invokeLater(() -> createAndShowGUI(gen, genName));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void launch() {
|
||||||
|
EventQueue.invokeLater(NoiseExplorerGUI::createAndShowGUI);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void on(IrisEngineHotloadEvent e) {
|
public void on(IrisEngineHotloadEvent e) {
|
||||||
if (generator != null)
|
if (generator != null)
|
||||||
@ -241,77 +327,6 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void createAndShowGUI(Supplier<Function2<Double, Double, Double>> loader, String genName) {
|
|
||||||
JFrame frame = new JFrame("Noise Explorer: " + genName);
|
|
||||||
NoiseExplorerGUI nv = new NoiseExplorerGUI();
|
|
||||||
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
|
||||||
JLayeredPane pane = new JLayeredPane();
|
|
||||||
nv.setSize(new Dimension(1440, 820));
|
|
||||||
pane.add(nv, 1, 0);
|
|
||||||
nv.loader = loader;
|
|
||||||
nv.generator = loader.get();
|
|
||||||
frame.add(pane);
|
|
||||||
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
|
||||||
|
|
||||||
if (file != null) {
|
|
||||||
try {
|
|
||||||
frame.setIconImage(ImageIO.read(file));
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
frame.setSize(1440, 820);
|
|
||||||
frame.setVisible(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void createAndShowGUI() {
|
|
||||||
JFrame frame = new JFrame("Noise Explorer");
|
|
||||||
NoiseExplorerGUI nv = new NoiseExplorerGUI();
|
|
||||||
frame.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
|
||||||
KList<String> li = new KList<>(NoiseStyle.values()).toStringList();
|
|
||||||
combo = new JComboBox<>(li.toArray(new String[0]));
|
|
||||||
combo.setSelectedItem("STATIC");
|
|
||||||
combo.setFocusable(false);
|
|
||||||
combo.addActionListener(e -> {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
String b = (String) (((JComboBox<String>) e.getSource()).getSelectedItem());
|
|
||||||
NoiseStyle s = NoiseStyle.valueOf(b);
|
|
||||||
nv.cng = s.create(RNG.r.nextParallelRNG(RNG.r.imax()));
|
|
||||||
});
|
|
||||||
|
|
||||||
combo.setSize(500, 30);
|
|
||||||
JLayeredPane pane = new JLayeredPane();
|
|
||||||
nv.setSize(new Dimension(1440, 820));
|
|
||||||
pane.add(nv, 1, 0);
|
|
||||||
pane.add(combo, 2, 0);
|
|
||||||
frame.add(pane);
|
|
||||||
File file = Iris.getCached("Iris Icon", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/icon.png");
|
|
||||||
|
|
||||||
if (file != null) {
|
|
||||||
try {
|
|
||||||
frame.setIconImage(ImageIO.read(file));
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
frame.setSize(1440, 820);
|
|
||||||
frame.setVisible(true);
|
|
||||||
frame.addWindowListener(new java.awt.event.WindowAdapter() {
|
|
||||||
@Override
|
|
||||||
public void windowClosing(java.awt.event.WindowEvent windowEvent) {
|
|
||||||
Iris.instance.unregisterListener(nv);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void launch(Supplier<Function2<Double, Double, Double>> gen, String genName) {
|
|
||||||
EventQueue.invokeLater(() -> createAndShowGUI(gen, genName));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void launch() {
|
|
||||||
EventQueue.invokeLater(NoiseExplorerGUI::createAndShowGUI);
|
|
||||||
}
|
|
||||||
|
|
||||||
static class HandScrollListener extends MouseAdapter {
|
static class HandScrollListener extends MouseAdapter {
|
||||||
private static final Point pp = new Point();
|
private static final Point pp = new Point();
|
||||||
|
|
||||||
|
@ -31,8 +31,12 @@ import com.volmit.iris.util.math.M;
|
|||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.JFrame;
|
||||||
import java.awt.*;
|
import javax.swing.JPanel;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Font;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.KeyListener;
|
import java.awt.event.KeyListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@ -40,22 +44,22 @@ import java.util.concurrent.locks.ReentrantLock;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class PregeneratorJob implements PregenListener {
|
public class PregeneratorJob implements PregenListener {
|
||||||
public static PregeneratorJob instance;
|
|
||||||
private static final Color COLOR_EXISTS = parseColor("#4d7d5b");
|
private static final Color COLOR_EXISTS = parseColor("#4d7d5b");
|
||||||
private static final Color COLOR_GENERATING = parseColor("#0062ff");
|
private static final Color COLOR_GENERATING = parseColor("#0062ff");
|
||||||
private static final Color COLOR_NETWORK = parseColor("#a863c2");
|
private static final Color COLOR_NETWORK = parseColor("#a863c2");
|
||||||
private static final Color COLOR_NETWORK_GENERATING = parseColor("#836b8c");
|
private static final Color COLOR_NETWORK_GENERATING = parseColor("#836b8c");
|
||||||
private static final Color COLOR_GENERATED = parseColor("#34eb93");
|
private static final Color COLOR_GENERATED = parseColor("#34eb93");
|
||||||
private JFrame frame;
|
public static PregeneratorJob instance;
|
||||||
private final PregenTask task;
|
private final PregenTask task;
|
||||||
private final boolean saving;
|
private final boolean saving;
|
||||||
private final KList<Consumer<Double>> onProgress = new KList<>();
|
private final KList<Consumer<Double>> onProgress = new KList<>();
|
||||||
private final KList<Runnable> whenDone = new KList<>();
|
private final KList<Runnable> whenDone = new KList<>();
|
||||||
private final IrisPregenerator pregenerator;
|
private final IrisPregenerator pregenerator;
|
||||||
private PregenRenderer renderer;
|
|
||||||
private String[] info;
|
|
||||||
private final Position2 min;
|
private final Position2 min;
|
||||||
private final Position2 max;
|
private final Position2 max;
|
||||||
|
private JFrame frame;
|
||||||
|
private PregenRenderer renderer;
|
||||||
|
private String[] info;
|
||||||
|
|
||||||
public PregeneratorJob(PregenTask task, PregeneratorMethod method) {
|
public PregeneratorJob(PregenTask task, PregeneratorMethod method) {
|
||||||
instance = this;
|
instance = this;
|
||||||
@ -80,16 +84,6 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
J.a(this.pregenerator::start, 20);
|
J.a(this.pregenerator::start, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PregeneratorJob onProgress(Consumer<Double> c) {
|
|
||||||
onProgress.add(c);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PregeneratorJob whenDone(Runnable r) {
|
|
||||||
whenDone.add(r);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean shutdownInstance() {
|
public static boolean shutdownInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
return false;
|
return false;
|
||||||
@ -124,6 +118,28 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
return instance.paused();
|
return instance.paused();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Color parseColor(String c) {
|
||||||
|
String v = (c.startsWith("#") ? c : "#" + c).trim();
|
||||||
|
try {
|
||||||
|
return Color.decode(v);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
Iris.error("Error Parsing 'color', (" + c + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Color.RED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PregeneratorJob onProgress(Consumer<Double> c) {
|
||||||
|
onProgress.add(c);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PregeneratorJob whenDone(Runnable r) {
|
||||||
|
whenDone.add(r);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public void drawRegion(int x, int z, Color color) {
|
public void drawRegion(int x, int z, Color color) {
|
||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
||||||
@ -284,13 +300,13 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class PregenRenderer extends JPanel implements KeyListener {
|
public static class PregenRenderer extends JPanel implements KeyListener {
|
||||||
private PregeneratorJob job;
|
|
||||||
private static final long serialVersionUID = 2094606939770332040L;
|
private static final long serialVersionUID = 2094606939770332040L;
|
||||||
private final KList<Runnable> order = new KList<>();
|
private final KList<Runnable> order = new KList<>();
|
||||||
private final int res = 512;
|
private final int res = 512;
|
||||||
Graphics2D bg;
|
|
||||||
private ReentrantLock l;
|
|
||||||
private final BufferedImage image = new BufferedImage(res, res, BufferedImage.TYPE_INT_RGB);
|
private final BufferedImage image = new BufferedImage(res, res, BufferedImage.TYPE_INT_RGB);
|
||||||
|
Graphics2D bg;
|
||||||
|
private PregeneratorJob job;
|
||||||
|
private ReentrantLock l;
|
||||||
private Consumer2<Position2, Color> func;
|
private Consumer2<Position2, Color> func;
|
||||||
private JFrame frame;
|
private JFrame frame;
|
||||||
|
|
||||||
@ -375,16 +391,4 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
frame.setVisible(false);
|
frame.setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Color parseColor(String c) {
|
|
||||||
String v = (c.startsWith("#") ? c : "#" + c).trim();
|
|
||||||
try {
|
|
||||||
return Color.decode(v);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
Iris.error("Error Parsing 'color', (" + c + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
return Color.RED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -44,10 +44,20 @@ import org.bukkit.entity.LivingEntity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JPanel;
|
||||||
import javax.swing.event.MouseInputListener;
|
import javax.swing.event.MouseInputListener;
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.awt.event.*;
|
import java.awt.Font;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.KeyListener;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseMotionListener;
|
||||||
|
import java.awt.event.MouseWheelEvent;
|
||||||
|
import java.awt.event.MouseWheelListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -21,7 +21,7 @@ package com.volmit.iris.core.gui.components;
|
|||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package com.volmit.iris.core.gui.components;
|
package com.volmit.iris.core.gui.components;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface Renderer {
|
public interface Renderer {
|
||||||
|
@ -18,7 +18,12 @@
|
|||||||
|
|
||||||
package com.volmit.iris.core.loader;
|
package com.volmit.iris.core.loader;
|
||||||
|
|
||||||
import com.google.gson.*;
|
import com.google.gson.ExclusionStrategy;
|
||||||
|
import com.google.gson.FieldAttributes;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.TypeAdapter;
|
||||||
|
import com.google.gson.TypeAdapterFactory;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
import com.google.gson.stream.JsonReader;
|
import com.google.gson.stream.JsonReader;
|
||||||
import com.google.gson.stream.JsonToken;
|
import com.google.gson.stream.JsonToken;
|
||||||
@ -26,7 +31,23 @@ import com.google.gson.stream.JsonWriter;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBlockData;
|
||||||
|
import com.volmit.iris.engine.object.IrisCave;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisEntity;
|
||||||
|
import com.volmit.iris.engine.object.IrisExpression;
|
||||||
|
import com.volmit.iris.engine.object.IrisGenerator;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPool;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawStructure;
|
||||||
|
import com.volmit.iris.engine.object.IrisLootTable;
|
||||||
|
import com.volmit.iris.engine.object.IrisMod;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisRavine;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
|
import com.volmit.iris.engine.object.IrisScript;
|
||||||
|
import com.volmit.iris.engine.object.IrisSpawner;
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
@ -46,6 +67,8 @@ import java.util.function.Function;
|
|||||||
@Data
|
@Data
|
||||||
public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
||||||
private static final KMap<File, IrisData> dataLoaders = new KMap<>();
|
private static final KMap<File, IrisData> dataLoaders = new KMap<>();
|
||||||
|
private final File dataFolder;
|
||||||
|
private final int id;
|
||||||
private ResourceLoader<IrisBiome> biomeLoader;
|
private ResourceLoader<IrisBiome> biomeLoader;
|
||||||
private ResourceLoader<IrisLootTable> lootLoader;
|
private ResourceLoader<IrisLootTable> lootLoader;
|
||||||
private ResourceLoader<IrisRegion> regionLoader;
|
private ResourceLoader<IrisRegion> regionLoader;
|
||||||
@ -68,13 +91,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
private Gson snippetLoader;
|
private Gson snippetLoader;
|
||||||
private GsonBuilder builder;
|
private GsonBuilder builder;
|
||||||
private KMap<Class<? extends IrisRegistrant>, ResourceLoader<? extends IrisRegistrant>> loaders = new KMap<>();
|
private KMap<Class<? extends IrisRegistrant>, ResourceLoader<? extends IrisRegistrant>> loaders = new KMap<>();
|
||||||
private final File dataFolder;
|
|
||||||
private Engine engine;
|
private Engine engine;
|
||||||
private final int id;
|
|
||||||
|
|
||||||
public static IrisData get(File dataFolder) {
|
|
||||||
return dataLoaders.compute(dataFolder, (k, v) -> v == null ? new IrisData(dataFolder) : v);
|
|
||||||
}
|
|
||||||
|
|
||||||
private IrisData(File dataFolder) {
|
private IrisData(File dataFolder) {
|
||||||
this.engine = null;
|
this.engine = null;
|
||||||
@ -83,31 +100,14 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
hotloaded();
|
hotloaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IrisData get(File dataFolder) {
|
||||||
|
return dataLoaders.compute(dataFolder, (k, v) -> v == null ? new IrisData(dataFolder) : v);
|
||||||
|
}
|
||||||
|
|
||||||
public static void dereference() {
|
public static void dereference() {
|
||||||
dataLoaders.v().forEach(IrisData::cleanupEngine);
|
dataLoaders.v().forEach(IrisData::cleanupEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResourceLoader<?> getTypedLoaderFor(File f) {
|
|
||||||
String[] k = f.getPath().split("\\Q" + File.separator + "\\E");
|
|
||||||
|
|
||||||
for (String i : k) {
|
|
||||||
for (ResourceLoader<?> j : loaders.values()) {
|
|
||||||
if (j.getFolderName().equals(i)) {
|
|
||||||
return j;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cleanupEngine() {
|
|
||||||
if (engine != null && engine.isClosed()) {
|
|
||||||
engine = null;
|
|
||||||
Iris.debug("Dereferenced Data<Engine> " + getId() + " " + getDataFolder());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int cacheSize() {
|
public static int cacheSize() {
|
||||||
int m = 0;
|
int m = 0;
|
||||||
for (IrisData i : dataLoaders.values()) {
|
for (IrisData i : dataLoaders.values()) {
|
||||||
@ -119,119 +119,10 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void preprocessObject(IrisRegistrant t) {
|
|
||||||
try {
|
|
||||||
IrisContext ctx = IrisContext.get();
|
|
||||||
Engine engine = this.engine;
|
|
||||||
|
|
||||||
if (engine == null && ctx != null && ctx.getEngine() != null) {
|
|
||||||
engine = ctx.getEngine();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (engine == null && t.getPreprocessors().isNotEmpty()) {
|
|
||||||
Iris.error("Failed to preprocess object " + t.getLoadKey() + " because there is no engine context here. (See stack below)");
|
|
||||||
try {
|
|
||||||
throw new RuntimeException();
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (engine != null && t.getPreprocessors().isNotEmpty()) {
|
|
||||||
synchronized (this) {
|
|
||||||
engine.getExecution().getAPI().setPreprocessorObject(t);
|
|
||||||
|
|
||||||
for (String i : t.getPreprocessors()) {
|
|
||||||
engine.getExecution().execute(i);
|
|
||||||
Iris.debug("Loader<" + C.GREEN + t.getTypeName() + C.LIGHT_PURPLE + "> iprocess " + C.YELLOW + t.getLoadKey() + C.LIGHT_PURPLE + " in <rainbow>" + i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.error("Failed to preprocess object!");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void close() {
|
|
||||||
dump();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void printData(ResourceLoader<?> rl) {
|
private static void printData(ResourceLoader<?> rl) {
|
||||||
Iris.warn(" " + rl.getResourceTypeName() + " @ /" + rl.getFolderName() + ": Cache=" + rl.getLoadCache().size() + " Folders=" + rl.getFolders().size());
|
Iris.warn(" " + rl.getResourceTypeName() + " @ /" + rl.getFolderName() + ": Cache=" + rl.getLoadCache().size() + " Folders=" + rl.getFolders().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public IrisData copy() {
|
|
||||||
return IrisData.get(dataFolder);
|
|
||||||
}
|
|
||||||
|
|
||||||
private <T extends IrisRegistrant> ResourceLoader<T> registerLoader(Class<T> registrant) {
|
|
||||||
try {
|
|
||||||
IrisRegistrant rr = registrant.getConstructor().newInstance();
|
|
||||||
ResourceLoader<T> r = null;
|
|
||||||
if (registrant.equals(IrisObject.class)) {
|
|
||||||
r = (ResourceLoader<T>) new ObjectResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
|
||||||
} else if (registrant.equals(IrisScript.class)) {
|
|
||||||
r = (ResourceLoader<T>) new ScriptResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
|
||||||
} else {
|
|
||||||
J.attempt(() -> registrant.getConstructor().newInstance().registerTypeAdapters(builder));
|
|
||||||
r = new ResourceLoader<>(dataFolder, this, rr.getFolderName(), rr.getTypeName(), registrant);
|
|
||||||
}
|
|
||||||
|
|
||||||
loaders.put(registrant, r);
|
|
||||||
|
|
||||||
return r;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Iris.error("Failed to create loader! " + registrant.getCanonicalName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void hotloaded() {
|
|
||||||
possibleSnippets = new KMap<>();
|
|
||||||
builder = new GsonBuilder()
|
|
||||||
.addDeserializationExclusionStrategy(this)
|
|
||||||
.addSerializationExclusionStrategy(this)
|
|
||||||
.setLenient()
|
|
||||||
.registerTypeAdapterFactory(this)
|
|
||||||
.setPrettyPrinting();
|
|
||||||
loaders.clear();
|
|
||||||
File packs = dataFolder;
|
|
||||||
packs.mkdirs();
|
|
||||||
this.lootLoader = registerLoader(IrisLootTable.class);
|
|
||||||
this.spawnerLoader = registerLoader(IrisSpawner.class);
|
|
||||||
this.entityLoader = registerLoader(IrisEntity.class);
|
|
||||||
this.regionLoader = registerLoader(IrisRegion.class);
|
|
||||||
this.biomeLoader = registerLoader(IrisBiome.class);
|
|
||||||
this.modLoader = registerLoader(IrisMod.class);
|
|
||||||
this.dimensionLoader = registerLoader(IrisDimension.class);
|
|
||||||
this.jigsawPoolLoader = registerLoader(IrisJigsawPool.class);
|
|
||||||
this.jigsawStructureLoader = registerLoader(IrisJigsawStructure.class);
|
|
||||||
this.jigsawPieceLoader = registerLoader(IrisJigsawPiece.class);
|
|
||||||
this.generatorLoader = registerLoader(IrisGenerator.class);
|
|
||||||
this.caveLoader = registerLoader(IrisCave.class);
|
|
||||||
this.ravineLoader = registerLoader(IrisRavine.class);
|
|
||||||
this.blockLoader = registerLoader(IrisBlockData.class);
|
|
||||||
this.expressionLoader = registerLoader(IrisExpression.class);
|
|
||||||
this.objectLoader = registerLoader(IrisObject.class);
|
|
||||||
this.scriptLoader = registerLoader(IrisScript.class);
|
|
||||||
gson = builder.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dump() {
|
|
||||||
for (ResourceLoader<?> i : loaders.values()) {
|
|
||||||
i.clearCache();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearLists() {
|
|
||||||
for (ResourceLoader<?> i : loaders.values()) {
|
|
||||||
i.clearList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IrisObject loadAnyObject(String key) {
|
public static IrisObject loadAnyObject(String key) {
|
||||||
return loadAny(key, (dm) -> dm.getObjectLoader().load(key, false));
|
return loadAny(key, (dm) -> dm.getObjectLoader().load(key, false));
|
||||||
}
|
}
|
||||||
@ -320,6 +211,136 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResourceLoader<?> getTypedLoaderFor(File f) {
|
||||||
|
String[] k = f.getPath().split("\\Q" + File.separator + "\\E");
|
||||||
|
|
||||||
|
for (String i : k) {
|
||||||
|
for (ResourceLoader<?> j : loaders.values()) {
|
||||||
|
if (j.getFolderName().equals(i)) {
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cleanupEngine() {
|
||||||
|
if (engine != null && engine.isClosed()) {
|
||||||
|
engine = null;
|
||||||
|
Iris.debug("Dereferenced Data<Engine> " + getId() + " " + getDataFolder());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void preprocessObject(IrisRegistrant t) {
|
||||||
|
try {
|
||||||
|
IrisContext ctx = IrisContext.get();
|
||||||
|
Engine engine = this.engine;
|
||||||
|
|
||||||
|
if (engine == null && ctx != null && ctx.getEngine() != null) {
|
||||||
|
engine = ctx.getEngine();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engine == null && t.getPreprocessors().isNotEmpty()) {
|
||||||
|
Iris.error("Failed to preprocess object " + t.getLoadKey() + " because there is no engine context here. (See stack below)");
|
||||||
|
try {
|
||||||
|
throw new RuntimeException();
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (engine != null && t.getPreprocessors().isNotEmpty()) {
|
||||||
|
synchronized (this) {
|
||||||
|
engine.getExecution().getAPI().setPreprocessorObject(t);
|
||||||
|
|
||||||
|
for (String i : t.getPreprocessors()) {
|
||||||
|
engine.getExecution().execute(i);
|
||||||
|
Iris.debug("Loader<" + C.GREEN + t.getTypeName() + C.LIGHT_PURPLE + "> iprocess " + C.YELLOW + t.getLoadKey() + C.LIGHT_PURPLE + " in <rainbow>" + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.error("Failed to preprocess object!");
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
dump();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IrisData copy() {
|
||||||
|
return IrisData.get(dataFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T extends IrisRegistrant> ResourceLoader<T> registerLoader(Class<T> registrant) {
|
||||||
|
try {
|
||||||
|
IrisRegistrant rr = registrant.getConstructor().newInstance();
|
||||||
|
ResourceLoader<T> r = null;
|
||||||
|
if (registrant.equals(IrisObject.class)) {
|
||||||
|
r = (ResourceLoader<T>) new ObjectResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
||||||
|
} else if (registrant.equals(IrisScript.class)) {
|
||||||
|
r = (ResourceLoader<T>) new ScriptResourceLoader(dataFolder, this, rr.getFolderName(), rr.getTypeName());
|
||||||
|
} else {
|
||||||
|
J.attempt(() -> registrant.getConstructor().newInstance().registerTypeAdapters(builder));
|
||||||
|
r = new ResourceLoader<>(dataFolder, this, rr.getFolderName(), rr.getTypeName(), registrant);
|
||||||
|
}
|
||||||
|
|
||||||
|
loaders.put(registrant, r);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Iris.error("Failed to create loader! " + registrant.getCanonicalName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public synchronized void hotloaded() {
|
||||||
|
possibleSnippets = new KMap<>();
|
||||||
|
builder = new GsonBuilder()
|
||||||
|
.addDeserializationExclusionStrategy(this)
|
||||||
|
.addSerializationExclusionStrategy(this)
|
||||||
|
.setLenient()
|
||||||
|
.registerTypeAdapterFactory(this)
|
||||||
|
.setPrettyPrinting();
|
||||||
|
loaders.clear();
|
||||||
|
File packs = dataFolder;
|
||||||
|
packs.mkdirs();
|
||||||
|
this.lootLoader = registerLoader(IrisLootTable.class);
|
||||||
|
this.spawnerLoader = registerLoader(IrisSpawner.class);
|
||||||
|
this.entityLoader = registerLoader(IrisEntity.class);
|
||||||
|
this.regionLoader = registerLoader(IrisRegion.class);
|
||||||
|
this.biomeLoader = registerLoader(IrisBiome.class);
|
||||||
|
this.modLoader = registerLoader(IrisMod.class);
|
||||||
|
this.dimensionLoader = registerLoader(IrisDimension.class);
|
||||||
|
this.jigsawPoolLoader = registerLoader(IrisJigsawPool.class);
|
||||||
|
this.jigsawStructureLoader = registerLoader(IrisJigsawStructure.class);
|
||||||
|
this.jigsawPieceLoader = registerLoader(IrisJigsawPiece.class);
|
||||||
|
this.generatorLoader = registerLoader(IrisGenerator.class);
|
||||||
|
this.caveLoader = registerLoader(IrisCave.class);
|
||||||
|
this.ravineLoader = registerLoader(IrisRavine.class);
|
||||||
|
this.blockLoader = registerLoader(IrisBlockData.class);
|
||||||
|
this.expressionLoader = registerLoader(IrisExpression.class);
|
||||||
|
this.objectLoader = registerLoader(IrisObject.class);
|
||||||
|
this.scriptLoader = registerLoader(IrisScript.class);
|
||||||
|
gson = builder.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dump() {
|
||||||
|
for (ResourceLoader<?> i : loaders.values()) {
|
||||||
|
i.clearCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearLists() {
|
||||||
|
for (ResourceLoader<?> i : loaders.values()) {
|
||||||
|
i.clearList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String toLoadKey(File f) {
|
public String toLoadKey(File f) {
|
||||||
if (f.getPath().startsWith(getDataFolder().getPath())) {
|
if (f.getPath().startsWith(getDataFolder().getPath())) {
|
||||||
String[] full = f.getPath().split("\\Q" + File.separator + "\\E");
|
String[] full = f.getPath().split("\\Q" + File.separator + "\\E");
|
||||||
|
@ -29,7 +29,7 @@ import com.volmit.iris.util.json.JSONObject;
|
|||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Desktop;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -36,42 +36,6 @@ public enum NMSVersion {
|
|||||||
R1_9_2,
|
R1_9_2,
|
||||||
R1_8;
|
R1_8;
|
||||||
|
|
||||||
public List<NMSVersion> getAboveInclusive() {
|
|
||||||
List<NMSVersion> n = new ArrayList<>();
|
|
||||||
|
|
||||||
for (NMSVersion i : values()) {
|
|
||||||
if (i.ordinal() >= ordinal()) {
|
|
||||||
n.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NMSVersion> betweenInclusive(NMSVersion other) {
|
|
||||||
List<NMSVersion> n = new ArrayList<>();
|
|
||||||
|
|
||||||
for (NMSVersion i : values()) {
|
|
||||||
if (i.ordinal() <= Math.max(other.ordinal(), ordinal()) && i.ordinal() >= Math.min(ordinal(), other.ordinal())) {
|
|
||||||
n.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NMSVersion> getBelowInclusive() {
|
|
||||||
List<NMSVersion> n = new ArrayList<>();
|
|
||||||
|
|
||||||
for (NMSVersion i : values()) {
|
|
||||||
if (i.ordinal() <= ordinal()) {
|
|
||||||
n.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NMSVersion getMinimum() {
|
public static NMSVersion getMinimum() {
|
||||||
return values()[values().length - 1];
|
return values()[values().length - 1];
|
||||||
}
|
}
|
||||||
@ -138,4 +102,40 @@ public enum NMSVersion {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<NMSVersion> getAboveInclusive() {
|
||||||
|
List<NMSVersion> n = new ArrayList<>();
|
||||||
|
|
||||||
|
for (NMSVersion i : values()) {
|
||||||
|
if (i.ordinal() >= ordinal()) {
|
||||||
|
n.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NMSVersion> betweenInclusive(NMSVersion other) {
|
||||||
|
List<NMSVersion> n = new ArrayList<>();
|
||||||
|
|
||||||
|
for (NMSVersion i : values()) {
|
||||||
|
if (i.ordinal() <= Math.max(other.ordinal(), ordinal()) && i.ordinal() >= Math.min(ordinal(), other.ordinal())) {
|
||||||
|
n.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<NMSVersion> getBelowInclusive() {
|
||||||
|
List<NMSVersion> n = new ArrayList<>();
|
||||||
|
|
||||||
|
for (NMSVersion i : values()) {
|
||||||
|
if (i.ordinal() <= ordinal()) {
|
||||||
|
n.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,15 @@ import com.volmit.iris.engine.data.cache.AtomicCache;
|
|||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.nbt.io.NBTUtil;
|
import com.volmit.iris.util.nbt.io.NBTUtil;
|
||||||
import com.volmit.iris.util.nbt.mca.NBTWorld;
|
import com.volmit.iris.util.nbt.mca.NBTWorld;
|
||||||
import com.volmit.iris.util.nbt.mca.palette.*;
|
import com.volmit.iris.util.nbt.mca.palette.BiomeContainer;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.ChunkBiomeContainer;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.GlobalPalette;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.IdMap;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.IdMapper;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.Palette;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.PaletteAccess;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.PalettedContainer;
|
||||||
|
import com.volmit.iris.util.nbt.mca.palette.WrappedPalettedContainer;
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
import net.minecraft.core.BlockPosition;
|
import net.minecraft.core.BlockPosition;
|
||||||
import net.minecraft.core.IRegistry;
|
import net.minecraft.core.IRegistry;
|
||||||
@ -58,7 +66,12 @@ import org.bukkit.entity.EntityType;
|
|||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataInput;
|
||||||
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutput;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
|
@ -79,15 +79,6 @@ public class IrisPack {
|
|||||||
this.data = IrisData.get(folder);
|
this.data = IrisData.get(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete this pack. This invalidates this pack and you should
|
|
||||||
* probably no longer use this instance after deleting this pack
|
|
||||||
*/
|
|
||||||
public void delete() {
|
|
||||||
IO.delete(folder);
|
|
||||||
folder.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new pack from the input url
|
* Create a new pack from the input url
|
||||||
*
|
*
|
||||||
@ -109,6 +100,85 @@ public class IrisPack {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a pack from a repo
|
||||||
|
*
|
||||||
|
* @param sender the sender
|
||||||
|
* @param repo the repo
|
||||||
|
* @return the pack
|
||||||
|
* @throws MalformedURLException shit happens
|
||||||
|
*/
|
||||||
|
public static Future<IrisPack> from(VolmitSender sender, IrisPackRepository repo) throws MalformedURLException {
|
||||||
|
CompletableFuture<IrisPack> pack = new CompletableFuture<>();
|
||||||
|
repo.install(sender, () -> {
|
||||||
|
pack.complete(new IrisPack(repo.getRepo()));
|
||||||
|
});
|
||||||
|
return pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a blank pack with a given name
|
||||||
|
*
|
||||||
|
* @param name the name of the pack
|
||||||
|
* @return the pack
|
||||||
|
* @throws IrisException if the pack already exists or another error
|
||||||
|
*/
|
||||||
|
public static IrisPack blank(String name) throws IrisException {
|
||||||
|
File f = packsPack(name);
|
||||||
|
|
||||||
|
if (f.exists()) {
|
||||||
|
throw new IrisException("Already exists");
|
||||||
|
}
|
||||||
|
|
||||||
|
File fd = new File(f, "dimensions/" + name + ".json");
|
||||||
|
fd.getParentFile().mkdirs();
|
||||||
|
try {
|
||||||
|
IO.writeAll(fd, "{\n" +
|
||||||
|
" \"name\": \"" + Form.capitalize(name) + "\",\n" +
|
||||||
|
" \"version\": 1\n" +
|
||||||
|
"}\n");
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IrisException(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
|
||||||
|
IrisPack pack = new IrisPack(f);
|
||||||
|
pack.updateWorkspace();
|
||||||
|
return pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a packs pack folder for a name. Such that overworld would resolve as Iris/packs/overworld
|
||||||
|
*
|
||||||
|
* @param name the name
|
||||||
|
* @return the file path
|
||||||
|
*/
|
||||||
|
public static File packsPack(String name) {
|
||||||
|
return Iris.instance.getDataFolderNoCreate(StudioSVC.WORKSPACE_NAME, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static KList<File> collectFiles(File f, String fileExtension) {
|
||||||
|
KList<File> l = new KList<>();
|
||||||
|
|
||||||
|
if (f.isDirectory()) {
|
||||||
|
for (File i : f.listFiles()) {
|
||||||
|
l.addAll(collectFiles(i, fileExtension));
|
||||||
|
}
|
||||||
|
} else if (f.getName().endsWith("." + fileExtension)) {
|
||||||
|
l.add(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete this pack. This invalidates this pack and you should
|
||||||
|
* probably no longer use this instance after deleting this pack
|
||||||
|
*/
|
||||||
|
public void delete() {
|
||||||
|
IO.delete(folder);
|
||||||
|
folder.delete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of this pack
|
* Get the name of this pack
|
||||||
*
|
*
|
||||||
@ -311,74 +381,4 @@ public class IrisPack {
|
|||||||
|
|
||||||
return ws;
|
return ws;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a pack from a repo
|
|
||||||
*
|
|
||||||
* @param sender the sender
|
|
||||||
* @param repo the repo
|
|
||||||
* @return the pack
|
|
||||||
* @throws MalformedURLException shit happens
|
|
||||||
*/
|
|
||||||
public static Future<IrisPack> from(VolmitSender sender, IrisPackRepository repo) throws MalformedURLException {
|
|
||||||
CompletableFuture<IrisPack> pack = new CompletableFuture<>();
|
|
||||||
repo.install(sender, () -> {
|
|
||||||
pack.complete(new IrisPack(repo.getRepo()));
|
|
||||||
});
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a blank pack with a given name
|
|
||||||
*
|
|
||||||
* @param name the name of the pack
|
|
||||||
* @return the pack
|
|
||||||
* @throws IrisException if the pack already exists or another error
|
|
||||||
*/
|
|
||||||
public static IrisPack blank(String name) throws IrisException {
|
|
||||||
File f = packsPack(name);
|
|
||||||
|
|
||||||
if (f.exists()) {
|
|
||||||
throw new IrisException("Already exists");
|
|
||||||
}
|
|
||||||
|
|
||||||
File fd = new File(f, "dimensions/" + name + ".json");
|
|
||||||
fd.getParentFile().mkdirs();
|
|
||||||
try {
|
|
||||||
IO.writeAll(fd, "{\n" +
|
|
||||||
" \"name\": \"" + Form.capitalize(name) + "\",\n" +
|
|
||||||
" \"version\": 1\n" +
|
|
||||||
"}\n");
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new IrisException(e.getMessage(), e);
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisPack pack = new IrisPack(f);
|
|
||||||
pack.updateWorkspace();
|
|
||||||
return pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a packs pack folder for a name. Such that overworld would resolve as Iris/packs/overworld
|
|
||||||
*
|
|
||||||
* @param name the name
|
|
||||||
* @return the file path
|
|
||||||
*/
|
|
||||||
public static File packsPack(String name) {
|
|
||||||
return Iris.instance.getDataFolderNoCreate(StudioSVC.WORKSPACE_NAME, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static KList<File> collectFiles(File f, String fileExtension) {
|
|
||||||
KList<File> l = new KList<>();
|
|
||||||
|
|
||||||
if (f.isDirectory()) {
|
|
||||||
for (File i : f.listFiles()) {
|
|
||||||
l.addAll(collectFiles(i, fileExtension));
|
|
||||||
}
|
|
||||||
} else if (f.getName().endsWith("." + fileExtension)) {
|
|
||||||
l.add(f);
|
|
||||||
}
|
|
||||||
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -30,33 +30,20 @@ import java.util.Comparator;
|
|||||||
@Builder
|
@Builder
|
||||||
@Data
|
@Data
|
||||||
public class PregenTask {
|
public class PregenTask {
|
||||||
|
private static final KList<Position2> order = computeChunkOrder();
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private Position2 center = new Position2(0, 0);
|
private Position2 center = new Position2(0, 0);
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int width = 1;
|
private int width = 1;
|
||||||
|
|
||||||
@Builder.Default
|
@Builder.Default
|
||||||
private int height = 1;
|
private int height = 1;
|
||||||
|
|
||||||
private static final KList<Position2> order = computeChunkOrder();
|
|
||||||
|
|
||||||
public void iterateRegions(Spiraled s) {
|
|
||||||
new Spiraler(getWidth() * 2, getHeight() * 2, s)
|
|
||||||
.setOffset(center.getX(), center.getZ()).drain();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void iterateRegion(int xr, int zr, Spiraled s) {
|
public static void iterateRegion(int xr, int zr, Spiraled s) {
|
||||||
for (Position2 i : order) {
|
for (Position2 i : order) {
|
||||||
s.on(i.getX() + (xr << 5), i.getZ() + (zr << 5));
|
s.on(i.getX() + (xr << 5), i.getZ() + (zr << 5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void iterateAllChunks(Spiraled s) {
|
|
||||||
new Spiraler(getWidth() * 2, getHeight() * 2, (x, z) -> iterateRegion(x, z, s))
|
|
||||||
.setOffset(center.getX(), center.getZ()).drain();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static KList<Position2> computeChunkOrder() {
|
private static KList<Position2> computeChunkOrder() {
|
||||||
Position2 center = new Position2(15, 15);
|
Position2 center = new Position2(15, 15);
|
||||||
KList<Position2> p = new KList<>();
|
KList<Position2> p = new KList<>();
|
||||||
@ -72,4 +59,14 @@ public class PregenTask {
|
|||||||
p.sort(Comparator.comparing((i) -> i.distance(center)));
|
p.sort(Comparator.comparing((i) -> i.distance(center)));
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void iterateRegions(Spiraled s) {
|
||||||
|
new Spiraler(getWidth() * 2, getHeight() * 2, s)
|
||||||
|
.setOffset(center.getX(), center.getZ()).drain();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void iterateAllChunks(Spiraled s) {
|
||||||
|
new Spiraler(getWidth() * 2, getHeight() * 2, (x, z) -> iterateRegion(x, z, s))
|
||||||
|
.setOffset(center.getX(), center.getZ()).drain();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,14 @@ import com.volmit.iris.core.pregenerator.PregenListener;
|
|||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||||
import com.volmit.iris.core.pregenerator.syndicate.SyndicateClient;
|
import com.volmit.iris.core.pregenerator.syndicate.SyndicateClient;
|
||||||
import com.volmit.iris.core.pregenerator.syndicate.command.*;
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateBusy;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateClose;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateGenerate;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateGetProgress;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateInstallFirst;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateInstallPack;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateOK;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateSendProgress;
|
||||||
import com.volmit.iris.engine.object.IrisDimension;
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
@ -39,14 +46,14 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
public class SyndicatePregenMethod implements PregeneratorMethod {
|
public class SyndicatePregenMethod implements PregeneratorMethod {
|
||||||
@Getter
|
@Getter
|
||||||
private final String address;
|
private final String address;
|
||||||
private String nickname;
|
|
||||||
private final int port;
|
private final int port;
|
||||||
private final String password;
|
private final String password;
|
||||||
private final IrisDimension dimension;
|
private final IrisDimension dimension;
|
||||||
private boolean ready = false;
|
|
||||||
private final File worldFolder;
|
private final File worldFolder;
|
||||||
private final UUID pack = UUID.randomUUID();
|
private final UUID pack = UUID.randomUUID();
|
||||||
private final long seed;
|
private final long seed;
|
||||||
|
private String nickname;
|
||||||
|
private boolean ready = false;
|
||||||
|
|
||||||
public SyndicatePregenMethod(String nickname, File worldFolder, String address, int port, String password, IrisDimension dimension, long seed) {
|
public SyndicatePregenMethod(String nickname, File worldFolder, String address, int port, String password, IrisDimension dimension, long seed) {
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
|
@ -19,14 +19,26 @@
|
|||||||
package com.volmit.iris.core.pregenerator.syndicate;
|
package com.volmit.iris.core.pregenerator.syndicate;
|
||||||
|
|
||||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||||
import com.volmit.iris.core.pregenerator.syndicate.command.*;
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateBusy;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateClose;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateCommand;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateGenerate;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateGetProgress;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateInstallFirst;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateInstallPack;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateOK;
|
||||||
|
import com.volmit.iris.core.pregenerator.syndicate.command.SyndicateSendProgress;
|
||||||
import com.volmit.iris.engine.object.HeadlessWorld;
|
import com.volmit.iris.engine.object.HeadlessWorld;
|
||||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
import org.zeroturnaround.zip.ZipUtil;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.DataInputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.ServerSocket;
|
import java.net.ServerSocket;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.net.SocketTimeoutException;
|
import java.net.SocketTimeoutException;
|
||||||
@ -37,13 +49,13 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
public class SyndicateServer extends Thread implements PregenListener {
|
public class SyndicateServer extends Thread implements PregenListener {
|
||||||
private final int port;
|
private final int port;
|
||||||
private final String password;
|
private final String password;
|
||||||
private boolean busy;
|
|
||||||
private final int tc;
|
private final int tc;
|
||||||
private HeadlessGenerator generator;
|
|
||||||
private final ServerSocket server;
|
private final ServerSocket server;
|
||||||
private final File cache;
|
private final File cache;
|
||||||
private UUID currentId = null;
|
|
||||||
private final AtomicInteger g = new AtomicInteger(0);
|
private final AtomicInteger g = new AtomicInteger(0);
|
||||||
|
private boolean busy;
|
||||||
|
private HeadlessGenerator generator;
|
||||||
|
private UUID currentId = null;
|
||||||
private File lastGeneratedRegion = null;
|
private File lastGeneratedRegion = null;
|
||||||
|
|
||||||
public SyndicateServer(File cache, int port, String password, int tc) throws IOException {
|
public SyndicateServer(File cache, int port, String password, int tc) throws IOException {
|
||||||
|
@ -25,7 +25,16 @@ import com.volmit.iris.core.loader.IrisData;
|
|||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.core.loader.ResourceLoader;
|
import com.volmit.iris.core.loader.ResourceLoader;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBlockData;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisEntity;
|
||||||
|
import com.volmit.iris.engine.object.IrisGenerator;
|
||||||
|
import com.volmit.iris.engine.object.IrisLootTable;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
|
import com.volmit.iris.engine.object.IrisSpawner;
|
||||||
import com.volmit.iris.engine.object.annotations.Snippet;
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
@ -51,7 +60,8 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
import org.zeroturnaround.zip.ZipUtil;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Desktop;
|
||||||
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -70,6 +80,62 @@ public class IrisProject {
|
|||||||
this.name = path.getName();
|
this.name = path.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int clean(VolmitSender s, File clean) {
|
||||||
|
int c = 0;
|
||||||
|
if (clean.isDirectory()) {
|
||||||
|
for (File i : clean.listFiles()) {
|
||||||
|
c += clean(s, i);
|
||||||
|
}
|
||||||
|
} else if (clean.getName().endsWith(".json")) {
|
||||||
|
try {
|
||||||
|
clean(clean);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
Iris.error("Failed to beautify " + clean.getAbsolutePath() + " You may have errors in your json!");
|
||||||
|
}
|
||||||
|
|
||||||
|
c++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clean(File clean) throws IOException {
|
||||||
|
JSONObject obj = new JSONObject(IO.readAll(clean));
|
||||||
|
fixBlocks(obj, clean);
|
||||||
|
|
||||||
|
IO.writeAll(clean, obj.toString(4));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fixBlocks(JSONObject obj, File f) {
|
||||||
|
for (String i : obj.keySet()) {
|
||||||
|
Object o = obj.get(i);
|
||||||
|
|
||||||
|
if (i.equals("block") && o instanceof String && !o.toString().trim().isEmpty() && !o.toString().contains(":")) {
|
||||||
|
obj.put(i, "minecraft:" + o);
|
||||||
|
Iris.debug("Updated Block Key: " + o + " to " + obj.getString(i) + " in " + f.getPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (o instanceof JSONObject) {
|
||||||
|
fixBlocks((JSONObject) o, f);
|
||||||
|
} else if (o instanceof JSONArray) {
|
||||||
|
fixBlocks((JSONArray) o, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fixBlocks(JSONArray obj, File f) {
|
||||||
|
for (int i = 0; i < obj.length(); i++) {
|
||||||
|
Object o = obj.get(i);
|
||||||
|
|
||||||
|
if (o instanceof JSONObject) {
|
||||||
|
fixBlocks((JSONObject) o, f);
|
||||||
|
} else if (o instanceof JSONArray) {
|
||||||
|
fixBlocks((JSONArray) o, f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isOpen() {
|
public boolean isOpen() {
|
||||||
return activeProvider != null;
|
return activeProvider != null;
|
||||||
}
|
}
|
||||||
@ -479,62 +545,6 @@ public class IrisProject {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int clean(VolmitSender s, File clean) {
|
|
||||||
int c = 0;
|
|
||||||
if (clean.isDirectory()) {
|
|
||||||
for (File i : clean.listFiles()) {
|
|
||||||
c += clean(s, i);
|
|
||||||
}
|
|
||||||
} else if (clean.getName().endsWith(".json")) {
|
|
||||||
try {
|
|
||||||
clean(clean);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
Iris.error("Failed to beautify " + clean.getAbsolutePath() + " You may have errors in your json!");
|
|
||||||
}
|
|
||||||
|
|
||||||
c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void clean(File clean) throws IOException {
|
|
||||||
JSONObject obj = new JSONObject(IO.readAll(clean));
|
|
||||||
fixBlocks(obj, clean);
|
|
||||||
|
|
||||||
IO.writeAll(clean, obj.toString(4));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void fixBlocks(JSONObject obj, File f) {
|
|
||||||
for (String i : obj.keySet()) {
|
|
||||||
Object o = obj.get(i);
|
|
||||||
|
|
||||||
if (i.equals("block") && o instanceof String && !o.toString().trim().isEmpty() && !o.toString().contains(":")) {
|
|
||||||
obj.put(i, "minecraft:" + o);
|
|
||||||
Iris.debug("Updated Block Key: " + o + " to " + obj.getString(i) + " in " + f.getPath());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (o instanceof JSONObject) {
|
|
||||||
fixBlocks((JSONObject) o, f);
|
|
||||||
} else if (o instanceof JSONArray) {
|
|
||||||
fixBlocks((JSONArray) o, f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void fixBlocks(JSONArray obj, File f) {
|
|
||||||
for (int i = 0; i < obj.length(); i++) {
|
|
||||||
Object o = obj.get(i);
|
|
||||||
|
|
||||||
if (o instanceof JSONObject) {
|
|
||||||
fixBlocks((JSONObject) o, f);
|
|
||||||
} else if (o instanceof JSONArray) {
|
|
||||||
fixBlocks((JSONArray) o, f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void compile(VolmitSender sender) {
|
public void compile(VolmitSender sender) {
|
||||||
IrisData data = IrisData.get(getPath());
|
IrisData data = IrisData.get(getPath());
|
||||||
KList<Job> jobs = new KList<Job>();
|
KList<Job> jobs = new KList<Job>();
|
||||||
|
@ -22,7 +22,17 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.core.loader.ResourceLoader;
|
import com.volmit.iris.core.loader.ResourceLoader;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListBlockType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListFont;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListItemType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListSpecialEntity;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
@ -31,7 +41,7 @@ import com.volmit.iris.util.json.JSONObject;
|
|||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -57,6 +67,26 @@ public class SchemaBuilder {
|
|||||||
this.root = root;
|
this.root = root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static JSONArray getEnchantmentTypes() {
|
||||||
|
JSONArray a = new JSONArray();
|
||||||
|
|
||||||
|
for (Field gg : Enchantment.class.getDeclaredFields()) {
|
||||||
|
a.put(gg.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static JSONArray getPotionTypes() {
|
||||||
|
JSONArray a = new JSONArray();
|
||||||
|
|
||||||
|
for (PotionEffectType gg : PotionEffectType.values()) {
|
||||||
|
a.put(gg.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
|
||||||
|
}
|
||||||
|
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
public JSONObject compute() {
|
public JSONObject compute() {
|
||||||
JSONObject schema = new JSONObject();
|
JSONObject schema = new JSONObject();
|
||||||
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
|
schema.put("$schema", "http://json-schema.org/draft-07/schema#");
|
||||||
@ -649,24 +679,4 @@ public class SchemaBuilder {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static JSONArray getEnchantmentTypes() {
|
|
||||||
JSONArray a = new JSONArray();
|
|
||||||
|
|
||||||
for (Field gg : Enchantment.class.getDeclaredFields()) {
|
|
||||||
a.put(gg.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static JSONArray getPotionTypes() {
|
|
||||||
JSONArray a = new JSONArray();
|
|
||||||
|
|
||||||
for (PotionEffectType gg : PotionEffectType.values()) {
|
|
||||||
a.put(gg.getName().toUpperCase().replaceAll("\\Q \\E", "_"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -42,8 +42,8 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BoardSVC implements IrisService, BoardProvider {
|
public class BoardSVC implements IrisService, BoardProvider {
|
||||||
private com.volmit.iris.util.board.BoardManager manager;
|
|
||||||
private final KMap<Player, PlayerBoard> boards = new KMap<>();
|
private final KMap<Player, PlayerBoard> boards = new KMap<>();
|
||||||
|
private com.volmit.iris.util.board.BoardManager manager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -20,7 +20,12 @@ package com.volmit.iris.core.service;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisDirection;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPool;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@ -46,6 +51,9 @@ import java.io.IOException;
|
|||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class ConversionSVC implements IrisService {
|
public class ConversionSVC implements IrisService {
|
||||||
|
private KList<Converter> converters;
|
||||||
|
private File folder;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
folder = Iris.instance.getDataFolder("convert");
|
folder = Iris.instance.getDataFolder("convert");
|
||||||
@ -63,9 +71,6 @@ public class ConversionSVC implements IrisService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private KList<Converter> converters;
|
|
||||||
private File folder;
|
|
||||||
|
|
||||||
private String toPoolName(String poolReference) {
|
private String toPoolName(String poolReference) {
|
||||||
return poolReference.split("\\Q:\\E")[1];
|
return poolReference.split("\\Q:\\E")[1];
|
||||||
}
|
}
|
||||||
|
@ -50,9 +50,9 @@ import java.util.function.Consumer;
|
|||||||
public class StudioSVC implements IrisService {
|
public class StudioSVC implements IrisService {
|
||||||
public static final String LISTING = "https://raw.githubusercontent.com/IrisDimensions/_listing/main/listing-v2.json";
|
public static final String LISTING = "https://raw.githubusercontent.com/IrisDimensions/_listing/main/listing-v2.json";
|
||||||
public static final String WORKSPACE_NAME = "packs";
|
public static final String WORKSPACE_NAME = "packs";
|
||||||
|
private static final AtomicCache<Integer> counter = new AtomicCache<>();
|
||||||
private final KMap<String, String> cacheListing = null;
|
private final KMap<String, String> cacheListing = null;
|
||||||
private IrisProject activeProject;
|
private IrisProject activeProject;
|
||||||
private static final AtomicCache<Integer> counter = new AtomicCache<>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
@ -21,7 +21,14 @@ package com.volmit.iris.core.service;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
|
import com.volmit.iris.engine.object.IrisTreeModes;
|
||||||
|
import com.volmit.iris.engine.object.IrisTreeSize;
|
||||||
|
import com.volmit.iris.engine.object.TileData;
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
@ -30,7 +37,12 @@ import com.volmit.iris.util.math.BlockPosition;
|
|||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.plugin.IrisService;
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.HeightMap;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.TreeType;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.TileState;
|
import org.bukkit.block.TileState;
|
||||||
|
@ -31,7 +31,11 @@ import com.volmit.iris.util.matter.WorldMatter;
|
|||||||
import com.volmit.iris.util.plugin.IrisService;
|
import com.volmit.iris.util.plugin.IrisService;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -53,6 +57,205 @@ public class WandSVC implements IrisService {
|
|||||||
private static ItemStack wand;
|
private static ItemStack wand;
|
||||||
private static ItemStack dust;
|
private static ItemStack dust;
|
||||||
|
|
||||||
|
public static void pasteSchematic(IrisObject s, Location at) {
|
||||||
|
s.place(at);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an Iris Object from the 2 coordinates selected with a wand
|
||||||
|
*
|
||||||
|
* @param wand The wand itemstack
|
||||||
|
* @return The new object
|
||||||
|
*/
|
||||||
|
public static IrisObject createSchematic(ItemStack wand) {
|
||||||
|
if (!isWand(wand)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Location[] f = getCuboid(wand);
|
||||||
|
Cuboid c = new Cuboid(f[0], f[1]);
|
||||||
|
IrisObject s = new IrisObject(c.getSizeX(), c.getSizeY(), c.getSizeZ());
|
||||||
|
for (Block b : c) {
|
||||||
|
if (b.getType().equals(Material.AIR)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockVector bv = b.getLocation().subtract(c.getLowerNE().toVector()).toVector().toBlockVector();
|
||||||
|
s.setUnsigned(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ(), b);
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Iris.reportError(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an Iris Object from the 2 coordinates selected with a wand
|
||||||
|
*
|
||||||
|
* @param wand The wand itemstack
|
||||||
|
* @return The new object
|
||||||
|
*/
|
||||||
|
public static Matter createMatterSchem(Player p, ItemStack wand) {
|
||||||
|
if (!isWand(wand)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Location[] f = getCuboid(wand);
|
||||||
|
|
||||||
|
return WorldMatter.createMatter(p.getName(), f[0], f[1]);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Iris.reportError(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a user friendly location string to an actual Location
|
||||||
|
*
|
||||||
|
* @param s The string
|
||||||
|
* @return The location
|
||||||
|
*/
|
||||||
|
public static Location stringToLocation(String s) {
|
||||||
|
try {
|
||||||
|
String[] f = s.split("\\Q in \\E");
|
||||||
|
String[] g = f[0].split("\\Q,\\E");
|
||||||
|
return new Location(Bukkit.getWorld(f[1]), Integer.parseInt(g[0]), Integer.parseInt(g[1]), Integer.parseInt(g[2]));
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a user friendly string of a location
|
||||||
|
*
|
||||||
|
* @param loc The location
|
||||||
|
* @return The string
|
||||||
|
*/
|
||||||
|
public static String locationToString(Location loc) {
|
||||||
|
if (loc == null) {
|
||||||
|
return "<#>";
|
||||||
|
}
|
||||||
|
|
||||||
|
return loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + " in " + loc.getWorld().getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new blank Iris wand
|
||||||
|
*
|
||||||
|
* @return The wand itemstack
|
||||||
|
*/
|
||||||
|
public static ItemStack createWand() {
|
||||||
|
return createWand(null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new dust itemstack
|
||||||
|
*
|
||||||
|
* @return The stack
|
||||||
|
*/
|
||||||
|
public static ItemStack createDust() {
|
||||||
|
ItemStack is = new ItemStack(Material.GLOWSTONE_DUST);
|
||||||
|
is.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
|
||||||
|
ItemMeta im = is.getItemMeta();
|
||||||
|
im.setDisplayName(C.BOLD + "" + C.YELLOW + "Dust of Revealing");
|
||||||
|
im.setUnbreakable(true);
|
||||||
|
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS);
|
||||||
|
im.setLore(new KList<String>().qadd("Right click on a block to reveal it's placement structure!"));
|
||||||
|
is.setItemMeta(im);
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds an existing wand in a users inventory
|
||||||
|
*
|
||||||
|
* @param inventory The inventory to search
|
||||||
|
* @return The slot number the wand is in. Or -1 if none are found
|
||||||
|
*/
|
||||||
|
public static int findWand(Inventory inventory) {
|
||||||
|
ItemStack wand = createWand(); //Create blank wand
|
||||||
|
ItemMeta meta = wand.getItemMeta();
|
||||||
|
meta.setLore(new ArrayList<>()); //We are resetting the lore as the lore differs between wands
|
||||||
|
wand.setItemMeta(meta);
|
||||||
|
|
||||||
|
for (int s = 0; s < inventory.getSize(); s++) {
|
||||||
|
ItemStack stack = inventory.getItem(s);
|
||||||
|
if (stack == null) continue;
|
||||||
|
meta = stack.getItemMeta();
|
||||||
|
meta.setLore(new ArrayList<>()); //Reset the lore on this too so we can compare them
|
||||||
|
stack.setItemMeta(meta); //We dont need to clone the item as items from .get are cloned
|
||||||
|
|
||||||
|
if (wand.isSimilar(stack)) return s; //If the name, material and NBT is the same
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an Iris wand. The locations should be the currently selected locations, or null
|
||||||
|
*
|
||||||
|
* @param a Location A
|
||||||
|
* @param b Location B
|
||||||
|
* @return A new wand
|
||||||
|
*/
|
||||||
|
public static ItemStack createWand(Location a, Location b) {
|
||||||
|
ItemStack is = new ItemStack(Material.BLAZE_ROD);
|
||||||
|
is.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
|
||||||
|
ItemMeta im = is.getItemMeta();
|
||||||
|
im.setDisplayName(C.BOLD + "" + C.GOLD + "Wand of Iris");
|
||||||
|
im.setUnbreakable(true);
|
||||||
|
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS);
|
||||||
|
im.setLore(new KList<String>().add(locationToString(a), locationToString(b)));
|
||||||
|
is.setItemMeta(im);
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a pair of locations that are selected in an Iris wand
|
||||||
|
*
|
||||||
|
* @param is The wand item
|
||||||
|
* @return An array with the 2 locations
|
||||||
|
*/
|
||||||
|
public static Location[] getCuboid(ItemStack is) {
|
||||||
|
ItemMeta im = is.getItemMeta();
|
||||||
|
return new Location[]{stringToLocation(im.getLore().get(0)), stringToLocation(im.getLore().get(1))};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is a player holding an Iris wand
|
||||||
|
*
|
||||||
|
* @param p The player
|
||||||
|
* @return True if they are
|
||||||
|
*/
|
||||||
|
public static boolean isHoldingWand(Player p) {
|
||||||
|
ItemStack is = p.getInventory().getItemInMainHand();
|
||||||
|
return is != null && isWand(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is the itemstack passed an Iris wand
|
||||||
|
*
|
||||||
|
* @param is The itemstack
|
||||||
|
* @return True if it is
|
||||||
|
*/
|
||||||
|
public static boolean isWand(ItemStack is) {
|
||||||
|
ItemStack wand = createWand();
|
||||||
|
if (is.getItemMeta() == null) return false;
|
||||||
|
return is.getType().equals(wand.getType()) &&
|
||||||
|
is.getItemMeta().getDisplayName().equals(wand.getItemMeta().getDisplayName()) &&
|
||||||
|
is.getItemMeta().getEnchants().equals(wand.getItemMeta().getEnchants()) &&
|
||||||
|
is.getItemMeta().getItemFlags().equals(wand.getItemMeta().getItemFlags());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
wand = createWand();
|
wand = createWand();
|
||||||
@ -200,124 +403,6 @@ public class WandSVC implements IrisService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void pasteSchematic(IrisObject s, Location at) {
|
|
||||||
s.place(at);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an Iris Object from the 2 coordinates selected with a wand
|
|
||||||
*
|
|
||||||
* @param wand The wand itemstack
|
|
||||||
* @return The new object
|
|
||||||
*/
|
|
||||||
public static IrisObject createSchematic(ItemStack wand) {
|
|
||||||
if (!isWand(wand)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Location[] f = getCuboid(wand);
|
|
||||||
Cuboid c = new Cuboid(f[0], f[1]);
|
|
||||||
IrisObject s = new IrisObject(c.getSizeX(), c.getSizeY(), c.getSizeZ());
|
|
||||||
for (Block b : c) {
|
|
||||||
if (b.getType().equals(Material.AIR)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
BlockVector bv = b.getLocation().subtract(c.getLowerNE().toVector()).toVector().toBlockVector();
|
|
||||||
s.setUnsigned(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ(), b);
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an Iris Object from the 2 coordinates selected with a wand
|
|
||||||
*
|
|
||||||
* @param wand The wand itemstack
|
|
||||||
* @return The new object
|
|
||||||
*/
|
|
||||||
public static Matter createMatterSchem(Player p, ItemStack wand) {
|
|
||||||
if (!isWand(wand)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Location[] f = getCuboid(wand);
|
|
||||||
|
|
||||||
return WorldMatter.createMatter(p.getName(), f[0], f[1]);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a user friendly location string to an actual Location
|
|
||||||
*
|
|
||||||
* @param s The string
|
|
||||||
* @return The location
|
|
||||||
*/
|
|
||||||
public static Location stringToLocation(String s) {
|
|
||||||
try {
|
|
||||||
String[] f = s.split("\\Q in \\E");
|
|
||||||
String[] g = f[0].split("\\Q,\\E");
|
|
||||||
return new Location(Bukkit.getWorld(f[1]), Integer.parseInt(g[0]), Integer.parseInt(g[1]), Integer.parseInt(g[2]));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a user friendly string of a location
|
|
||||||
*
|
|
||||||
* @param loc The location
|
|
||||||
* @return The string
|
|
||||||
*/
|
|
||||||
public static String locationToString(Location loc) {
|
|
||||||
if (loc == null) {
|
|
||||||
return "<#>";
|
|
||||||
}
|
|
||||||
|
|
||||||
return loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + " in " + loc.getWorld().getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new blank Iris wand
|
|
||||||
*
|
|
||||||
* @return The wand itemstack
|
|
||||||
*/
|
|
||||||
public static ItemStack createWand() {
|
|
||||||
return createWand(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new dust itemstack
|
|
||||||
*
|
|
||||||
* @return The stack
|
|
||||||
*/
|
|
||||||
public static ItemStack createDust() {
|
|
||||||
ItemStack is = new ItemStack(Material.GLOWSTONE_DUST);
|
|
||||||
is.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
|
|
||||||
ItemMeta im = is.getItemMeta();
|
|
||||||
im.setDisplayName(C.BOLD + "" + C.YELLOW + "Dust of Revealing");
|
|
||||||
im.setUnbreakable(true);
|
|
||||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS);
|
|
||||||
im.setLore(new KList<String>().qadd("Right click on a block to reveal it's placement structure!"));
|
|
||||||
is.setItemMeta(im);
|
|
||||||
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the player holding Dust?
|
* Is the player holding Dust?
|
||||||
*
|
*
|
||||||
@ -361,85 +446,4 @@ public class WandSVC implements IrisService {
|
|||||||
|
|
||||||
return createWand(left ? a : other, left ? other : a);
|
return createWand(left ? a : other, left ? other : a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds an existing wand in a users inventory
|
|
||||||
*
|
|
||||||
* @param inventory The inventory to search
|
|
||||||
* @return The slot number the wand is in. Or -1 if none are found
|
|
||||||
*/
|
|
||||||
public static int findWand(Inventory inventory) {
|
|
||||||
ItemStack wand = createWand(); //Create blank wand
|
|
||||||
ItemMeta meta = wand.getItemMeta();
|
|
||||||
meta.setLore(new ArrayList<>()); //We are resetting the lore as the lore differs between wands
|
|
||||||
wand.setItemMeta(meta);
|
|
||||||
|
|
||||||
for (int s = 0; s < inventory.getSize(); s++) {
|
|
||||||
ItemStack stack = inventory.getItem(s);
|
|
||||||
if (stack == null) continue;
|
|
||||||
meta = stack.getItemMeta();
|
|
||||||
meta.setLore(new ArrayList<>()); //Reset the lore on this too so we can compare them
|
|
||||||
stack.setItemMeta(meta); //We dont need to clone the item as items from .get are cloned
|
|
||||||
|
|
||||||
if (wand.isSimilar(stack)) return s; //If the name, material and NBT is the same
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates an Iris wand. The locations should be the currently selected locations, or null
|
|
||||||
*
|
|
||||||
* @param a Location A
|
|
||||||
* @param b Location B
|
|
||||||
* @return A new wand
|
|
||||||
*/
|
|
||||||
public static ItemStack createWand(Location a, Location b) {
|
|
||||||
ItemStack is = new ItemStack(Material.BLAZE_ROD);
|
|
||||||
is.addUnsafeEnchantment(Enchantment.ARROW_INFINITE, 1);
|
|
||||||
ItemMeta im = is.getItemMeta();
|
|
||||||
im.setDisplayName(C.BOLD + "" + C.GOLD + "Wand of Iris");
|
|
||||||
im.setUnbreakable(true);
|
|
||||||
im.addItemFlags(ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_PLACED_ON, ItemFlag.HIDE_POTION_EFFECTS, ItemFlag.HIDE_DESTROYS, ItemFlag.HIDE_ENCHANTS);
|
|
||||||
im.setLore(new KList<String>().add(locationToString(a), locationToString(b)));
|
|
||||||
is.setItemMeta(im);
|
|
||||||
|
|
||||||
return is;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get a pair of locations that are selected in an Iris wand
|
|
||||||
*
|
|
||||||
* @param is The wand item
|
|
||||||
* @return An array with the 2 locations
|
|
||||||
*/
|
|
||||||
public static Location[] getCuboid(ItemStack is) {
|
|
||||||
ItemMeta im = is.getItemMeta();
|
|
||||||
return new Location[]{stringToLocation(im.getLore().get(0)), stringToLocation(im.getLore().get(1))};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is a player holding an Iris wand
|
|
||||||
*
|
|
||||||
* @param p The player
|
|
||||||
* @return True if they are
|
|
||||||
*/
|
|
||||||
public static boolean isHoldingWand(Player p) {
|
|
||||||
ItemStack is = p.getInventory().getItemInMainHand();
|
|
||||||
return is != null && isWand(is);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Is the itemstack passed an Iris wand
|
|
||||||
*
|
|
||||||
* @param is The itemstack
|
|
||||||
* @return True if it is
|
|
||||||
*/
|
|
||||||
public static boolean isWand(ItemStack is) {
|
|
||||||
ItemStack wand = createWand();
|
|
||||||
if (is.getItemMeta() == null) return false;
|
|
||||||
return is.getType().equals(wand.getType()) &&
|
|
||||||
is.getItemMeta().getDisplayName().equals(wand.getItemMeta().getDisplayName()) &&
|
|
||||||
is.getItemMeta().getEnchants().equals(wand.getItemMeta().getEnchants()) &&
|
|
||||||
is.getItemMeta().getItemFlags().equals(wand.getItemMeta().getItemFlags());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -28,18 +28,22 @@ import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
|||||||
import com.volmit.iris.util.exceptions.IrisException;
|
import com.volmit.iris.util.exceptions.IrisException;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.math.RNG;
|
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import com.volmit.iris.util.scheduling.O;
|
import com.volmit.iris.util.scheduling.O;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.GameRule;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.WorldCreator;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes it a lot easier to setup an engine, world, studio or whatever
|
* Makes it a lot easier to setup an engine, world, studio or whatever
|
||||||
@ -119,9 +123,15 @@ public class IrisCreator {
|
|||||||
J.a(() ->
|
J.a(() ->
|
||||||
{
|
{
|
||||||
int req = 441;
|
int req = 441;
|
||||||
|
Supplier<Integer> g = () -> {
|
||||||
while (finalAccess1.getEngine().getGenerated() < req) {
|
try {
|
||||||
double v = (double) finalAccess1.getEngine().getGenerated() / (double) req;
|
return finalAccess1.getEngine().getGenerated();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
while (g.get() < req) {
|
||||||
|
double v = (double) g.get() / (double) req;
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
sender.sendProgress(v, "Generating");
|
sender.sendProgress(v, "Generating");
|
||||||
|
@ -26,7 +26,7 @@ import org.bukkit.Particle;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
|
||||||
public class WandSelection {
|
public class WandSelection {
|
||||||
private final Cuboid c;
|
private final Cuboid c;
|
||||||
|
@ -23,7 +23,13 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.InferredType;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||||
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePositional;
|
||||||
|
import com.volmit.iris.engine.object.IrisGenerator;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
@ -41,11 +47,11 @@ import java.util.UUID;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class IrisComplex implements DataProvider {
|
public class IrisComplex implements DataProvider {
|
||||||
|
private static final BlockData AIR = Material.AIR.createBlockData();
|
||||||
private RNG rng;
|
private RNG rng;
|
||||||
private double fluidHeight;
|
private double fluidHeight;
|
||||||
private IrisData data;
|
private IrisData data;
|
||||||
private KList<IrisGenerator> generators;
|
private KList<IrisGenerator> generators;
|
||||||
private static final BlockData AIR = Material.AIR.createBlockData();
|
|
||||||
private ProceduralStream<IrisRegion> regionStream;
|
private ProceduralStream<IrisRegion> regionStream;
|
||||||
private ProceduralStream<Double> regionStyleStream;
|
private ProceduralStream<Double> regionStyleStream;
|
||||||
private ProceduralStream<Double> regionIdentityStream;
|
private ProceduralStream<Double> regionIdentityStream;
|
||||||
@ -81,24 +87,6 @@ public class IrisComplex implements DataProvider {
|
|||||||
private ProceduralStream<BlockData> fluidStream;
|
private ProceduralStream<BlockData> fluidStream;
|
||||||
private IrisBiome focus;
|
private IrisBiome focus;
|
||||||
|
|
||||||
public ProceduralStream<IrisBiome> getBiomeStream(InferredType type) {
|
|
||||||
switch (type) {
|
|
||||||
case CAVE:
|
|
||||||
return caveBiomeStream;
|
|
||||||
case LAND:
|
|
||||||
return landBiomeStream;
|
|
||||||
case SEA:
|
|
||||||
return seaBiomeStream;
|
|
||||||
case SHORE:
|
|
||||||
return shoreBiomeStream;
|
|
||||||
case DEFER:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IrisComplex(Engine engine) {
|
public IrisComplex(Engine engine) {
|
||||||
this(engine, false);
|
this(engine, false);
|
||||||
}
|
}
|
||||||
@ -316,6 +304,24 @@ public class IrisComplex implements DataProvider {
|
|||||||
//@done
|
//@done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ProceduralStream<IrisBiome> getBiomeStream(InferredType type) {
|
||||||
|
switch (type) {
|
||||||
|
case CAVE:
|
||||||
|
return caveBiomeStream;
|
||||||
|
case LAND:
|
||||||
|
return landBiomeStream;
|
||||||
|
case SEA:
|
||||||
|
return seaBiomeStream;
|
||||||
|
case SHORE:
|
||||||
|
return shoreBiomeStream;
|
||||||
|
case DEFER:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private IrisRegion findRegion(IrisBiome focus, Engine engine) {
|
private IrisRegion findRegion(IrisBiome focus, Engine engine) {
|
||||||
for (IrisRegion i : engine.getDimension().getAllRegions(engine)) {
|
for (IrisRegion i : engine.getDimension().getAllRegions(engine)) {
|
||||||
if (i.getAllBiomeIds().contains(focus.getLoadKey())) {
|
if (i.getAllBiomeIds().contains(focus.getLoadKey())) {
|
||||||
|
@ -29,14 +29,28 @@ import com.volmit.iris.engine.actuator.IrisBiomeActuator;
|
|||||||
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
||||||
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
|
import com.volmit.iris.engine.actuator.IrisTerrainNormalActuator;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.*;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
import com.volmit.iris.engine.framework.EngineEffects;
|
||||||
|
import com.volmit.iris.engine.framework.EngineMetrics;
|
||||||
|
import com.volmit.iris.engine.framework.EngineStage;
|
||||||
|
import com.volmit.iris.engine.framework.EngineTarget;
|
||||||
|
import com.volmit.iris.engine.framework.EngineWorldManager;
|
||||||
|
import com.volmit.iris.engine.framework.SeedManager;
|
||||||
|
import com.volmit.iris.engine.framework.WrongEngineBroException;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
|
import com.volmit.iris.engine.modifier.IrisBodyModifier;
|
||||||
import com.volmit.iris.engine.modifier.IrisCarveModifier;
|
import com.volmit.iris.engine.modifier.IrisCarveModifier;
|
||||||
import com.volmit.iris.engine.modifier.IrisDepositModifier;
|
import com.volmit.iris.engine.modifier.IrisDepositModifier;
|
||||||
|
import com.volmit.iris.engine.modifier.IrisPerfectionModifier;
|
||||||
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiomePaletteLayer;
|
||||||
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
|
import com.volmit.iris.engine.object.IrisEngineData;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
||||||
import com.volmit.iris.util.atomics.AtomicRollingSequence;
|
import com.volmit.iris.util.atomics.AtomicRollingSequence;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.context.IrisContext;
|
import com.volmit.iris.util.context.IrisContext;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
@ -72,39 +86,35 @@ public class IrisEngine implements Engine {
|
|||||||
private final AtomicLong lastGPS;
|
private final AtomicLong lastGPS;
|
||||||
private final EngineTarget target;
|
private final EngineTarget target;
|
||||||
private final IrisContext context;
|
private final IrisContext context;
|
||||||
private EngineEffects effects;
|
|
||||||
private final EngineMantle mantle;
|
private final EngineMantle mantle;
|
||||||
private final ChronoLatch perSecondLatch;
|
private final ChronoLatch perSecondLatch;
|
||||||
private final ChronoLatch perSecondBudLatch;
|
private final ChronoLatch perSecondBudLatch;
|
||||||
private EngineExecutionEnvironment execution;
|
|
||||||
private EngineWorldManager worldManager;
|
|
||||||
private volatile int parallelism;
|
|
||||||
private final EngineMetrics metrics;
|
private final EngineMetrics metrics;
|
||||||
private volatile int minHeight;
|
|
||||||
private final boolean studio;
|
private final boolean studio;
|
||||||
private boolean failing;
|
private final KList<EngineStage> stages;
|
||||||
private boolean closed;
|
|
||||||
private int cacheId;
|
|
||||||
private final AtomicRollingSequence wallClock;
|
private final AtomicRollingSequence wallClock;
|
||||||
private final int art;
|
private final int art;
|
||||||
private double maxBiomeObjectDensity;
|
|
||||||
private double maxBiomeLayerDensity;
|
|
||||||
private double maxBiomeDecoratorDensity;
|
|
||||||
private IrisComplex complex;
|
|
||||||
private EngineActuator<BlockData> terrainActuator;
|
|
||||||
private EngineActuator<BlockData> decorantActuator;
|
|
||||||
private EngineActuator<Biome> biomeActuator;
|
|
||||||
private EngineModifier<BlockData> depositModifier;
|
|
||||||
private EngineModifier<BlockData> caveModifier;
|
|
||||||
private EngineModifier<BlockData> postModifier;
|
|
||||||
private final AtomicCache<IrisEngineData> engineData = new AtomicCache<>();
|
private final AtomicCache<IrisEngineData> engineData = new AtomicCache<>();
|
||||||
private final AtomicBoolean cleaning;
|
private final AtomicBoolean cleaning;
|
||||||
private final ChronoLatch cleanLatch;
|
private final ChronoLatch cleanLatch;
|
||||||
private final SeedManager seedManager;
|
private final SeedManager seedManager;
|
||||||
|
private EngineEffects effects;
|
||||||
|
private EngineExecutionEnvironment execution;
|
||||||
|
private EngineWorldManager worldManager;
|
||||||
|
private volatile int parallelism;
|
||||||
|
private volatile int minHeight;
|
||||||
|
private boolean failing;
|
||||||
|
private boolean closed;
|
||||||
|
private int cacheId;
|
||||||
|
private double maxBiomeObjectDensity;
|
||||||
|
private double maxBiomeLayerDensity;
|
||||||
|
private double maxBiomeDecoratorDensity;
|
||||||
|
private IrisComplex complex;
|
||||||
|
|
||||||
public IrisEngine(EngineTarget target, boolean studio) {
|
public IrisEngine(EngineTarget target, boolean studio) {
|
||||||
this.studio = studio;
|
this.studio = studio;
|
||||||
this.target = target;
|
this.target = target;
|
||||||
|
stages = new KList<>();
|
||||||
getEngineData();
|
getEngineData();
|
||||||
verifySeed();
|
verifySeed();
|
||||||
this.seedManager = new SeedManager(target.getWorld().getRawWorldSeed());
|
this.seedManager = new SeedManager(target.getWorld().getRawWorldSeed());
|
||||||
@ -135,8 +145,7 @@ public class IrisEngine implements Engine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void verifySeed() {
|
private void verifySeed() {
|
||||||
if(getEngineData().getSeed() != null && getEngineData().getSeed() != target.getWorld().getRawWorldSeed())
|
if (getEngineData().getSeed() != null && getEngineData().getSeed() != target.getWorld().getRawWorldSeed()) {
|
||||||
{
|
|
||||||
target.getWorld().setRawWorldSeed(getEngineData().getSeed());
|
target.getWorld().setRawWorldSeed(getEngineData().getSeed());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,12 +165,8 @@ public class IrisEngine implements Engine {
|
|||||||
worldManager.close();
|
worldManager.close();
|
||||||
complex.close();
|
complex.close();
|
||||||
execution.close();
|
execution.close();
|
||||||
terrainActuator.close();
|
stages.forEach(EngineStage::close);
|
||||||
decorantActuator.close();
|
stages.clear();
|
||||||
biomeActuator.close();
|
|
||||||
depositModifier.close();
|
|
||||||
caveModifier.close();
|
|
||||||
postModifier.close();
|
|
||||||
effects.close();
|
effects.close();
|
||||||
J.a(() -> new IrisProject(getData().getDataFolder()).updateWorkspace());
|
J.a(() -> new IrisProject(getData().getDataFolder()).updateWorkspace());
|
||||||
}
|
}
|
||||||
@ -173,13 +178,8 @@ public class IrisEngine implements Engine {
|
|||||||
worldManager = new IrisWorldManager(this);
|
worldManager = new IrisWorldManager(this);
|
||||||
complex = new IrisComplex(this);
|
complex = new IrisComplex(this);
|
||||||
execution = new IrisExecutionEnvironment(this);
|
execution = new IrisExecutionEnvironment(this);
|
||||||
terrainActuator = new IrisTerrainNormalActuator(this);
|
|
||||||
decorantActuator = new IrisDecorantActuator(this);
|
|
||||||
biomeActuator = new IrisBiomeActuator(this);
|
|
||||||
depositModifier = new IrisDepositModifier(this);
|
|
||||||
postModifier = new IrisPostModifier(this);
|
|
||||||
caveModifier = new IrisCarveModifier(this);
|
|
||||||
effects = new IrisEngineEffects(this);
|
effects = new IrisEngineEffects(this);
|
||||||
|
setupStages();
|
||||||
J.a(this::computeBiomeMaxes);
|
J.a(this::computeBiomeMaxes);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.error("FAILED TO SETUP ENGINE!");
|
Iris.error("FAILED TO SETUP ENGINE!");
|
||||||
@ -189,6 +189,28 @@ public class IrisEngine implements Engine {
|
|||||||
Iris.debug("Engine Setup Complete " + getCacheID());
|
Iris.debug("Engine Setup Complete " + getCacheID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupStages() {
|
||||||
|
var terrain = new IrisTerrainNormalActuator(this);
|
||||||
|
var biome = new IrisBiomeActuator(this);
|
||||||
|
var decorant = new IrisDecorantActuator(this);
|
||||||
|
var cave = new IrisCarveModifier(this);
|
||||||
|
var post = new IrisPostModifier(this);
|
||||||
|
var deposit = new IrisDepositModifier(this);
|
||||||
|
var bodies = new IrisBodyModifier(this);
|
||||||
|
var perfection = new IrisPerfectionModifier(this);
|
||||||
|
|
||||||
|
registerStage((x, z, k, p, m) -> getMantle().generateMatter(x >> 4, z >> 4, m));
|
||||||
|
registerStage((x, z, k, p, m) -> terrain.actuate(x, z, k, m));
|
||||||
|
registerStage((x, z, k, p, m) -> biome.actuate(x, z, p, m));
|
||||||
|
registerStage((x, z, k, p, m) -> cave.modify(x >> 4, z >> 4, k, m));
|
||||||
|
registerStage((x, z, k, p, m) -> bodies.modify(x >> 4, z >> 4, k, m));
|
||||||
|
registerStage((x, z, k, p, m) -> decorant.actuate(x, z, k, m));
|
||||||
|
registerStage((x, z, k, p, m) -> post.modify(x, z, k, m));
|
||||||
|
registerStage((x, z, k, p, m) -> deposit.modify(x, z, k, m));
|
||||||
|
registerStage((x, z, K, p, m) -> getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, K, m));
|
||||||
|
registerStage((x, z, k, p, m) -> perfection.modify(x, z, k, m));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void hotload() {
|
public void hotload() {
|
||||||
hotloadSilently();
|
hotloadSilently();
|
||||||
@ -289,6 +311,11 @@ public class IrisEngine implements Engine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerStage(EngineStage stage) {
|
||||||
|
stages.add(stage);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockUpdatesPerSecond() {
|
public int getBlockUpdatesPerSecond() {
|
||||||
return buds.get();
|
return buds.get();
|
||||||
@ -356,12 +383,8 @@ public class IrisEngine implements Engine {
|
|||||||
getWorldManager().close();
|
getWorldManager().close();
|
||||||
getTarget().close();
|
getTarget().close();
|
||||||
saveEngineData();
|
saveEngineData();
|
||||||
getTerrainActuator().close();
|
stages.forEach(EngineStage::close);
|
||||||
getDecorantActuator().close();
|
stages.clear();
|
||||||
getBiomeActuator().close();
|
|
||||||
getDepositModifier().close();
|
|
||||||
getPostModifier().close();
|
|
||||||
getCaveModifier().close();
|
|
||||||
getMantle().close();
|
getMantle().close();
|
||||||
getComplex().close();
|
getComplex().close();
|
||||||
getData().dump();
|
getData().dump();
|
||||||
@ -434,15 +457,11 @@ public class IrisEngine implements Engine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
getMantle().generateMatter(x >> 4, z >> 4, multicore);
|
for (EngineStage i : stages) {
|
||||||
getTerrainActuator().actuate(x, z, blocks, multicore);
|
i.generate(x, z, blocks, vbiomes, multicore);
|
||||||
getBiomeActuator().actuate(x, z, vbiomes, multicore);
|
|
||||||
getDecorantActuator().actuate(x, z, blocks, multicore);
|
|
||||||
getCaveModifier().modify(x >> 4, z >> 4, blocks, multicore);
|
|
||||||
getPostModifier().modify(x, z, blocks, multicore);
|
|
||||||
getDepositModifier().modify(x, z, blocks, multicore);
|
|
||||||
getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
getMetrics().getTotal().put(p.getMilliseconds());
|
getMetrics().getTotal().put(p.getMilliseconds());
|
||||||
generated.incrementAndGet();
|
generated.incrementAndGet();
|
||||||
recycle();
|
recycle();
|
||||||
|
@ -23,8 +23,19 @@ import com.volmit.iris.engine.data.cache.AtomicCache;
|
|||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.MantleComponent;
|
import com.volmit.iris.engine.mantle.MantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.components.*;
|
import com.volmit.iris.engine.mantle.components.MantleCarvingComponent;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
|
||||||
|
import com.volmit.iris.engine.mantle.components.MantleFluidBodyComponent;
|
||||||
|
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
|
||||||
|
import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisDepositGenerator;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePotential;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawStructurePlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectScale;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
|
@ -22,7 +22,15 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineAssignedWorldManager;
|
import com.volmit.iris.engine.framework.EngineAssignedWorldManager;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IRare;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisBlockDrops;
|
||||||
|
import com.volmit.iris.engine.object.IrisEngineChunkData;
|
||||||
|
import com.volmit.iris.engine.object.IrisEngineData;
|
||||||
|
import com.volmit.iris.engine.object.IrisEngineSpawnerCooldown;
|
||||||
|
import com.volmit.iris.engine.object.IrisEntitySpawn;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
|
import com.volmit.iris.engine.object.IrisSpawner;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
@ -56,13 +64,13 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
private final int id;
|
private final int id;
|
||||||
private final KMap<Long, Long> chunkCooldowns;
|
private final KMap<Long, Long> chunkCooldowns;
|
||||||
private final KList<Runnable> updateQueue = new KList<>();
|
private final KList<Runnable> updateQueue = new KList<>();
|
||||||
private double energy = 25;
|
|
||||||
private int entityCount = 0;
|
|
||||||
private final ChronoLatch cl;
|
private final ChronoLatch cl;
|
||||||
private final ChronoLatch clw;
|
private final ChronoLatch clw;
|
||||||
private final ChronoLatch ecl;
|
private final ChronoLatch ecl;
|
||||||
private final ChronoLatch cln;
|
private final ChronoLatch cln;
|
||||||
private final ChronoLatch chunkUpdater;
|
private final ChronoLatch chunkUpdater;
|
||||||
|
private double energy = 25;
|
||||||
|
private int entityCount = 0;
|
||||||
private long charge = 0;
|
private long charge = 0;
|
||||||
private int actuallySpawned = 0;
|
private int actuallySpawned = 0;
|
||||||
private int cooldown = 0;
|
private int cooldown = 0;
|
||||||
|
@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.actuator;
|
package com.volmit.iris.engine.actuator;
|
||||||
|
|
||||||
import com.volmit.iris.engine.decorator.*;
|
import com.volmit.iris.engine.decorator.IrisCeilingDecorator;
|
||||||
|
import com.volmit.iris.engine.decorator.IrisSeaFloorDecorator;
|
||||||
|
import com.volmit.iris.engine.decorator.IrisSeaSurfaceDecorator;
|
||||||
|
import com.volmit.iris.engine.decorator.IrisShoreLineDecorator;
|
||||||
|
import com.volmit.iris.engine.decorator.IrisSurfaceDecorator;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineAssignedActuator;
|
import com.volmit.iris.engine.framework.EngineAssignedActuator;
|
||||||
import com.volmit.iris.engine.framework.EngineDecorator;
|
import com.volmit.iris.engine.framework.EngineDecorator;
|
||||||
|
@ -25,10 +25,6 @@ public interface Cache<V> {
|
|||||||
return key(chunk.getX(), chunk.getZ());
|
return key(chunk.getX(), chunk.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
int getId();
|
|
||||||
|
|
||||||
V get(int x, int z);
|
|
||||||
|
|
||||||
static long key(int x, int z) {
|
static long key(int x, int z) {
|
||||||
return (((long) x) << 32) | (z & 0xffffffffL);
|
return (((long) x) << 32) | (z & 0xffffffffL);
|
||||||
}
|
}
|
||||||
@ -52,4 +48,8 @@ public interface Cache<V> {
|
|||||||
final int x = idx % w;
|
final int x = idx % w;
|
||||||
return new int[]{x, y, z};
|
return new int[]{x, y, z};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getId();
|
||||||
|
|
||||||
|
V get(int x, int z);
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ import org.bukkit.material.MaterialData;
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class LinkedTerrainChunk implements TerrainChunk {
|
public class LinkedTerrainChunk implements TerrainChunk {
|
||||||
private final IrisBiomeStorage biome3D;
|
private final IrisBiomeStorage biome3D;
|
||||||
private ChunkData rawChunkData;
|
|
||||||
private final BiomeGrid storage;
|
private final BiomeGrid storage;
|
||||||
|
private ChunkData rawChunkData;
|
||||||
@Setter
|
@Setter
|
||||||
private boolean unsafe = false;
|
private boolean unsafe = false;
|
||||||
|
|
||||||
|
@ -46,18 +46,11 @@ public class MCATerrainChunk implements TerrainChunk {
|
|||||||
return injector;
|
return injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRaw(ChunkGenerator.ChunkData data) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int z) {
|
public Biome getBiome(int x, int z) {
|
||||||
return Biome.THE_VOID;
|
return Biome.THE_VOID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Biome getBiome(int x, int y, int z) {
|
public Biome getBiome(int x, int y, int z) {
|
||||||
return Biome.THE_VOID;
|
return Biome.THE_VOID;
|
||||||
@ -99,7 +92,6 @@ public class MCATerrainChunk implements TerrainChunk {
|
|||||||
mcaChunk.setBlockStateAt(xx, y, zz, NBTWorld.getCompound(blockData), false);
|
mcaChunk.setBlockStateAt(xx, y, zz, NBTWorld.getCompound(blockData), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.bukkit.block.data.BlockData getBlockData(int x, int y, int z) {
|
public org.bukkit.block.data.BlockData getBlockData(int x, int y, int z) {
|
||||||
if (y > getMaxHeight()) {
|
if (y > getMaxHeight()) {
|
||||||
@ -118,6 +110,11 @@ public class MCATerrainChunk implements TerrainChunk {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setRaw(ChunkGenerator.ChunkData data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inject(ChunkGenerator.BiomeGrid biome) {
|
public void inject(ChunkGenerator.BiomeGrid biome) {
|
||||||
|
|
||||||
|
@ -46,8 +46,6 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
|
|||||||
|
|
||||||
BiomeBaseInjector getBiomeBaseInjector();
|
BiomeBaseInjector getBiomeBaseInjector();
|
||||||
|
|
||||||
void setRaw(ChunkData data);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get biome at x, z within chunk being generated
|
* Get biome at x, z within chunk being generated
|
||||||
*
|
*
|
||||||
@ -129,5 +127,7 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
|
|||||||
|
|
||||||
ChunkData getRaw();
|
ChunkData getRaw();
|
||||||
|
|
||||||
|
void setRaw(ChunkData data);
|
||||||
|
|
||||||
void inject(BiomeGrid biome);
|
void inject(BiomeGrid biome);
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,12 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.data.io;
|
package com.volmit.iris.engine.data.io;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedInputStream;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
public interface Deserializer<T> {
|
public interface Deserializer<T> {
|
||||||
|
@ -18,7 +18,12 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.data.io;
|
package com.volmit.iris.engine.data.io;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.BufferedOutputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
public interface Serializer<T> {
|
public interface Serializer<T> {
|
||||||
|
|
||||||
|
@ -18,7 +18,13 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.data.io;
|
package com.volmit.iris.engine.data.io;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.StringReader;
|
||||||
|
|
||||||
public interface StringDeserializer<T> extends Deserializer<T> {
|
public interface StringDeserializer<T> extends Deserializer<T> {
|
||||||
|
|
||||||
|
@ -18,7 +18,13 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.data.io;
|
package com.volmit.iris.engine.data.io;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
|
||||||
public interface StringSerializer<T> extends Serializer<T> {
|
public interface StringSerializer<T> extends Serializer<T> {
|
||||||
|
|
||||||
|
@ -26,7 +26,18 @@ import com.volmit.iris.engine.IrisComplex;
|
|||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
import com.volmit.iris.engine.data.chunk.TerrainChunk;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.InventorySlotType;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisColor;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisEngineData;
|
||||||
|
import com.volmit.iris.engine.object.IrisLootMode;
|
||||||
|
import com.volmit.iris.engine.object.IrisLootReference;
|
||||||
|
import com.volmit.iris.engine.object.IrisLootTable;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
|
import com.volmit.iris.engine.object.IrisWorld;
|
||||||
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
import com.volmit.iris.engine.scripting.EngineExecutionEnvironment;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
@ -63,7 +74,7 @@ import org.bukkit.inventory.Inventory;
|
|||||||
import org.bukkit.inventory.InventoryHolder;
|
import org.bukkit.inventory.InventoryHolder;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
@ -73,6 +84,10 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdater, Renderer, Hotloadable {
|
public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdater, Renderer, Hotloadable {
|
||||||
|
KList<EngineStage> getStages();
|
||||||
|
|
||||||
|
void registerStage(EngineStage stage);
|
||||||
|
|
||||||
IrisComplex getComplex();
|
IrisComplex getComplex();
|
||||||
|
|
||||||
int getBlockUpdatesPerSecond();
|
int getBlockUpdatesPerSecond();
|
||||||
@ -103,22 +118,22 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
|
|||||||
|
|
||||||
EngineWorldManager getWorldManager();
|
EngineWorldManager getWorldManager();
|
||||||
|
|
||||||
void setParallelism(int parallelism);
|
|
||||||
|
|
||||||
default UUID getBiomeID(int x, int z) {
|
default UUID getBiomeID(int x, int z) {
|
||||||
return getComplex().getBaseBiomeIDStream().get(x, z);
|
return getComplex().getBaseBiomeIDStream().get(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getParallelism();
|
int getParallelism();
|
||||||
|
|
||||||
EngineTarget getTarget();
|
void setParallelism(int parallelism);
|
||||||
|
|
||||||
void setMinHeight(int min);
|
EngineTarget getTarget();
|
||||||
|
|
||||||
default int getMinHeight() {
|
default int getMinHeight() {
|
||||||
return getTarget().getWorld().minHeight();
|
return getTarget().getWorld().minHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setMinHeight(int min);
|
||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
double modifyX(double x);
|
double modifyX(double x);
|
||||||
|
|
||||||
|
@ -34,16 +34,6 @@ public class EngineData {
|
|||||||
private String lastVersion;
|
private String lastVersion;
|
||||||
private List<IrisPosition> strongholdPositions;
|
private List<IrisPosition> strongholdPositions;
|
||||||
|
|
||||||
public void save(File f) {
|
|
||||||
try {
|
|
||||||
f.getParentFile().mkdirs();
|
|
||||||
IO.writeAll(f, new Gson().toJson(this));
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EngineData load(File f) {
|
public static EngineData load(File f) {
|
||||||
try {
|
try {
|
||||||
f.getParentFile().mkdirs();
|
f.getParentFile().mkdirs();
|
||||||
@ -55,4 +45,14 @@ public class EngineData {
|
|||||||
|
|
||||||
return new EngineData();
|
return new EngineData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void save(File f) {
|
||||||
|
try {
|
||||||
|
f.getParentFile().mkdirs();
|
||||||
|
IO.writeAll(f, new Gson().toJson(this));
|
||||||
|
} catch (IOException e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ public class EngineMetrics {
|
|||||||
private final AtomicRollingSequence parallax;
|
private final AtomicRollingSequence parallax;
|
||||||
private final AtomicRollingSequence parallaxInsert;
|
private final AtomicRollingSequence parallaxInsert;
|
||||||
private final AtomicRollingSequence post;
|
private final AtomicRollingSequence post;
|
||||||
|
private final AtomicRollingSequence perfection;
|
||||||
private final AtomicRollingSequence decoration;
|
private final AtomicRollingSequence decoration;
|
||||||
private final AtomicRollingSequence cave;
|
private final AtomicRollingSequence cave;
|
||||||
private final AtomicRollingSequence ravine;
|
private final AtomicRollingSequence ravine;
|
||||||
@ -40,6 +41,7 @@ public class EngineMetrics {
|
|||||||
this.total = new AtomicRollingSequence(mem);
|
this.total = new AtomicRollingSequence(mem);
|
||||||
this.terrain = new AtomicRollingSequence(mem);
|
this.terrain = new AtomicRollingSequence(mem);
|
||||||
this.biome = new AtomicRollingSequence(mem);
|
this.biome = new AtomicRollingSequence(mem);
|
||||||
|
this.perfection = new AtomicRollingSequence(mem);
|
||||||
this.parallax = new AtomicRollingSequence(mem);
|
this.parallax = new AtomicRollingSequence(mem);
|
||||||
this.parallaxInsert = new AtomicRollingSequence(mem);
|
this.parallaxInsert = new AtomicRollingSequence(mem);
|
||||||
this.post = new AtomicRollingSequence(mem);
|
this.post = new AtomicRollingSequence(mem);
|
||||||
@ -58,6 +60,7 @@ public class EngineMetrics {
|
|||||||
v.put("parallax", parallax.getAverage());
|
v.put("parallax", parallax.getAverage());
|
||||||
v.put("parallax.insert", parallaxInsert.getAverage());
|
v.put("parallax.insert", parallaxInsert.getAverage());
|
||||||
v.put("post", post.getAverage());
|
v.put("post", post.getAverage());
|
||||||
|
v.put("perfection", perfection.getAverage());
|
||||||
v.put("decoration", decoration.getAverage());
|
v.put("decoration", decoration.getAverage());
|
||||||
v.put("updates", updates.getAverage());
|
v.put("updates", updates.getAverage());
|
||||||
v.put("cave", cave.getAverage());
|
v.put("cave", cave.getAverage());
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.engine.framework;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
public interface EngineStage {
|
||||||
|
@BlockCoordinates
|
||||||
|
void generate(int x, int z, Hunk<BlockData> blocks, Hunk<Biome> biomes, boolean multicore);
|
||||||
|
|
||||||
|
default void close() {
|
||||||
|
if (this instanceof EngineComponent c) {
|
||||||
|
c.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -27,9 +27,9 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
public class EngineTarget {
|
public class EngineTarget {
|
||||||
private final MultiBurst burster;
|
private final MultiBurst burster;
|
||||||
|
private final IrisData data;
|
||||||
private IrisDimension dimension;
|
private IrisDimension dimension;
|
||||||
private IrisWorld world;
|
private IrisWorld world;
|
||||||
private final IrisData data;
|
|
||||||
|
|
||||||
public EngineTarget(IrisWorld world, IrisDimension dimension, IrisData data) {
|
public EngineTarget(IrisWorld world, IrisDimension dimension, IrisData data) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
@ -23,19 +23,14 @@ import com.volmit.iris.util.math.RNG;
|
|||||||
import com.volmit.iris.util.noise.CNG;
|
import com.volmit.iris.util.noise.CNG;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class SeedManager
|
public class SeedManager {
|
||||||
{
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
private static final String IRIS_SIGNATURE = "Iris World Generator";
|
private static final String IRIS_SIGNATURE = "Iris World Generator";
|
||||||
private static final long IRIS_TERRAIN_VERSION = 1;
|
private static final long IRIS_TERRAIN_VERSION = 1;
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@Setter(AccessLevel.NONE)
|
|
||||||
private long fullMixedSeed;
|
|
||||||
private final RNG rlock;
|
private final RNG rlock;
|
||||||
private final CNG soup;
|
private final CNG soup;
|
||||||
private final long seed;
|
private final long seed;
|
||||||
@ -55,9 +50,11 @@ public class SeedManager
|
|||||||
private final long carve;
|
private final long carve;
|
||||||
private final long deposit;
|
private final long deposit;
|
||||||
private final long post;
|
private final long post;
|
||||||
|
private final long bodies;
|
||||||
|
@Setter(AccessLevel.NONE)
|
||||||
|
private long fullMixedSeed;
|
||||||
|
|
||||||
public SeedManager(long seed)
|
public SeedManager(long seed) {
|
||||||
{
|
|
||||||
soup = createSoup(seed);
|
soup = createSoup(seed);
|
||||||
rlock = new RNG(Double.doubleToLongBits(soup.fitDouble(Double.MIN_VALUE, Double.MAX_VALUE, seed + 1337, seed * 69, seed)));
|
rlock = new RNG(Double.doubleToLongBits(soup.fitDouble(Double.MIN_VALUE, Double.MAX_VALUE, seed + 1337, seed * 69, seed)));
|
||||||
this.seed = seed;
|
this.seed = seed;
|
||||||
@ -77,10 +74,10 @@ public class SeedManager
|
|||||||
carve = of("carve");
|
carve = of("carve");
|
||||||
deposit = of("deposit");
|
deposit = of("deposit");
|
||||||
post = of("post");
|
post = of("post");
|
||||||
|
bodies = of("bodies");
|
||||||
}
|
}
|
||||||
|
|
||||||
private long of(String name)
|
private long of(String name) {
|
||||||
{
|
|
||||||
RNG rng = new RNG(name + IRIS_SIGNATURE + "::" + IRIS_TERRAIN_VERSION + ((seed + rlock.imax()) * rlock.lmax()));
|
RNG rng = new RNG(name + IRIS_SIGNATURE + "::" + IRIS_TERRAIN_VERSION + ((seed + rlock.imax()) * rlock.lmax()));
|
||||||
long f = rlock.imax() * ((rlock.chance(0.5) ? 1 : -1) * (name.hashCode() + Double.doubleToLongBits(soup.fitDouble(Double.MIN_VALUE, Double.MAX_VALUE, rng.imax(), rng.imax(), rng.imax()))));
|
long f = rlock.imax() * ((rlock.chance(0.5) ? 1 : -1) * (name.hashCode() + Double.doubleToLongBits(soup.fitDouble(Double.MIN_VALUE, Double.MAX_VALUE, rng.imax(), rng.imax(), rng.imax()))));
|
||||||
fullMixedSeed += (f * rlock.imax());
|
fullMixedSeed += (f * rlock.imax());
|
||||||
@ -95,8 +92,7 @@ public class SeedManager
|
|||||||
RNG e = new RNG((IRIS_TERRAIN_VERSION * 42) + IRIS_SIGNATURE);
|
RNG e = new RNG((IRIS_TERRAIN_VERSION * 42) + IRIS_SIGNATURE);
|
||||||
double gsoup = 0;
|
double gsoup = 0;
|
||||||
int gk = a.i(1_000, 10_000);
|
int gk = a.i(1_000, 10_000);
|
||||||
for(char i : (a.s(4) + b.s(4) + c.s(4) + d.s(4) + e.s(4)).toCharArray())
|
for (char i : (a.s(4) + b.s(4) + c.s(4) + d.s(4) + e.s(4)).toCharArray()) {
|
||||||
{
|
|
||||||
gsoup += ((gk * b.d(3, Math.PI)) / c.d(10, 18 * Math.E)) + 6_549;
|
gsoup += ((gk * b.d(3, Math.PI)) / c.d(10, 18 * Math.E)) + 6_549;
|
||||||
gsoup *= d.d(90.5, 1_234_567);
|
gsoup *= d.d(90.5, 1_234_567);
|
||||||
gsoup += e.d(39.95, 99.25);
|
gsoup += e.d(39.95, 99.25);
|
||||||
|
@ -21,7 +21,16 @@ package com.volmit.iris.engine.jigsaw;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||||
|
import com.volmit.iris.engine.object.InventorySlotType;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
|
||||||
|
import com.volmit.iris.engine.object.IrisLootTable;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectRotation;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectTranslate;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
|
import com.volmit.iris.engine.object.TileData;
|
||||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.AxisAlignedBB;
|
import com.volmit.iris.util.math.AxisAlignedBB;
|
||||||
|
@ -21,7 +21,20 @@ package com.volmit.iris.engine.jigsaw;
|
|||||||
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
|
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||||
|
import com.volmit.iris.engine.object.IrisDirection;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeature;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePositional;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePotential;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPiece;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawStructure;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectRotation;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
|
import com.volmit.iris.engine.object.ObjectPlaceMode;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
||||||
import com.volmit.iris.util.mantle.Mantle;
|
import com.volmit.iris.util.mantle.Mantle;
|
||||||
@ -34,6 +47,12 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PlannedStructure {
|
public class PlannedStructure {
|
||||||
|
private static transient ConcurrentLinkedHashMap<String, IrisObject> objectRotationCache
|
||||||
|
= new ConcurrentLinkedHashMap.Builder<String, IrisObject>()
|
||||||
|
.initialCapacity(64)
|
||||||
|
.maximumWeightedCapacity(1024)
|
||||||
|
.concurrencyLevel(32)
|
||||||
|
.build();
|
||||||
private KList<PlannedPiece> pieces;
|
private KList<PlannedPiece> pieces;
|
||||||
private IrisJigsawStructure structure;
|
private IrisJigsawStructure structure;
|
||||||
private IrisPosition position;
|
private IrisPosition position;
|
||||||
@ -41,12 +60,6 @@ public class PlannedStructure {
|
|||||||
private RNG rng;
|
private RNG rng;
|
||||||
private boolean verbose;
|
private boolean verbose;
|
||||||
private boolean terminating;
|
private boolean terminating;
|
||||||
private static transient ConcurrentLinkedHashMap<String, IrisObject> objectRotationCache
|
|
||||||
= new ConcurrentLinkedHashMap.Builder<String, IrisObject>()
|
|
||||||
.initialCapacity(64)
|
|
||||||
.maximumWeightedCapacity(1024)
|
|
||||||
.concurrencyLevel(32)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
public PlannedStructure(IrisJigsawStructure structure, IrisPosition position, RNG rng) {
|
public PlannedStructure(IrisJigsawStructure structure, IrisPosition position, RNG rng) {
|
||||||
terminating = false;
|
terminating = false;
|
||||||
@ -101,6 +114,7 @@ public class PlannedStructure {
|
|||||||
int sz = (v.getD() / 2);
|
int sz = (v.getD() / 2);
|
||||||
int xx = i.getPosition().getX() + sx;
|
int xx = i.getPosition().getX() + sx;
|
||||||
int zz = i.getPosition().getZ() + sz;
|
int zz = i.getPosition().getZ() + sz;
|
||||||
|
RNG rngf = new RNG(Cache.key(xx, zz));
|
||||||
int offset = i.getPosition().getY() - startHeight;
|
int offset = i.getPosition().getY() - startHeight;
|
||||||
int height = 0;
|
int height = 0;
|
||||||
|
|
||||||
@ -124,25 +138,7 @@ public class PlannedStructure {
|
|||||||
int h = vo.place(xx, height, zz, placer, options, rng, (b)
|
int h = vo.place(xx, height, zz, placer, options, rng, (b)
|
||||||
-> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
|
-> e.set(b.getX(), b.getY(), b.getZ(), v.getLoadKey() + "@" + id), null, getData());
|
||||||
|
|
||||||
for (IrisJigsawPieceConnector j : i.getAvailableConnectors()) {
|
if (options.isVacuum()) {
|
||||||
if (j.getSpawnEntity() != null)// && h != -1)
|
|
||||||
{
|
|
||||||
IrisPosition p;
|
|
||||||
if (j.getEntityPosition() == null) {
|
|
||||||
p = i.getWorldPosition(j).add(new IrisPosition(j.getDirection().toVector().multiply(2)));
|
|
||||||
} else {
|
|
||||||
p = i.getWorldPosition(j).add(j.getEntityPosition());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.getMode().equals(ObjectPlaceMode.PAINT) || options.isVacuum()) {
|
|
||||||
p.setY(placer.getHighest(xx, zz, getData()) + offset + (v.getH() / 2));
|
|
||||||
} else {
|
|
||||||
p.setY(height);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.usesFeatures()) {
|
|
||||||
double a = Math.max(v.getW(), v.getD());
|
double a = Math.max(v.getW(), v.getD());
|
||||||
IrisFeature f = new IrisFeature();
|
IrisFeature f = new IrisFeature();
|
||||||
f.setConvergeToHeight(h - (v.getH() >> 1) - 1);
|
f.setConvergeToHeight(h - (v.getH() >> 1) - 1);
|
||||||
@ -152,6 +148,14 @@ public class PlannedStructure {
|
|||||||
f.setStrength(1D);
|
f.setStrength(1D);
|
||||||
e.set(xx, 0, zz, new IrisFeaturePositional(xx, zz, f));
|
e.set(xx, 0, zz, new IrisFeaturePositional(xx, zz, f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.getAddFeatures().isNotEmpty()) {
|
||||||
|
for (IrisFeaturePotential j : options.getAddFeatures()) {
|
||||||
|
if (rngf.nextInt(j.getRarity()) == 0) {
|
||||||
|
e.set(xx, 0, zz, new IrisFeaturePositional(xx, zz, j.getZone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void place(World world) {
|
public void place(World world) {
|
||||||
|
@ -23,7 +23,11 @@ import com.volmit.iris.core.loader.IrisData;
|
|||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineTarget;
|
import com.volmit.iris.engine.framework.EngineTarget;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IObjectPlacer;
|
||||||
|
import com.volmit.iris.engine.object.IrisDimension;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePositional;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
|
import com.volmit.iris.engine.object.TileData;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
|
@ -65,6 +65,62 @@ public class MantleWriter implements IObjectPlacer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Set<IrisPosition> getBallooned(Set<IrisPosition> vset, double radius) {
|
||||||
|
Set<IrisPosition> returnset = new HashSet<>();
|
||||||
|
int ceilrad = (int) Math.ceil(radius);
|
||||||
|
|
||||||
|
for (IrisPosition v : vset) {
|
||||||
|
int tipx = v.getX();
|
||||||
|
int tipy = v.getY();
|
||||||
|
int tipz = v.getZ();
|
||||||
|
|
||||||
|
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
||||||
|
for (int loopy = tipy - ceilrad; loopy <= tipy + ceilrad; loopy++) {
|
||||||
|
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
||||||
|
if (hypot(loopx - tipx, loopy - tipy, loopz - tipz) <= radius) {
|
||||||
|
returnset.add(new IrisPosition(loopx, loopy, loopz));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnset;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Set<IrisPosition> getHollowed(Set<IrisPosition> vset) {
|
||||||
|
Set<IrisPosition> returnset = new KSet<>();
|
||||||
|
for (IrisPosition v : vset) {
|
||||||
|
double x = v.getX();
|
||||||
|
double y = v.getY();
|
||||||
|
double z = v.getZ();
|
||||||
|
if (!(vset.contains(new IrisPosition(x + 1, y, z))
|
||||||
|
&& vset.contains(new IrisPosition(x - 1, y, z))
|
||||||
|
&& vset.contains(new IrisPosition(x, y + 1, z))
|
||||||
|
&& vset.contains(new IrisPosition(x, y - 1, z))
|
||||||
|
&& vset.contains(new IrisPosition(x, y, z + 1))
|
||||||
|
&& vset.contains(new IrisPosition(x, y, z - 1)))) {
|
||||||
|
returnset.add(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnset;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double hypot(double... pars) {
|
||||||
|
double sum = 0;
|
||||||
|
for (double d : pars) {
|
||||||
|
sum += Math.pow(d, 2);
|
||||||
|
}
|
||||||
|
return Math.sqrt(sum);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double lengthSq(double x, double y, double z) {
|
||||||
|
return (x * x) + (y * y) + (z * z);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double lengthSq(double x, double z) {
|
||||||
|
return (x * x) + (z * z);
|
||||||
|
}
|
||||||
|
|
||||||
public <T> void setData(int x, int y, int z, T t) {
|
public <T> void setData(int x, int y, int z, T t) {
|
||||||
if (t == null) {
|
if (t == null) {
|
||||||
return;
|
return;
|
||||||
@ -307,7 +363,6 @@ public class MantleWriter implements IObjectPlacer {
|
|||||||
setLine(ImmutableList.of(a, b), radius, filled, data);
|
setLine(ImmutableList.of(a, b), radius, filled, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public <T> void setLine(List<IrisPosition> vectors, double radius, boolean filled, T data) {
|
public <T> void setLine(List<IrisPosition> vectors, double radius, boolean filled, T data) {
|
||||||
setLineConsumer(vectors, radius, filled, (_x, _y, _z) -> data);
|
setLineConsumer(vectors, radius, filled, (_x, _y, _z) -> data);
|
||||||
}
|
}
|
||||||
@ -489,62 +544,6 @@ public class MantleWriter implements IObjectPlacer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Set<IrisPosition> getBallooned(Set<IrisPosition> vset, double radius) {
|
|
||||||
Set<IrisPosition> returnset = new HashSet<>();
|
|
||||||
int ceilrad = (int) Math.ceil(radius);
|
|
||||||
|
|
||||||
for (IrisPosition v : vset) {
|
|
||||||
int tipx = v.getX();
|
|
||||||
int tipy = v.getY();
|
|
||||||
int tipz = v.getZ();
|
|
||||||
|
|
||||||
for (int loopx = tipx - ceilrad; loopx <= tipx + ceilrad; loopx++) {
|
|
||||||
for (int loopy = tipy - ceilrad; loopy <= tipy + ceilrad; loopy++) {
|
|
||||||
for (int loopz = tipz - ceilrad; loopz <= tipz + ceilrad; loopz++) {
|
|
||||||
if (hypot(loopx - tipx, loopy - tipy, loopz - tipz) <= radius) {
|
|
||||||
returnset.add(new IrisPosition(loopx, loopy, loopz));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return returnset;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Set<IrisPosition> getHollowed(Set<IrisPosition> vset) {
|
|
||||||
Set<IrisPosition> returnset = new KSet<>();
|
|
||||||
for (IrisPosition v : vset) {
|
|
||||||
double x = v.getX();
|
|
||||||
double y = v.getY();
|
|
||||||
double z = v.getZ();
|
|
||||||
if (!(vset.contains(new IrisPosition(x + 1, y, z))
|
|
||||||
&& vset.contains(new IrisPosition(x - 1, y, z))
|
|
||||||
&& vset.contains(new IrisPosition(x, y + 1, z))
|
|
||||||
&& vset.contains(new IrisPosition(x, y - 1, z))
|
|
||||||
&& vset.contains(new IrisPosition(x, y, z + 1))
|
|
||||||
&& vset.contains(new IrisPosition(x, y, z - 1)))) {
|
|
||||||
returnset.add(v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return returnset;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double hypot(double... pars) {
|
|
||||||
double sum = 0;
|
|
||||||
for (double d : pars) {
|
|
||||||
sum += Math.pow(d, 2);
|
|
||||||
}
|
|
||||||
return Math.sqrt(sum);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double lengthSq(double x, double y, double z) {
|
|
||||||
return (x * x) + (y * y) + (z * z);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static double lengthSq(double x, double z) {
|
|
||||||
return (x * x) + (z * z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isWithin(Vector pos) {
|
public boolean isWithin(Vector pos) {
|
||||||
return isWithin(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
return isWithin(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ());
|
||||||
}
|
}
|
||||||
|
@ -18,11 +18,18 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.mantle.components;
|
package com.volmit.iris.engine.mantle.components;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePositional;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawStructure;
|
||||||
|
import com.volmit.iris.engine.object.IrisJigsawStructurePlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
|
import com.volmit.iris.engine.object.NoiseStyle;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
|
@ -23,7 +23,13 @@ import com.volmit.iris.engine.data.cache.Cache;
|
|||||||
import com.volmit.iris.engine.mantle.EngineMantle;
|
import com.volmit.iris.engine.mantle.EngineMantle;
|
||||||
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
import com.volmit.iris.engine.mantle.IrisMantleComponent;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeature;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePositional;
|
||||||
|
import com.volmit.iris.engine.object.IrisFeaturePotential;
|
||||||
|
import com.volmit.iris.engine.object.IrisObject;
|
||||||
|
import com.volmit.iris.engine.object.IrisObjectPlacement;
|
||||||
|
import com.volmit.iris.engine.object.IrisRegion;
|
||||||
import com.volmit.iris.util.documentation.BlockCoordinates;
|
import com.volmit.iris.util.documentation.BlockCoordinates;
|
||||||
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
import com.volmit.iris.util.documentation.ChunkCoordinates;
|
||||||
import com.volmit.iris.util.mantle.MantleFlag;
|
import com.volmit.iris.util.mantle.MantleFlag;
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.engine.modifier;
|
||||||
|
|
||||||
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
import com.volmit.iris.engine.framework.EngineAssignedModifier;
|
||||||
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
public class IrisBodyModifier extends EngineAssignedModifier<BlockData> {
|
||||||
|
private final RNG rng;
|
||||||
|
private final BlockData AIR = Material.CAVE_AIR.createBlockData();
|
||||||
|
private final BlockData WATER = Material.WATER.createBlockData();
|
||||||
|
private final BlockData LAVA = Material.LAVA.createBlockData();
|
||||||
|
|
||||||
|
public IrisBodyModifier(Engine engine) {
|
||||||
|
super(engine, "Bodies");
|
||||||
|
rng = new RNG(getEngine().getSeedManager().getBodies());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModify(int x, int z, Hunk<BlockData> output, boolean multicore) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -18,12 +18,15 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.modifier;
|
package com.volmit.iris.engine.modifier;
|
||||||
|
|
||||||
import com.volmit.iris.engine.IrisEngine;
|
|
||||||
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
import com.volmit.iris.engine.actuator.IrisDecorantActuator;
|
||||||
import com.volmit.iris.engine.data.cache.Cache;
|
import com.volmit.iris.engine.data.cache.Cache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.framework.EngineAssignedModifier;
|
import com.volmit.iris.engine.framework.EngineAssignedModifier;
|
||||||
import com.volmit.iris.engine.object.*;
|
import com.volmit.iris.engine.object.InferredType;
|
||||||
|
import com.volmit.iris.engine.object.IrisBiome;
|
||||||
|
import com.volmit.iris.engine.object.IrisDecorationPart;
|
||||||
|
import com.volmit.iris.engine.object.IrisDecorator;
|
||||||
|
import com.volmit.iris.engine.object.IrisPosition;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
@ -48,10 +51,12 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
private final BlockData AIR = Material.CAVE_AIR.createBlockData();
|
private final BlockData AIR = Material.CAVE_AIR.createBlockData();
|
||||||
private final BlockData WATER = Material.WATER.createBlockData();
|
private final BlockData WATER = Material.WATER.createBlockData();
|
||||||
private final BlockData LAVA = Material.LAVA.createBlockData();
|
private final BlockData LAVA = Material.LAVA.createBlockData();
|
||||||
|
private final IrisDecorantActuator decorant;
|
||||||
|
|
||||||
public IrisCarveModifier(Engine engine) {
|
public IrisCarveModifier(Engine engine) {
|
||||||
super(engine, "Carve");
|
super(engine, "Carve");
|
||||||
rng = new RNG(getEngine().getSeedManager().getCarve());
|
rng = new RNG(getEngine().getSeedManager().getCarve());
|
||||||
|
decorant = new IrisDecorantActuator(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -206,12 +211,11 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
|
|||||||
|
|
||||||
biome.setInferredType(InferredType.CAVE);
|
biome.setInferredType(InferredType.CAVE);
|
||||||
|
|
||||||
IrisDecorantActuator actuator = (IrisDecorantActuator) ((IrisEngine) getEngine()).getDecorantActuator();
|
|
||||||
for (IrisDecorator i : biome.getDecorators()) {
|
for (IrisDecorator i : biome.getDecorators()) {
|
||||||
if (i.getPartOf().equals(IrisDecorationPart.NONE) && B.isSolid(output.get(rx, zone.getFloor() - 1, rz))) {
|
if (i.getPartOf().equals(IrisDecorationPart.NONE) && B.isSolid(output.get(rx, zone.getFloor() - 1, rz))) {
|
||||||
actuator.getSurfaceDecorator().decorate(rx, rz, xx, xx, xx, zz, zz, zz, output, biome, zone.getFloor() - 1, zone.airThickness());
|
decorant.getSurfaceDecorator().decorate(rx, rz, xx, xx, xx, zz, zz, zz, output, biome, zone.getFloor() - 1, zone.airThickness());
|
||||||
} else if (i.getPartOf().equals(IrisDecorationPart.CEILING) && B.isSolid(output.get(rx, zone.getCeiling() + 1, rz))) {
|
} else if (i.getPartOf().equals(IrisDecorationPart.CEILING) && B.isSolid(output.get(rx, zone.getCeiling() + 1, rz))) {
|
||||||
actuator.getCeilingDecorator().decorate(rx, rz, xx, xx, xx, zz, zz, zz, output, biome, zone.getCeiling(), zone.airThickness());
|
decorant.getCeilingDecorator().decorate(rx, rz, xx, xx, xx, zz, zz, zz, output, biome, zone.getCeiling(), zone.airThickness());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,133 @@
|
|||||||
|
/*
|
||||||
|
* Iris is a World Generator for Minecraft Bukkit Servers
|
||||||
|
* Copyright (c) 2021 Arcane Arts (Volmit Software)
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.volmit.iris.engine.modifier;
|
||||||
|
|
||||||
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
|
import com.volmit.iris.engine.framework.EngineAssignedModifier;
|
||||||
|
import com.volmit.iris.util.data.B;
|
||||||
|
import com.volmit.iris.util.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
|
import org.bukkit.block.data.Bisected;
|
||||||
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class IrisPerfectionModifier extends EngineAssignedModifier<BlockData> {
|
||||||
|
private static final BlockData AIR = B.get("AIR");
|
||||||
|
private static final BlockData WATER = B.get("WATER");
|
||||||
|
private final RNG rng;
|
||||||
|
|
||||||
|
public IrisPerfectionModifier(Engine engine) {
|
||||||
|
super(engine, "Perfection");
|
||||||
|
rng = new RNG(getEngine().getSeedManager().getPost());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onModify(int x, int z, Hunk<BlockData> output, boolean multicore) {
|
||||||
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
boolean changed = true;
|
||||||
|
int passes = 0;
|
||||||
|
int changes = 0;
|
||||||
|
List<Integer> surfaces = new ArrayList<>();
|
||||||
|
List<Integer> ceilings = new ArrayList<>();
|
||||||
|
|
||||||
|
while (changed) {
|
||||||
|
passes++;
|
||||||
|
changed = false;
|
||||||
|
for (int i = 0; i < 16; i++) {
|
||||||
|
for (int j = 0; j < 16; j++) {
|
||||||
|
surfaces.clear();
|
||||||
|
ceilings.clear();
|
||||||
|
int top = getHeight(output, i, j);
|
||||||
|
boolean inside = true;
|
||||||
|
surfaces.add(top);
|
||||||
|
|
||||||
|
for (int k = top; k >= 0; k--) {
|
||||||
|
BlockData b = output.get(i, k, j);
|
||||||
|
boolean now = b != null && !(B.isAir(b) || B.isFluid(b));
|
||||||
|
|
||||||
|
if (now != inside) {
|
||||||
|
inside = now;
|
||||||
|
|
||||||
|
if (inside) {
|
||||||
|
surfaces.add(k);
|
||||||
|
} else {
|
||||||
|
ceilings.add(k + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int k : surfaces) {
|
||||||
|
BlockData tip = output.get(i, k, j);
|
||||||
|
|
||||||
|
if (tip == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean remove = false;
|
||||||
|
boolean remove2 = false;
|
||||||
|
|
||||||
|
if (B.isDecorant(tip)) {
|
||||||
|
BlockData bel = output.get(i, k - 1, j);
|
||||||
|
|
||||||
|
if (bel == null) {
|
||||||
|
remove = true;
|
||||||
|
} else if (!B.canPlaceOnto(tip.getMaterial(), bel.getMaterial())) {
|
||||||
|
remove = true;
|
||||||
|
} else if (bel instanceof Bisected) {
|
||||||
|
BlockData bb = output.get(i, k - 2, j);
|
||||||
|
if (bb == null || !B.canPlaceOnto(bel.getMaterial(), bb.getMaterial())) {
|
||||||
|
remove = true;
|
||||||
|
remove2 = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (remove) {
|
||||||
|
changed = true;
|
||||||
|
changes++;
|
||||||
|
output.set(i, k, j, AIR);
|
||||||
|
|
||||||
|
if (remove2) {
|
||||||
|
changes++;
|
||||||
|
output.set(i, k - 1, j, AIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getEngine().getMetrics().getPerfection().put(p.getMilliseconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getHeight(Hunk<BlockData> output, int x, int z) {
|
||||||
|
for (int i = output.getHeight() - 1; i >= 0; i--) {
|
||||||
|
BlockData b = output.get(x, i, z);
|
||||||
|
|
||||||
|
if (b != null && !B.isAir(b) && !B.isFluid(b)) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@ -65,6 +65,15 @@ public class HeadlessWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HeadlessWorld from(World world) {
|
||||||
|
return new HeadlessWorld(world.getName(), IrisToolbelt.access(world)
|
||||||
|
.getEngine().getTarget().getDimension(), world.getSeed());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static HeadlessWorld from(String name, String dimension, long seed) {
|
||||||
|
return new HeadlessWorld(name, IrisData.loadAnyDimension(dimension), seed);
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
public HeadlessGenerator generate() {
|
public HeadlessGenerator generate() {
|
||||||
Engine e = null;
|
Engine e = null;
|
||||||
@ -92,13 +101,4 @@ public class HeadlessWorld {
|
|||||||
world.realWorld(w);
|
world.realWorld(w);
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HeadlessWorld from(World world) {
|
|
||||||
return new HeadlessWorld(world.getName(), IrisToolbelt.access(world)
|
|
||||||
.getEngine().getTarget().getDimension(), world.getSeed());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static HeadlessWorld from(String name, String dimension, long seed) {
|
|
||||||
return new HeadlessWorld(name, IrisData.loadAnyDimension(dimension), seed);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
public interface IRare {
|
public interface IRare {
|
||||||
int getRarity();
|
|
||||||
|
|
||||||
static int get(Object v) {
|
static int get(Object v) {
|
||||||
return v instanceof IRare ? Math.max(1, ((IRare) v).getRarity()) : 1;
|
return v instanceof IRare ? Math.max(1, ((IRare) v).getRarity()) : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getRarity();
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -18,7 +18,12 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.M;
|
import com.volmit.iris.util.math.M;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -25,7 +25,13 @@ import com.volmit.iris.core.loader.IrisRegistrant;
|
|||||||
import com.volmit.iris.engine.IrisComplex;
|
import com.volmit.iris.engine.IrisComplex;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
@ -46,7 +52,7 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
|
||||||
@SuppressWarnings("DefaultAnnotationParam")
|
@SuppressWarnings("DefaultAnnotationParam")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ -56,140 +62,6 @@ import java.awt.*;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisBiome extends IrisRegistrant implements IRare {
|
public class IrisBiome extends IrisRegistrant implements IRare {
|
||||||
@MinNumber(2)
|
|
||||||
@Required
|
|
||||||
@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 = IrisBiomeCustom.class)
|
|
||||||
@Desc("If the biome type custom is defined, specify this")
|
|
||||||
private KList<IrisBiomeCustom> customDerivitives;
|
|
||||||
|
|
||||||
@Desc("Spawn Entities in this area over time. Iris will continually replenish these mobs just like vanilla does.")
|
|
||||||
@ArrayType(min = 1, type = String.class)
|
|
||||||
@RegistryListResource(IrisSpawner.class)
|
|
||||||
private KList<String> entitySpawners = new KList<>();
|
|
||||||
|
|
||||||
@Desc("Add random chances for terrain features")
|
|
||||||
@ArrayType(min = 1, type = IrisFeaturePotential.class)
|
|
||||||
private KList<IrisFeaturePotential> features = new KList<>();
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisEffect.class)
|
|
||||||
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play around the player even if where the effect was played is no longer in the biome the player is in.")
|
|
||||||
private KList<IrisEffect> effects = new KList<>();
|
|
||||||
|
|
||||||
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
|
|
||||||
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen.")
|
|
||||||
private IrisGeneratorStyle biomeStyle = NoiseStyle.SIMPLEX.style();
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisBlockDrops.class)
|
|
||||||
@Desc("Define custom block drops for this biome")
|
|
||||||
private KList<IrisBlockDrops> blockDrops = new KList<>();
|
|
||||||
|
|
||||||
@Desc("Reference loot tables in this area")
|
|
||||||
private IrisLootReference loot = new IrisLootReference();
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
|
|
||||||
@Desc("This zooms in the biome colors if multiple derivatives are chosen")
|
|
||||||
private double biomeZoom = 1;
|
|
||||||
|
|
||||||
@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;
|
|
||||||
|
|
||||||
@Desc("The max layers to iterate below the surface for locked layer biomes (mesa).")
|
|
||||||
private int lockLayersMax = 7;
|
|
||||||
|
|
||||||
@Desc("Carving configuration for the dimension")
|
|
||||||
private IrisCarving carving = new IrisCarving();
|
|
||||||
|
|
||||||
@Desc("Configuration of fluid bodies such as rivers & lakes")
|
|
||||||
private IrisFluidBodies fluidBodies = new IrisFluidBodies();
|
|
||||||
|
|
||||||
@MinNumber(1)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@Desc("The rarity of this biome (integer)")
|
|
||||||
private int rarity = 1;
|
|
||||||
|
|
||||||
@Desc("A color for visualizing this biome with a color. I.e. #F13AF5. This will show up on the map.")
|
|
||||||
private String color = null;
|
|
||||||
|
|
||||||
@Required
|
|
||||||
@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;
|
|
||||||
|
|
||||||
@Required
|
|
||||||
@Desc("Override the derivative when vanilla places structures to this derivative. This is useful for example if you have an ocean biome, but you have set the derivative to desert to get a brown-ish color. To prevent desert structures from spawning on top of your ocean, you can set your vanillaDerivative to ocean, to allow for vanilla structures. Not defining this value will simply select the derivative.")
|
|
||||||
private Biome vanillaDerivative = null;
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = Biome.class)
|
|
||||||
@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)
|
|
||||||
@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<>();
|
|
||||||
|
|
||||||
@DependsOn({"children"})
|
|
||||||
@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;
|
|
||||||
|
|
||||||
@DependsOn({"children"})
|
|
||||||
@Desc("If this biome has children biomes, and the gen layer chooses one of this biomes children, How will it be shaped?")
|
|
||||||
private IrisGeneratorStyle childStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
|
||||||
|
|
||||||
@RegistryListResource(IrisBiome.class)
|
|
||||||
@ArrayType(min = 1, type = String.class)
|
|
||||||
@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<>();
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
|
|
||||||
@Desc("Jigsaw structures")
|
|
||||||
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
|
|
||||||
|
|
||||||
@RegistryListResource(IrisBiome.class)
|
|
||||||
@Desc("The carving biome. If specified the biome will be used when under a carving instead of this current biome.")
|
|
||||||
private String carvingBiome = "";
|
|
||||||
|
|
||||||
@Desc("The default slab if iris decides to place a slab in this biome. Default is no slab.")
|
|
||||||
private IrisBiomePaletteLayer slab = new IrisBiomePaletteLayer().zero();
|
|
||||||
|
|
||||||
@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)
|
|
||||||
@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());
|
|
||||||
|
|
||||||
@Required
|
|
||||||
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
|
||||||
@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> caveCeilingLayers = new KList<IrisBiomePaletteLayer>().qadd(new IrisBiomePaletteLayer());
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
|
||||||
@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<>();
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisDecorator.class)
|
|
||||||
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
|
||||||
private KList<IrisDecorator> decorators = new KList<>();
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
|
||||||
@Desc("Objects define what schematics (iob files) iris will place in this biome")
|
|
||||||
private KList<IrisObjectPlacement> objects = new KList<>();
|
|
||||||
|
|
||||||
@Required
|
|
||||||
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
|
|
||||||
@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 = IrisDepositGenerator.class)
|
|
||||||
@Desc("Define biome deposit generators that add onto the existing regional and global deposit generators")
|
|
||||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
|
||||||
|
|
||||||
private transient InferredType inferredType;
|
|
||||||
|
|
||||||
private static final BlockData BARRIER = Material.BARRIER.createBlockData();
|
private static final BlockData BARRIER = Material.BARRIER.createBlockData();
|
||||||
private final transient AtomicCache<KMap<String, IrisBiomeGeneratorLink>> genCache = new AtomicCache<>();
|
private final transient AtomicCache<KMap<String, IrisBiomeGeneratorLink>> genCache = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KMap<String, Integer>> genCacheMax = new AtomicCache<>();
|
private final transient AtomicCache<KMap<String, Integer>> genCacheMax = new AtomicCache<>();
|
||||||
@ -209,6 +81,106 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
private final transient AtomicCache<KList<IrisBiome>> realChildren = new AtomicCache<>();
|
private final transient AtomicCache<KList<IrisBiome>> realChildren = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KList<CNG>> layerHeightGenerators = new AtomicCache<>();
|
private final transient AtomicCache<KList<CNG>> layerHeightGenerators = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KList<CNG>> layerSeaHeightGenerators = new AtomicCache<>();
|
private final transient AtomicCache<KList<CNG>> layerSeaHeightGenerators = new AtomicCache<>();
|
||||||
|
@MinNumber(2)
|
||||||
|
@Required
|
||||||
|
@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 = IrisBiomeCustom.class)
|
||||||
|
@Desc("If the biome type custom is defined, specify this")
|
||||||
|
private KList<IrisBiomeCustom> customDerivitives;
|
||||||
|
@Desc("Spawn Entities in this area over time. Iris will continually replenish these mobs just like vanilla does.")
|
||||||
|
@ArrayType(min = 1, type = String.class)
|
||||||
|
@RegistryListResource(IrisSpawner.class)
|
||||||
|
private KList<String> entitySpawners = new KList<>();
|
||||||
|
@Desc("Add random chances for terrain features")
|
||||||
|
@ArrayType(min = 1, type = IrisFeaturePotential.class)
|
||||||
|
private KList<IrisFeaturePotential> features = new KList<>();
|
||||||
|
@ArrayType(min = 1, type = IrisEffect.class)
|
||||||
|
@Desc("Effects are ambient effects such as potion effects, random sounds, or even particles around each player. All of these effects are played via packets so two players won't see/hear each others effects.\nDue to performance reasons, effects will play around the player even if where the effect was played is no longer in the biome the player is in.")
|
||||||
|
private KList<IrisEffect> effects = new KList<>();
|
||||||
|
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
|
||||||
|
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen.")
|
||||||
|
private IrisGeneratorStyle biomeStyle = NoiseStyle.SIMPLEX.style();
|
||||||
|
@ArrayType(min = 1, type = IrisBlockDrops.class)
|
||||||
|
@Desc("Define custom block drops for this biome")
|
||||||
|
private KList<IrisBlockDrops> blockDrops = new KList<>();
|
||||||
|
@Desc("Reference loot tables in this area")
|
||||||
|
private IrisLootReference loot = new IrisLootReference();
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
|
||||||
|
@Desc("This zooms in the biome colors if multiple derivatives are chosen")
|
||||||
|
private double biomeZoom = 1;
|
||||||
|
@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;
|
||||||
|
@Desc("The max layers to iterate below the surface for locked layer biomes (mesa).")
|
||||||
|
private int lockLayersMax = 7;
|
||||||
|
@Desc("Carving configuration for the dimension")
|
||||||
|
private IrisCarving carving = new IrisCarving();
|
||||||
|
@Desc("Configuration of fluid bodies such as rivers & lakes")
|
||||||
|
private IrisFluidBodies fluidBodies = new IrisFluidBodies();
|
||||||
|
@MinNumber(1)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@Desc("The rarity of this biome (integer)")
|
||||||
|
private int rarity = 1;
|
||||||
|
@Desc("A color for visualizing this biome with a color. I.e. #F13AF5. This will show up on the map.")
|
||||||
|
private String color = null;
|
||||||
|
@Required
|
||||||
|
@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;
|
||||||
|
@Required
|
||||||
|
@Desc("Override the derivative when vanilla places structures to this derivative. This is useful for example if you have an ocean biome, but you have set the derivative to desert to get a brown-ish color. To prevent desert structures from spawning on top of your ocean, you can set your vanillaDerivative to ocean, to allow for vanilla structures. Not defining this value will simply select the derivative.")
|
||||||
|
private Biome vanillaDerivative = null;
|
||||||
|
@ArrayType(min = 1, type = Biome.class)
|
||||||
|
@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)
|
||||||
|
@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<>();
|
||||||
|
@DependsOn({"children"})
|
||||||
|
@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;
|
||||||
|
@DependsOn({"children"})
|
||||||
|
@Desc("If this biome has children biomes, and the gen layer chooses one of this biomes children, How will it be shaped?")
|
||||||
|
private IrisGeneratorStyle childStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||||
|
@RegistryListResource(IrisBiome.class)
|
||||||
|
@ArrayType(min = 1, type = String.class)
|
||||||
|
@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<>();
|
||||||
|
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
|
||||||
|
@Desc("Jigsaw structures")
|
||||||
|
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
|
||||||
|
@RegistryListResource(IrisBiome.class)
|
||||||
|
@Desc("The carving biome. If specified the biome will be used when under a carving instead of this current biome.")
|
||||||
|
private String carvingBiome = "";
|
||||||
|
@Desc("The default slab if iris decides to place a slab in this biome. Default is no slab.")
|
||||||
|
private IrisBiomePaletteLayer slab = new IrisBiomePaletteLayer().zero();
|
||||||
|
@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)
|
||||||
|
@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());
|
||||||
|
@Required
|
||||||
|
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
||||||
|
@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> caveCeilingLayers = new KList<IrisBiomePaletteLayer>().qadd(new IrisBiomePaletteLayer());
|
||||||
|
@ArrayType(min = 1, type = IrisBiomePaletteLayer.class)
|
||||||
|
@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<>();
|
||||||
|
@ArrayType(min = 1, type = IrisDecorator.class)
|
||||||
|
@Desc("Decorators are used for things like tall grass, bisected flowers, and even kelp or cactus (random heights)")
|
||||||
|
private KList<IrisDecorator> decorators = new KList<>();
|
||||||
|
@ArrayType(min = 1, type = IrisObjectPlacement.class)
|
||||||
|
@Desc("Objects define what schematics (iob files) iris will place in this biome")
|
||||||
|
private KList<IrisObjectPlacement> objects = new KList<>();
|
||||||
|
@Required
|
||||||
|
@ArrayType(min = 1, type = IrisBiomeGeneratorLink.class)
|
||||||
|
@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 = IrisDepositGenerator.class)
|
||||||
|
@Desc("Define biome deposit generators that add onto the existing regional and global deposit generators")
|
||||||
|
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||||
|
private transient InferredType inferredType;
|
||||||
|
|
||||||
public Biome getVanillaDerivative() {
|
public Biome getVanillaDerivative() {
|
||||||
return vanillaDerivative == null ? derivative : vanillaDerivative;
|
return vanillaDerivative == null ? derivative : vanillaDerivative;
|
||||||
|
@ -19,7 +19,13 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.json.JSONArray;
|
import com.volmit.iris.util.json.JSONArray;
|
||||||
@ -29,7 +35,7 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
@Snippet("custom-biome")
|
@Snippet("custom-biome")
|
||||||
|
@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -19,7 +19,13 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -35,17 +41,16 @@ import lombok.experimental.Accessors;
|
|||||||
@Data
|
@Data
|
||||||
public class IrisBiomeGeneratorLink {
|
public class IrisBiomeGeneratorLink {
|
||||||
|
|
||||||
|
private final transient AtomicCache<IrisGenerator> gen = new AtomicCache<>();
|
||||||
@RegistryListResource(IrisGenerator.class)
|
@RegistryListResource(IrisGenerator.class)
|
||||||
@Desc("The generator id")
|
@Desc("The generator id")
|
||||||
private String generator = "default";
|
private String generator = "default";
|
||||||
|
|
||||||
@DependsOn({"min", "max"})
|
@DependsOn({"min", "max"})
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(-256) // TODO: WARNING HEIGHT
|
@MinNumber(-256) // TODO: WARNING HEIGHT
|
||||||
@MaxNumber(256) // TODO: WARNING HEIGHT
|
@MaxNumber(256) // TODO: WARNING HEIGHT
|
||||||
@Desc("The min block value (value + fluidHeight)")
|
@Desc("The min block value (value + fluidHeight)")
|
||||||
private int min = 0;
|
private int min = 0;
|
||||||
|
|
||||||
@DependsOn({"min", "max"})
|
@DependsOn({"min", "max"})
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(-256) // TODO: WARNING HEIGHT
|
@MinNumber(-256) // TODO: WARNING HEIGHT
|
||||||
@ -53,8 +58,6 @@ public class IrisBiomeGeneratorLink {
|
|||||||
@Desc("The max block value (value + fluidHeight)")
|
@Desc("The max block value (value + fluidHeight)")
|
||||||
private int max = 0;
|
private int max = 0;
|
||||||
|
|
||||||
private final transient AtomicCache<IrisGenerator> gen = new AtomicCache<>();
|
|
||||||
|
|
||||||
public IrisGenerator getCachedGenerator(DataProvider g) {
|
public IrisGenerator getCachedGenerator(DataProvider g) {
|
||||||
return gen.aquire(() ->
|
return gen.aquire(() ->
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,13 @@ package com.volmit.iris.engine.object;
|
|||||||
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.noise.CNG;
|
import com.volmit.iris.util.noise.CNG;
|
||||||
@ -37,40 +43,33 @@ import org.bukkit.block.data.BlockData;
|
|||||||
@Desc("A layer of surface / subsurface material in biomes")
|
@Desc("A layer of surface / subsurface material in biomes")
|
||||||
@Data
|
@Data
|
||||||
public class IrisBiomePaletteLayer {
|
public class IrisBiomePaletteLayer {
|
||||||
|
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||||
@Desc("The style of noise")
|
@Desc("The style of noise")
|
||||||
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
|
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
|
||||||
|
|
||||||
@DependsOn({"minHeight", "maxHeight"})
|
@DependsOn({"minHeight", "maxHeight"})
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(256) // TODO: WARNING HEIGHT
|
@MaxNumber(256) // TODO: WARNING HEIGHT
|
||||||
|
|
||||||
@Desc("The min thickness of this layer")
|
@Desc("The min thickness of this layer")
|
||||||
private int minHeight = 1;
|
private int minHeight = 1;
|
||||||
|
|
||||||
@DependsOn({"minHeight", "maxHeight"})
|
@DependsOn({"minHeight", "maxHeight"})
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(256) // TODO: WARNING HEIGHT
|
@MaxNumber(256) // TODO: WARNING HEIGHT
|
||||||
|
|
||||||
@Desc("The max thickness of this layer")
|
@Desc("The max thickness of this layer")
|
||||||
private int maxHeight = 1;
|
private int maxHeight = 1;
|
||||||
|
|
||||||
|
|
||||||
@Desc("If set, this layer will change size depending on the slope. If in bounds, the layer will get larger (taller) the closer to the center of this slope clip it is. If outside of the slipe's bounds, this layer will not show.")
|
@Desc("If set, this layer will change size depending on the slope. If in bounds, the layer will get larger (taller) the closer to the center of this slope clip it is. If outside of the slipe's bounds, this layer will not show.")
|
||||||
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
|
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
@MinNumber(0.0001)
|
||||||
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
||||||
private double zoom = 5;
|
private double zoom = 5;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The palette of blocks to be used in this layer")
|
@Desc("The palette of blocks to be used in this layer")
|
||||||
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("GRASS_BLOCK"));
|
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("GRASS_BLOCK"));
|
||||||
|
|
||||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
|
||||||
|
|
||||||
public CNG getHeightGenerator(RNG rng, IrisData data) {
|
public CNG getHeightGenerator(RNG rng, IrisData data) {
|
||||||
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
|
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,11 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListBlockType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
@ -45,32 +49,77 @@ import java.util.Map;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisBlockData extends IrisRegistrant {
|
public class IrisBlockData extends IrisRegistrant {
|
||||||
|
private final transient AtomicCache<BlockData> blockdata = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<String> realProperties = new AtomicCache<>();
|
||||||
@RegistryListBlockType
|
@RegistryListBlockType
|
||||||
@Required
|
@Required
|
||||||
@Desc("The block to use")
|
@Desc("The block to use")
|
||||||
private String block = "air";
|
private String block = "air";
|
||||||
|
|
||||||
@Desc("Debug this block by printing it to the console when it's used. Must have debug turned on in settings.")
|
@Desc("Debug this block by printing it to the console when it's used. Must have debug turned on in settings.")
|
||||||
private boolean debug = false;
|
private boolean debug = false;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(1000)
|
@MaxNumber(1000)
|
||||||
@Desc("The weight is used when this block data is inside of a list of blockdata. A weight of two is just as if you placed two of the same block data values in the same list making it more common when randomly picked.")
|
@Desc("The weight is used when this block data is inside of a list of blockdata. A weight of two is just as if you placed two of the same block data values in the same list making it more common when randomly picked.")
|
||||||
private int weight = 1;
|
private int weight = 1;
|
||||||
|
|
||||||
@Desc("If the block cannot be created on this version, Iris will attempt to use this backup block data instead.")
|
@Desc("If the block cannot be created on this version, Iris will attempt to use this backup block data instead.")
|
||||||
private IrisBlockData backup = null;
|
private IrisBlockData backup = null;
|
||||||
|
|
||||||
@Desc("Optional properties for this block data such as 'waterlogged': true")
|
@Desc("Optional properties for this block data such as 'waterlogged': true")
|
||||||
private KMap<String, Object> data = new KMap<>();
|
private KMap<String, Object> data = new KMap<>();
|
||||||
|
|
||||||
private final transient AtomicCache<BlockData> blockdata = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<String> realProperties = new AtomicCache<>();
|
|
||||||
|
|
||||||
public IrisBlockData(String b) {
|
public IrisBlockData(String b) {
|
||||||
this.block = b;
|
this.block = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IrisBlockData from(String j) {
|
||||||
|
IrisBlockData b = new IrisBlockData();
|
||||||
|
String v = j.toLowerCase().trim();
|
||||||
|
|
||||||
|
if (v.contains("[")) {
|
||||||
|
KList<String> props = new KList<>();
|
||||||
|
String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", "");
|
||||||
|
b.setBlock(v.split("\\Q[\\E")[0]);
|
||||||
|
|
||||||
|
if (rp.contains(",")) {
|
||||||
|
props.add(rp.split("\\Q,\\E"));
|
||||||
|
} else {
|
||||||
|
props.add(rp);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String i : props) {
|
||||||
|
Object kg = filter(i.split("\\Q=\\E")[1]);
|
||||||
|
b.data.put(i.split("\\Q=\\E")[0], kg);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
b.setBlock(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Object filter(String string) {
|
||||||
|
if (string.equals("true")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.equals("false")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Integer.parseInt(string);
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
// Checks
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
return Double.valueOf(string).intValue();
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
// Checks
|
||||||
|
}
|
||||||
|
|
||||||
|
return string;
|
||||||
|
}
|
||||||
|
|
||||||
public String computeProperties(KMap<String, Object> data) {
|
public String computeProperties(KMap<String, Object> data) {
|
||||||
if (data.isEmpty()) {
|
if (data.isEmpty()) {
|
||||||
return "";
|
return "";
|
||||||
@ -159,56 +208,6 @@ public class IrisBlockData extends IrisRegistrant {
|
|||||||
return "minecraft:" + dat;
|
return "minecraft:" + dat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisBlockData from(String j) {
|
|
||||||
IrisBlockData b = new IrisBlockData();
|
|
||||||
String v = j.toLowerCase().trim();
|
|
||||||
|
|
||||||
if (v.contains("[")) {
|
|
||||||
KList<String> props = new KList<>();
|
|
||||||
String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", "");
|
|
||||||
b.setBlock(v.split("\\Q[\\E")[0]);
|
|
||||||
|
|
||||||
if (rp.contains(",")) {
|
|
||||||
props.add(rp.split("\\Q,\\E"));
|
|
||||||
} else {
|
|
||||||
props.add(rp);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (String i : props) {
|
|
||||||
Object kg = filter(i.split("\\Q=\\E")[1]);
|
|
||||||
b.data.put(i.split("\\Q=\\E")[0], kg);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
b.setBlock(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Object filter(String string) {
|
|
||||||
if (string.equals("true")) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.equals("false")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(string);
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
// Checks
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
return Double.valueOf(string).intValue();
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
// Checks
|
|
||||||
}
|
|
||||||
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFolderName() {
|
public String getFolderName() {
|
||||||
return "blocks";
|
return "blocks";
|
||||||
|
@ -40,26 +40,21 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
@Desc("Represents a block drop list")
|
@Desc("Represents a block drop list")
|
||||||
@Data
|
@Data
|
||||||
public class IrisBlockDrops {
|
public class IrisBlockDrops {
|
||||||
|
private final transient AtomicCache<KList<BlockData>> data = new AtomicCache<>();
|
||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The blocks that drop loot")
|
@Desc("The blocks that drop loot")
|
||||||
private KList<IrisBlockData> blocks = new KList<>();
|
private KList<IrisBlockData> blocks = new KList<>();
|
||||||
|
|
||||||
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
|
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
|
||||||
private boolean exactBlocks = false;
|
private boolean exactBlocks = false;
|
||||||
|
|
||||||
@Desc("Add in specific items to drop")
|
@Desc("Add in specific items to drop")
|
||||||
@ArrayType(min = 1, type = IrisLoot.class)
|
@ArrayType(min = 1, type = IrisLoot.class)
|
||||||
private KList<IrisLoot> drops = new KList<>();
|
private KList<IrisLoot> drops = new KList<>();
|
||||||
|
|
||||||
@Desc("If this is in a biome, setting skipParents to true will ignore the drops in the region and dimension for this block type. The default (false) will allow all three nodes to fire and add to a list of drops.")
|
@Desc("If this is in a biome, setting skipParents to true will ignore the drops in the region and dimension for this block type. The default (false) will allow all three nodes to fire and add to a list of drops.")
|
||||||
private boolean skipParents = false;
|
private boolean skipParents = false;
|
||||||
|
|
||||||
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
|
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
|
||||||
private boolean replaceVanillaDrops = false;
|
private boolean replaceVanillaDrops = false;
|
||||||
|
|
||||||
private final transient AtomicCache<KList<BlockData>> data = new AtomicCache<>();
|
|
||||||
|
|
||||||
public boolean shouldDropFor(BlockData data, IrisData rdata) {
|
public boolean shouldDropFor(BlockData data, IrisData rdata) {
|
||||||
KList<BlockData> list = this.data.aquire(() ->
|
KList<BlockData> list = this.data.aquire(() ->
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,11 @@ import com.volmit.iris.core.loader.IrisData;
|
|||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@ -39,26 +43,22 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
@Desc("Translate objects")
|
@Desc("Translate objects")
|
||||||
@Data
|
@Data
|
||||||
public class IrisCavePlacer implements IRare {
|
public class IrisCavePlacer implements IRare {
|
||||||
|
private transient final AtomicCache<IrisCave> caveCache = new AtomicCache<>();
|
||||||
|
private transient final AtomicBoolean fail = new AtomicBoolean(false);
|
||||||
@Required
|
@Required
|
||||||
@Desc("Typically a 1 in RARITY on a per chunk/fork basis")
|
@Desc("Typically a 1 in RARITY on a per chunk/fork basis")
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
private int rarity = 15;
|
private int rarity = 15;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Required
|
@Required
|
||||||
@Desc("The cave to place")
|
@Desc("The cave to place")
|
||||||
@RegistryListResource(IrisCave.class)
|
@RegistryListResource(IrisCave.class)
|
||||||
private String cave;
|
private String cave;
|
||||||
|
|
||||||
@Desc("If set to true, this cave is allowed to break the surface")
|
@Desc("If set to true, this cave is allowed to break the surface")
|
||||||
private boolean breakSurface = true;
|
private boolean breakSurface = true;
|
||||||
|
|
||||||
@Desc("The height range this cave can spawn at. If breakSurface is false, the output of this range will be clamped by the current world height to prevent surface breaking.")
|
@Desc("The height range this cave can spawn at. If breakSurface is false, the output of this range will be clamped by the current world height to prevent surface breaking.")
|
||||||
private IrisStyledRange caveStartHeight = new IrisStyledRange(13, 120, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
private IrisStyledRange caveStartHeight = new IrisStyledRange(13, 120, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
||||||
|
|
||||||
private transient final AtomicCache<IrisCave> caveCache = new AtomicCache<>();
|
|
||||||
private transient final AtomicBoolean fail = new AtomicBoolean(false);
|
|
||||||
|
|
||||||
public IrisCave getRealCave(IrisData data) {
|
public IrisCave getRealCave(IrisData data) {
|
||||||
return caveCache.aquire(() -> data.getCaveLoader().load(getCave()));
|
return caveCache.aquire(() -> data.getCaveLoader().load(getCave()));
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import lombok.Data;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
|
||||||
@Snippet("color")
|
@Snippet("color")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ -36,48 +36,24 @@ import java.awt.*;
|
|||||||
@Desc("Represents a color")
|
@Desc("Represents a color")
|
||||||
@Data
|
@Data
|
||||||
public class IrisColor {
|
public class IrisColor {
|
||||||
|
private final transient AtomicCache<Color> color = new AtomicCache<>();
|
||||||
@MaxNumber(7)
|
@MaxNumber(7)
|
||||||
@MinNumber(6)
|
@MinNumber(6)
|
||||||
@Desc("Pass in a 6 digit hexadecimal color to fill R G and B values. You can also include the # symbol, but it's not required.")
|
@Desc("Pass in a 6 digit hexadecimal color to fill R G and B values. You can also include the # symbol, but it's not required.")
|
||||||
private String hex = null;
|
private String hex = null;
|
||||||
|
|
||||||
@MaxNumber(255)
|
@MaxNumber(255)
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("Represents the red channel. Only define this if you are not defining the hex value.")
|
@Desc("Represents the red channel. Only define this if you are not defining the hex value.")
|
||||||
private int red = 0;
|
private int red = 0;
|
||||||
|
|
||||||
@MaxNumber(255)
|
@MaxNumber(255)
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("Represents the green channel. Only define this if you are not defining the hex value.")
|
@Desc("Represents the green channel. Only define this if you are not defining the hex value.")
|
||||||
private int green = 0;
|
private int green = 0;
|
||||||
|
|
||||||
@MaxNumber(255)
|
@MaxNumber(255)
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("Represents the blue channel. Only define this if you are not defining the hex value.")
|
@Desc("Represents the blue channel. Only define this if you are not defining the hex value.")
|
||||||
private int blue = 0;
|
private int blue = 0;
|
||||||
|
|
||||||
private final transient AtomicCache<Color> color = new AtomicCache<>();
|
|
||||||
|
|
||||||
public Color getColor() {
|
|
||||||
return color.aquire(() -> {
|
|
||||||
if (hex != null) {
|
|
||||||
String v = (hex.startsWith("#") ? hex : "#" + hex).trim();
|
|
||||||
try {
|
|
||||||
return Color.decode(v);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Color(red, green, blue);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public org.bukkit.Color getBukkitColor() {
|
|
||||||
return org.bukkit.Color.fromRGB(getColor().getRGB());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Color blend(Color... c) {
|
public static Color blend(Color... c) {
|
||||||
if (c == null || c.length <= 0) {
|
if (c == null || c.length <= 0) {
|
||||||
return null;
|
return null;
|
||||||
@ -104,6 +80,26 @@ public class IrisColor {
|
|||||||
return new Color(a << 24 | r << 16 | g << 8 | b);
|
return new Color(a << 24 | r << 16 | g << 8 | b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color getColor() {
|
||||||
|
return color.aquire(() -> {
|
||||||
|
if (hex != null) {
|
||||||
|
String v = (hex.startsWith("#") ? hex : "#" + hex).trim();
|
||||||
|
try {
|
||||||
|
return Color.decode(v);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.reportError(e);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Color(red, green, blue);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public org.bukkit.Color getBukkitColor() {
|
||||||
|
return org.bukkit.Color.fromRGB(getColor().getRGB());
|
||||||
|
}
|
||||||
|
|
||||||
public int getAsRGB() {
|
public int getAsRGB() {
|
||||||
if (hex != null) {
|
if (hex != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -42,114 +42,6 @@ public class IrisCompat {
|
|||||||
itemFilters = getDefaultItemCompatabilityFilters();
|
itemFilters = getDefaultItemCompatabilityFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockData getBlock(String n) {
|
|
||||||
String buf = n;
|
|
||||||
int err = 16;
|
|
||||||
|
|
||||||
BlockData tx = B.getOrNull(buf);
|
|
||||||
|
|
||||||
if (tx != null) {
|
|
||||||
return tx;
|
|
||||||
}
|
|
||||||
|
|
||||||
searching:
|
|
||||||
while (true) {
|
|
||||||
if (err-- <= 0) {
|
|
||||||
return B.get("STONE");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisCompatabilityBlockFilter i : blockFilters) {
|
|
||||||
if (i.getWhen().equalsIgnoreCase(buf)) {
|
|
||||||
BlockData b = i.getReplace();
|
|
||||||
|
|
||||||
if (b != null) {
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = i.getSupplement();
|
|
||||||
continue searching;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return B.get("STONE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Material getItem(String n) {
|
|
||||||
String buf = n;
|
|
||||||
int err = 16;
|
|
||||||
Material txf = B.getMaterialOrNull(buf);
|
|
||||||
|
|
||||||
if (txf != null) {
|
|
||||||
return txf;
|
|
||||||
}
|
|
||||||
|
|
||||||
int nomore = 64;
|
|
||||||
|
|
||||||
searching:
|
|
||||||
while (true) {
|
|
||||||
if (nomore < 0) {
|
|
||||||
return B.getMaterial("STONE");
|
|
||||||
}
|
|
||||||
|
|
||||||
nomore--;
|
|
||||||
if (err-- <= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisCompatabilityItemFilter i : itemFilters) {
|
|
||||||
if (i.getWhen().equalsIgnoreCase(buf)) {
|
|
||||||
Material b = i.getReplace();
|
|
||||||
|
|
||||||
if (b != null) {
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = i.getSupplement();
|
|
||||||
continue searching;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = n;
|
|
||||||
BlockData tx = B.getOrNull(buf);
|
|
||||||
|
|
||||||
if (tx != null) {
|
|
||||||
return tx.getMaterial();
|
|
||||||
}
|
|
||||||
nomore = 64;
|
|
||||||
|
|
||||||
searching:
|
|
||||||
while (true) {
|
|
||||||
if (nomore < 0) {
|
|
||||||
return B.getMaterial("STONE");
|
|
||||||
}
|
|
||||||
|
|
||||||
nomore--;
|
|
||||||
|
|
||||||
if (err-- <= 0) {
|
|
||||||
return B.getMaterial("STONE");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (IrisCompatabilityBlockFilter i : blockFilters) {
|
|
||||||
if (i.getWhen().equalsIgnoreCase(buf)) {
|
|
||||||
BlockData b = i.getReplace();
|
|
||||||
|
|
||||||
if (b != null) {
|
|
||||||
return b.getMaterial();
|
|
||||||
}
|
|
||||||
|
|
||||||
buf = i.getSupplement();
|
|
||||||
continue searching;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return B.getMaterial("STONE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IrisCompat configured(File f) {
|
public static IrisCompat configured(File f) {
|
||||||
IrisCompat def = new IrisCompat();
|
IrisCompat def = new IrisCompat();
|
||||||
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
|
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
|
||||||
@ -365,4 +257,112 @@ public class IrisCompat {
|
|||||||
|
|
||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockData getBlock(String n) {
|
||||||
|
String buf = n;
|
||||||
|
int err = 16;
|
||||||
|
|
||||||
|
BlockData tx = B.getOrNull(buf);
|
||||||
|
|
||||||
|
if (tx != null) {
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
|
||||||
|
searching:
|
||||||
|
while (true) {
|
||||||
|
if (err-- <= 0) {
|
||||||
|
return B.get("STONE");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (IrisCompatabilityBlockFilter i : blockFilters) {
|
||||||
|
if (i.getWhen().equalsIgnoreCase(buf)) {
|
||||||
|
BlockData b = i.getReplace();
|
||||||
|
|
||||||
|
if (b != null) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = i.getSupplement();
|
||||||
|
continue searching;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return B.get("STONE");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Material getItem(String n) {
|
||||||
|
String buf = n;
|
||||||
|
int err = 16;
|
||||||
|
Material txf = B.getMaterialOrNull(buf);
|
||||||
|
|
||||||
|
if (txf != null) {
|
||||||
|
return txf;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nomore = 64;
|
||||||
|
|
||||||
|
searching:
|
||||||
|
while (true) {
|
||||||
|
if (nomore < 0) {
|
||||||
|
return B.getMaterial("STONE");
|
||||||
|
}
|
||||||
|
|
||||||
|
nomore--;
|
||||||
|
if (err-- <= 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (IrisCompatabilityItemFilter i : itemFilters) {
|
||||||
|
if (i.getWhen().equalsIgnoreCase(buf)) {
|
||||||
|
Material b = i.getReplace();
|
||||||
|
|
||||||
|
if (b != null) {
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = i.getSupplement();
|
||||||
|
continue searching;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = n;
|
||||||
|
BlockData tx = B.getOrNull(buf);
|
||||||
|
|
||||||
|
if (tx != null) {
|
||||||
|
return tx.getMaterial();
|
||||||
|
}
|
||||||
|
nomore = 64;
|
||||||
|
|
||||||
|
searching:
|
||||||
|
while (true) {
|
||||||
|
if (nomore < 0) {
|
||||||
|
return B.getMaterial("STONE");
|
||||||
|
}
|
||||||
|
|
||||||
|
nomore--;
|
||||||
|
|
||||||
|
if (err-- <= 0) {
|
||||||
|
return B.getMaterial("STONE");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (IrisCompatabilityBlockFilter i : blockFilters) {
|
||||||
|
if (i.getWhen().equalsIgnoreCase(buf)) {
|
||||||
|
BlockData b = i.getReplace();
|
||||||
|
|
||||||
|
if (b != null) {
|
||||||
|
return b.getMaterial();
|
||||||
|
}
|
||||||
|
|
||||||
|
buf = i.getSupplement();
|
||||||
|
continue searching;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return B.getMaterial("STONE");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,20 +35,17 @@ import org.bukkit.block.data.BlockData;
|
|||||||
@Desc("Find and replace object materials for compatability")
|
@Desc("Find and replace object materials for compatability")
|
||||||
@Data
|
@Data
|
||||||
public class IrisCompatabilityBlockFilter {
|
public class IrisCompatabilityBlockFilter {
|
||||||
|
private final transient AtomicCache<BlockData> findData = new AtomicCache<>(true);
|
||||||
|
private final transient AtomicCache<BlockData> replaceData = new AtomicCache<>(true);
|
||||||
@Required
|
@Required
|
||||||
@Desc("When iris sees this block, and it's not reconized")
|
@Desc("When iris sees this block, and it's not reconized")
|
||||||
private String when = "";
|
private String when = "";
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
|
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
|
||||||
private String supplement = "";
|
private String supplement = "";
|
||||||
|
|
||||||
@Desc("If exact is true, it compares block data for example minecraft:some_log[axis=x]")
|
@Desc("If exact is true, it compares block data for example minecraft:some_log[axis=x]")
|
||||||
private boolean exact = false;
|
private boolean exact = false;
|
||||||
|
|
||||||
private final transient AtomicCache<BlockData> findData = new AtomicCache<>(true);
|
|
||||||
private final transient AtomicCache<BlockData> replaceData = new AtomicCache<>(true);
|
|
||||||
|
|
||||||
public IrisCompatabilityBlockFilter(String when, String supplement) {
|
public IrisCompatabilityBlockFilter(String when, String supplement) {
|
||||||
this(when, supplement, false);
|
this(when, supplement, false);
|
||||||
}
|
}
|
||||||
|
@ -33,17 +33,15 @@ import org.bukkit.Material;
|
|||||||
@Desc("Find and replace object items for compatability")
|
@Desc("Find and replace object items for compatability")
|
||||||
@Data
|
@Data
|
||||||
public class IrisCompatabilityItemFilter {
|
public class IrisCompatabilityItemFilter {
|
||||||
|
private final transient AtomicCache<Material> findData = new AtomicCache<>(true);
|
||||||
|
private final transient AtomicCache<Material> replaceData = new AtomicCache<>(true);
|
||||||
@Required
|
@Required
|
||||||
@Desc("When iris sees this block, and it's not reconized")
|
@Desc("When iris sees this block, and it's not reconized")
|
||||||
private String when = "";
|
private String when = "";
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
|
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
|
||||||
private String supplement = "";
|
private String supplement = "";
|
||||||
|
|
||||||
private final transient AtomicCache<Material> findData = new AtomicCache<>(true);
|
|
||||||
private final transient AtomicCache<Material> replaceData = new AtomicCache<>(true);
|
|
||||||
|
|
||||||
public IrisCompatabilityItemFilter(String when, String supplement) {
|
public IrisCompatabilityItemFilter(String when, String supplement) {
|
||||||
this.when = when;
|
this.when = when;
|
||||||
this.supplement = supplement;
|
this.supplement = supplement;
|
||||||
|
@ -21,7 +21,13 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.noise.CNG;
|
import com.volmit.iris.util.noise.CNG;
|
||||||
@ -38,71 +44,58 @@ import org.bukkit.block.data.BlockData;
|
|||||||
@Desc("A biome decorator is used for placing flowers, grass, cacti and so on")
|
@Desc("A biome decorator is used for placing flowers, grass, cacti and so on")
|
||||||
@Data
|
@Data
|
||||||
public class IrisDecorator {
|
public class IrisDecorator {
|
||||||
|
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<CNG> varianceGenerator = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<KList<BlockData>> blockDataTops = new AtomicCache<>();
|
||||||
@Desc("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
|
@Desc("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
|
||||||
private IrisGeneratorStyle variance = NoiseStyle.STATIC.style();
|
private IrisGeneratorStyle variance = NoiseStyle.STATIC.style();
|
||||||
|
|
||||||
@Desc("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
|
@Desc("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
|
||||||
private boolean forcePlace = false;
|
private boolean forcePlace = false;
|
||||||
|
|
||||||
@DependsOn({"scaleStack", "stackMin", "stackMax"})
|
@DependsOn({"scaleStack", "stackMin", "stackMax"})
|
||||||
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
|
@Desc("If stackMax is set to true, use this to limit its max height for large caverns")
|
||||||
private int absoluteMaxStack = 30;
|
private int absoluteMaxStack = 30;
|
||||||
|
|
||||||
@Desc("Dispersion is used to pick places to spawn. Scatter randomly places them (vanilla) or Wispy for a streak like patch system.")
|
@Desc("Dispersion is used to pick places to spawn. Scatter randomly places them (vanilla) or Wispy for a streak like patch system.")
|
||||||
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
|
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
|
||||||
|
|
||||||
@DependsOn({"stackMin", "stackMax"})
|
@DependsOn({"stackMin", "stackMax"})
|
||||||
@Desc("If this decorator has a height more than 1 this changes how it picks the height between your maxes. Scatter = random, Wispy = wavy heights")
|
@Desc("If this decorator has a height more than 1 this changes how it picks the height between your maxes. Scatter = random, Wispy = wavy heights")
|
||||||
private IrisGeneratorStyle heightVariance = NoiseStyle.STATIC.style();
|
private IrisGeneratorStyle heightVariance = NoiseStyle.STATIC.style();
|
||||||
|
|
||||||
@Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE or SEA_SURFACE")
|
@Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE or SEA_SURFACE")
|
||||||
private IrisDecorationPart partOf = IrisDecorationPart.NONE;
|
private IrisDecorationPart partOf = IrisDecorationPart.NONE;
|
||||||
|
|
||||||
@DependsOn({"stackMin", "stackMax"})
|
@DependsOn({"stackMin", "stackMax"})
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(256) // TODO: WARNING HEIGHT
|
@MaxNumber(256) // TODO: WARNING HEIGHT
|
||||||
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
|
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
|
||||||
private int stackMin = 1;
|
private int stackMin = 1;
|
||||||
|
|
||||||
@DependsOn({"stackMin", "stackMax"})
|
@DependsOn({"stackMin", "stackMax"})
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(256) // TODO: WARNING HEIGHT
|
@MaxNumber(256) // TODO: WARNING HEIGHT
|
||||||
@Desc("The maximum repeat stack height")
|
@Desc("The maximum repeat stack height")
|
||||||
private int stackMax = 1;
|
private int stackMax = 1;
|
||||||
|
|
||||||
@DependsOn({"stackMin", "stackMax"})
|
@DependsOn({"stackMin", "stackMax"})
|
||||||
@Desc("Changes stackMin and stackMin from being absolute block heights and instead uses them as a percentage to scale the stack based on the cave height" +
|
@Desc("Changes stackMin and stackMin from being absolute block heights and instead uses them as a percentage to scale the stack based on the cave height" +
|
||||||
"\n\nWithin a cave, setting them stackMin/max to 50 would make the stack 50% of the cave height")
|
"\n\nWithin a cave, setting them stackMin/max to 50 would make the stack 50% of the cave height")
|
||||||
private boolean scaleStack = false;
|
private boolean scaleStack = false;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@Desc("The chance for this decorator to decorate at a given X,Y coordinate. This is hit 256 times per chunk (per surface block)")
|
@Desc("The chance for this decorator to decorate at a given X,Y coordinate. This is hit 256 times per chunk (per surface block)")
|
||||||
// TODO: WARNING HEIGHT
|
// TODO: WARNING HEIGHT
|
||||||
private double chance = 0.1;
|
private double chance = 0.1;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The palette of blocks to pick from when this decorator needs to place.")
|
@Desc("The palette of blocks to pick from when this decorator needs to place.")
|
||||||
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("grass"));
|
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("grass"));
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The palette of blocks used at the very top of a 'stackMax' of higher than 1. For example, bamboo tops.")
|
@Desc("The palette of blocks used at the very top of a 'stackMax' of higher than 1. For example, bamboo tops.")
|
||||||
private KList<IrisBlockData> topPalette = new KList<>();
|
private KList<IrisBlockData> topPalette = new KList<>();
|
||||||
|
|
||||||
@DependsOn("topPalette")
|
@DependsOn("topPalette")
|
||||||
@MinNumber(0.01)
|
@MinNumber(0.01)
|
||||||
@MaxNumber(1.0)
|
@MaxNumber(1.0)
|
||||||
@Desc("When the stack passes the top threshold, the top palette will start being used instead of the normal palette.")
|
@Desc("When the stack passes the top threshold, the top palette will start being used instead of the normal palette.")
|
||||||
private double topThreshold = 1.0;
|
private double topThreshold = 1.0;
|
||||||
|
|
||||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<CNG> varianceGenerator = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<KList<BlockData>> blockDataTops = new AtomicCache<>();
|
|
||||||
|
|
||||||
public int getHeight(RNG rng, double x, double z, IrisData data) {
|
public int getHeight(RNG rng, double x, double z, IrisData data) {
|
||||||
if (stackMin == stackMax) {
|
if (stackMin == stackMax) {
|
||||||
return stackMin;
|
return stackMin;
|
||||||
|
@ -20,7 +20,12 @@ package com.volmit.iris.engine.object;
|
|||||||
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -37,55 +42,47 @@ import org.bukkit.util.BlockVector;
|
|||||||
@Desc("Creates ore & other block deposits underground")
|
@Desc("Creates ore & other block deposits underground")
|
||||||
@Data
|
@Data
|
||||||
public class IrisDepositGenerator {
|
public class IrisDepositGenerator {
|
||||||
|
private final transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(256) // TODO: WARNING HEIGHT
|
@MaxNumber(256) // TODO: WARNING HEIGHT
|
||||||
@Desc("The minimum height this deposit can generate at")
|
@Desc("The minimum height this deposit can generate at")
|
||||||
private int minHeight = 7;
|
private int minHeight = 7;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(256) // TODO: WARNING HEIGHT
|
@MaxNumber(256) // TODO: WARNING HEIGHT
|
||||||
@Desc("The maximum height this deposit can generate at")
|
@Desc("The maximum height this deposit can generate at")
|
||||||
private int maxHeight = 55;
|
private int maxHeight = 55;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(8192)
|
@MaxNumber(8192)
|
||||||
@Desc("The minimum amount of deposit blocks per clump")
|
@Desc("The minimum amount of deposit blocks per clump")
|
||||||
private int minSize = 3;
|
private int minSize = 3;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(8192)
|
@MaxNumber(8192)
|
||||||
@Desc("The maximum amount of deposit blocks per clump")
|
@Desc("The maximum amount of deposit blocks per clump")
|
||||||
private int maxSize = 64;
|
private int maxSize = 64;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(128)
|
@MaxNumber(128)
|
||||||
@Desc("The maximum amount of clumps per chunk")
|
@Desc("The maximum amount of clumps per chunk")
|
||||||
private int maxPerChunk = 3;
|
private int maxPerChunk = 3;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(128)
|
@MaxNumber(128)
|
||||||
@Desc("The minimum amount of clumps per chunk")
|
@Desc("The minimum amount of clumps per chunk")
|
||||||
private int minPerChunk = 1;
|
private int minPerChunk = 1;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The palette of blocks to be used in this deposit generator")
|
@Desc("The palette of blocks to be used in this deposit generator")
|
||||||
private KList<IrisBlockData> palette = new KList<>();
|
private KList<IrisBlockData> palette = new KList<>();
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@MaxNumber(64)
|
@MaxNumber(64)
|
||||||
@Desc("Ore varience is how many different objects clumps iris will create")
|
@Desc("Ore varience is how many different objects clumps iris will create")
|
||||||
private int varience = 3;
|
private int varience = 3;
|
||||||
|
|
||||||
private final transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
|
||||||
|
|
||||||
public IrisObject getClump(RNG rng, IrisData rdata) {
|
public IrisObject getClump(RNG rng, IrisData rdata) {
|
||||||
KList<IrisObject> objects = this.objects.aquire(() ->
|
KList<IrisObject> objects = this.objects.aquire(() ->
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,12 @@ import com.volmit.iris.Iris;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
@ -53,224 +58,6 @@ import java.io.IOException;
|
|||||||
public class IrisDimension extends IrisRegistrant {
|
public class IrisDimension extends IrisRegistrant {
|
||||||
public static final BlockData STONE = Material.STONE.createBlockData();
|
public static final BlockData STONE = Material.STONE.createBlockData();
|
||||||
public static final BlockData WATER = Material.WATER.createBlockData();
|
public static final BlockData WATER = Material.WATER.createBlockData();
|
||||||
|
|
||||||
@MinNumber(2)
|
|
||||||
@Required
|
|
||||||
@Desc("The human readable name of this dimension")
|
|
||||||
private String name = "A Dimension";
|
|
||||||
|
|
||||||
@RegistryListResource(IrisJigsawStructure.class)
|
|
||||||
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
|
||||||
private String stronghold;
|
|
||||||
|
|
||||||
@Desc("If set to true, Iris will remove chunks to allow visualizing cross sections of chunks easily")
|
|
||||||
private boolean debugChunkCrossSections = false;
|
|
||||||
|
|
||||||
@Desc("Vertically split up the biome palettes with 3 air blocks in between to visualize them")
|
|
||||||
private boolean explodeBiomePalettes = false;
|
|
||||||
|
|
||||||
@Desc("Studio Mode for testing different parts of the world")
|
|
||||||
private StudioMode studioMode = StudioMode.NORMAL;
|
|
||||||
|
|
||||||
@MinNumber(1)
|
|
||||||
@MaxNumber(16)
|
|
||||||
@Desc("Customize the palette height explosion")
|
|
||||||
private int explodeBiomePaletteSize = 3;
|
|
||||||
|
|
||||||
@MinNumber(2)
|
|
||||||
@MaxNumber(16)
|
|
||||||
@Desc("Every X/Z % debugCrossSectionsMod == 0 cuts the chunk")
|
|
||||||
private int debugCrossSectionsMod = 3;
|
|
||||||
|
|
||||||
@Desc("The average distance between strongholds")
|
|
||||||
private int strongholdJumpDistance = 1280;
|
|
||||||
|
|
||||||
@Desc("Define the maximum strongholds to place")
|
|
||||||
private int maxStrongholds = 14;
|
|
||||||
|
|
||||||
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
|
|
||||||
private boolean aggressiveBiomeReshuffle = false;
|
|
||||||
|
|
||||||
@Desc("Tree growth override settings")
|
|
||||||
private IrisTreeSettings treeSettings = new IrisTreeSettings();
|
|
||||||
|
|
||||||
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
|
|
||||||
private String resourcePack = "";
|
|
||||||
|
|
||||||
@Desc("Spawn Entities in this dimension over time. Iris will continually replenish these mobs just like vanilla does.")
|
|
||||||
@ArrayType(min = 1, type = String.class)
|
|
||||||
@RegistryListResource(IrisSpawner.class)
|
|
||||||
private KList<String> entitySpawners = new KList<>();
|
|
||||||
|
|
||||||
@Desc("Add specific features in exact positions")
|
|
||||||
@ArrayType(min = 1, type = IrisFeaturePositional.class)
|
|
||||||
private KList<IrisFeaturePositional> specificFeatures = new KList<>();
|
|
||||||
|
|
||||||
@Desc("Add random chances for terrain features")
|
|
||||||
@ArrayType(min = 1, type = IrisFeaturePotential.class)
|
|
||||||
private KList<IrisFeaturePotential> features = new KList<>();
|
|
||||||
|
|
||||||
@Desc("Reference loot tables in this area")
|
|
||||||
private IrisLootReference loot = new IrisLootReference();
|
|
||||||
|
|
||||||
@MinNumber(0)
|
|
||||||
@Desc("The version of this dimension. Changing this will stop users from accidentally upgrading (and breaking their worlds).")
|
|
||||||
private int version = 1;
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisBlockDrops.class)
|
|
||||||
@Desc("Define custom block drops for this dimension")
|
|
||||||
private KList<IrisBlockDrops> blockDrops = new KList<>();
|
|
||||||
|
|
||||||
@Desc("Should bedrock be generated or not.")
|
|
||||||
private boolean bedrock = true;
|
|
||||||
|
|
||||||
@MinNumber(0)
|
|
||||||
@MaxNumber(1)
|
|
||||||
@Desc("The land chance. Up to 1.0 for total land or 0.0 for total sea")
|
|
||||||
private double landChance = 0.625;
|
|
||||||
|
|
||||||
@Desc("The placement style of regions")
|
|
||||||
private IrisGeneratorStyle regionStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
|
||||||
|
|
||||||
@Desc("The placement style of land/sea")
|
|
||||||
private IrisGeneratorStyle continentalStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
|
||||||
|
|
||||||
@Desc("The placement style of biomes")
|
|
||||||
private IrisGeneratorStyle landBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
|
||||||
|
|
||||||
@Desc("The placement style of biomes")
|
|
||||||
private IrisGeneratorStyle shoreBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
|
||||||
|
|
||||||
@Desc("The placement style of biomes")
|
|
||||||
private IrisGeneratorStyle seaBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
|
||||||
|
|
||||||
@Desc("The placement style of biomes")
|
|
||||||
private IrisGeneratorStyle caveBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
|
||||||
|
|
||||||
@Desc("Instead of filling objects with air, fills them with cobweb so you can see them")
|
|
||||||
private boolean debugSmartBore = false;
|
|
||||||
|
|
||||||
@Desc("Generate decorations or not")
|
|
||||||
private boolean decorate = true;
|
|
||||||
|
|
||||||
@Desc("Use post processing or not")
|
|
||||||
private boolean postProcessing = true;
|
|
||||||
|
|
||||||
@Desc("Add slabs in post processing")
|
|
||||||
private boolean postProcessingSlabs = true;
|
|
||||||
|
|
||||||
@Desc("Add painted walls in post processing")
|
|
||||||
private boolean postProcessingWalls = true;
|
|
||||||
|
|
||||||
@Desc("Carving configuration for the dimension")
|
|
||||||
private IrisCarving carving = new IrisCarving();
|
|
||||||
|
|
||||||
@Desc("Configuration of fluid bodies such as rivers & lakes")
|
|
||||||
private IrisFluidBodies fluidBodies = new IrisFluidBodies();
|
|
||||||
|
|
||||||
@Desc("The world environment")
|
|
||||||
private Environment environment = Environment.NORMAL;
|
|
||||||
|
|
||||||
@RegistryListResource(IrisRegion.class)
|
|
||||||
@Required
|
|
||||||
@ArrayType(min = 1, type = String.class)
|
|
||||||
@Desc("Define all of the regions to include in this dimension. Dimensions -> Regions -> Biomes -> Objects etc")
|
|
||||||
private KList<String> regions = new KList<>();
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
|
|
||||||
@Desc("Jigsaw structures")
|
|
||||||
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
|
|
||||||
|
|
||||||
@Required
|
|
||||||
@MinNumber(0)
|
|
||||||
@MaxNumber(255)
|
|
||||||
@Desc("The fluid height for this dimension")
|
|
||||||
private int fluidHeight = 63;
|
|
||||||
|
|
||||||
@RegistryListResource(IrisBiome.class)
|
|
||||||
@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 = "";
|
|
||||||
|
|
||||||
@RegistryListResource(IrisBiome.class)
|
|
||||||
@Desc("Keep this either undefined or empty. Setting any region name into this will force iris to only generate the specified region. Great for testing.")
|
|
||||||
private String focusRegion = "";
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
|
|
||||||
private double biomeZoom = 5D;
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@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 = 1D;
|
|
||||||
|
|
||||||
@MinNumber(0)
|
|
||||||
@MaxNumber(360)
|
|
||||||
@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;
|
|
||||||
|
|
||||||
@MinNumber(0)
|
|
||||||
@MaxNumber(8192)
|
|
||||||
@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)
|
|
||||||
@Desc("Coordinate fracturing zoom. Higher = less frequent warping, Lower = more frequent and rapid warping / swirls.")
|
|
||||||
private double coordFractureZoom = 8;
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@Desc("This zooms in the land space")
|
|
||||||
private double landZoom = 1;
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@Desc("This zooms oceanic biomes")
|
|
||||||
private double seaZoom = 1;
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@Desc("Zoom in continents")
|
|
||||||
private double continentZoom = 1;
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@Desc("Change the size of regions")
|
|
||||||
private double regionZoom = 1;
|
|
||||||
|
|
||||||
@Desc("Disable this to stop placing objects, entities, features & updates")
|
|
||||||
private boolean useMantle = true;
|
|
||||||
|
|
||||||
@Desc("Prevent Leaf decay as if placed in creative mode")
|
|
||||||
private boolean preventLeafDecay = false;
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisDepositGenerator.class)
|
|
||||||
@Desc("Define global deposit generators")
|
|
||||||
private KList<IrisDepositGenerator> deposits = new KList<>();
|
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisShapedGeneratorStyle.class)
|
|
||||||
@Desc("Overlay additional noise on top of the interoplated terrain.")
|
|
||||||
private KList<IrisShapedGeneratorStyle> overlayNoise = new KList<>();
|
|
||||||
|
|
||||||
@Desc("If true, the spawner system has infinite energy. This is NOT recommended because it would allow for mobs to keep spawning over and over without a rate limit")
|
|
||||||
private boolean infiniteEnergy = false;
|
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
|
||||||
@MaxNumber(512)
|
|
||||||
@Desc("The rock zoom mostly for zooming in on a wispy palette")
|
|
||||||
private double rockZoom = 5;
|
|
||||||
|
|
||||||
@Desc("The palette of blocks for 'stone'")
|
|
||||||
private IrisMaterialPalette rockPalette = new IrisMaterialPalette().qclear().qadd("stone");
|
|
||||||
|
|
||||||
@Desc("The palette of blocks for 'water'")
|
|
||||||
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
|
|
||||||
|
|
||||||
@Desc("Cartographer map trade overrides")
|
|
||||||
private IrisVillagerOverride patchCartographers = new IrisVillagerOverride().setDisableTrade(false);
|
|
||||||
|
|
||||||
private final transient AtomicCache<Position2> parallaxSize = new AtomicCache<>();
|
private final transient AtomicCache<Position2> parallaxSize = new AtomicCache<>();
|
||||||
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
|
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
|
||||||
private final transient AtomicCache<CNG> fluidLayerGenerator = new AtomicCache<>();
|
private final transient AtomicCache<CNG> fluidLayerGenerator = new AtomicCache<>();
|
||||||
@ -280,6 +67,166 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
private final transient AtomicCache<Double> rad = new AtomicCache<>();
|
private final transient AtomicCache<Double> rad = new AtomicCache<>();
|
||||||
private final transient AtomicCache<Boolean> featuresUsed = new AtomicCache<>();
|
private final transient AtomicCache<Boolean> featuresUsed = new AtomicCache<>();
|
||||||
private final transient AtomicCache<KList<Position2>> strongholdsCache = new AtomicCache<>();
|
private final transient AtomicCache<KList<Position2>> strongholdsCache = new AtomicCache<>();
|
||||||
|
@MinNumber(2)
|
||||||
|
@Required
|
||||||
|
@Desc("The human readable name of this dimension")
|
||||||
|
private String name = "A Dimension";
|
||||||
|
@RegistryListResource(IrisJigsawStructure.class)
|
||||||
|
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
|
||||||
|
private String stronghold;
|
||||||
|
@Desc("If set to true, Iris will remove chunks to allow visualizing cross sections of chunks easily")
|
||||||
|
private boolean debugChunkCrossSections = false;
|
||||||
|
@Desc("Vertically split up the biome palettes with 3 air blocks in between to visualize them")
|
||||||
|
private boolean explodeBiomePalettes = false;
|
||||||
|
@Desc("Studio Mode for testing different parts of the world")
|
||||||
|
private StudioMode studioMode = StudioMode.NORMAL;
|
||||||
|
@MinNumber(1)
|
||||||
|
@MaxNumber(16)
|
||||||
|
@Desc("Customize the palette height explosion")
|
||||||
|
private int explodeBiomePaletteSize = 3;
|
||||||
|
@MinNumber(2)
|
||||||
|
@MaxNumber(16)
|
||||||
|
@Desc("Every X/Z % debugCrossSectionsMod == 0 cuts the chunk")
|
||||||
|
private int debugCrossSectionsMod = 3;
|
||||||
|
@Desc("The average distance between strongholds")
|
||||||
|
private int strongholdJumpDistance = 1280;
|
||||||
|
@Desc("Define the maximum strongholds to place")
|
||||||
|
private int maxStrongholds = 14;
|
||||||
|
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
|
||||||
|
private boolean aggressiveBiomeReshuffle = false;
|
||||||
|
@Desc("Tree growth override settings")
|
||||||
|
private IrisTreeSettings treeSettings = new IrisTreeSettings();
|
||||||
|
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
|
||||||
|
private String resourcePack = "";
|
||||||
|
@Desc("Spawn Entities in this dimension over time. Iris will continually replenish these mobs just like vanilla does.")
|
||||||
|
@ArrayType(min = 1, type = String.class)
|
||||||
|
@RegistryListResource(IrisSpawner.class)
|
||||||
|
private KList<String> entitySpawners = new KList<>();
|
||||||
|
@Desc("Add specific features in exact positions")
|
||||||
|
@ArrayType(min = 1, type = IrisFeaturePositional.class)
|
||||||
|
private KList<IrisFeaturePositional> specificFeatures = new KList<>();
|
||||||
|
@Desc("Add random chances for terrain features")
|
||||||
|
@ArrayType(min = 1, type = IrisFeaturePotential.class)
|
||||||
|
private KList<IrisFeaturePotential> features = new KList<>();
|
||||||
|
@Desc("Reference loot tables in this area")
|
||||||
|
private IrisLootReference loot = new IrisLootReference();
|
||||||
|
@MinNumber(0)
|
||||||
|
@Desc("The version of this dimension. Changing this will stop users from accidentally upgrading (and breaking their worlds).")
|
||||||
|
private int version = 1;
|
||||||
|
@ArrayType(min = 1, type = IrisBlockDrops.class)
|
||||||
|
@Desc("Define custom block drops for this dimension")
|
||||||
|
private KList<IrisBlockDrops> blockDrops = new KList<>();
|
||||||
|
@Desc("Should bedrock be generated or not.")
|
||||||
|
private boolean bedrock = true;
|
||||||
|
@MinNumber(0)
|
||||||
|
@MaxNumber(1)
|
||||||
|
@Desc("The land chance. Up to 1.0 for total land or 0.0 for total sea")
|
||||||
|
private double landChance = 0.625;
|
||||||
|
@Desc("The placement style of regions")
|
||||||
|
private IrisGeneratorStyle regionStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||||
|
@Desc("The placement style of land/sea")
|
||||||
|
private IrisGeneratorStyle continentalStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||||
|
@Desc("The placement style of biomes")
|
||||||
|
private IrisGeneratorStyle landBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||||
|
@Desc("The placement style of biomes")
|
||||||
|
private IrisGeneratorStyle shoreBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||||
|
@Desc("The placement style of biomes")
|
||||||
|
private IrisGeneratorStyle seaBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||||
|
@Desc("The placement style of biomes")
|
||||||
|
private IrisGeneratorStyle caveBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
|
||||||
|
@Desc("Instead of filling objects with air, fills them with cobweb so you can see them")
|
||||||
|
private boolean debugSmartBore = false;
|
||||||
|
@Desc("Generate decorations or not")
|
||||||
|
private boolean decorate = true;
|
||||||
|
@Desc("Use post processing or not")
|
||||||
|
private boolean postProcessing = true;
|
||||||
|
@Desc("Add slabs in post processing")
|
||||||
|
private boolean postProcessingSlabs = true;
|
||||||
|
@Desc("Add painted walls in post processing")
|
||||||
|
private boolean postProcessingWalls = true;
|
||||||
|
@Desc("Carving configuration for the dimension")
|
||||||
|
private IrisCarving carving = new IrisCarving();
|
||||||
|
@Desc("Configuration of fluid bodies such as rivers & lakes")
|
||||||
|
private IrisFluidBodies fluidBodies = new IrisFluidBodies();
|
||||||
|
@Desc("The world environment")
|
||||||
|
private Environment environment = Environment.NORMAL;
|
||||||
|
@RegistryListResource(IrisRegion.class)
|
||||||
|
@Required
|
||||||
|
@ArrayType(min = 1, type = String.class)
|
||||||
|
@Desc("Define all of the regions to include in this dimension. Dimensions -> Regions -> Biomes -> Objects etc")
|
||||||
|
private KList<String> regions = new KList<>();
|
||||||
|
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
|
||||||
|
@Desc("Jigsaw structures")
|
||||||
|
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
|
||||||
|
@Required
|
||||||
|
@MinNumber(0)
|
||||||
|
@MaxNumber(255)
|
||||||
|
@Desc("The fluid height for this dimension")
|
||||||
|
private int fluidHeight = 63;
|
||||||
|
@RegistryListResource(IrisBiome.class)
|
||||||
|
@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 = "";
|
||||||
|
@RegistryListResource(IrisBiome.class)
|
||||||
|
@Desc("Keep this either undefined or empty. Setting any region name into this will force iris to only generate the specified region. Great for testing.")
|
||||||
|
private String focusRegion = "";
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
|
||||||
|
private double biomeZoom = 5D;
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@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 = 1D;
|
||||||
|
@MinNumber(0)
|
||||||
|
@MaxNumber(360)
|
||||||
|
@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;
|
||||||
|
@MinNumber(0)
|
||||||
|
@MaxNumber(8192)
|
||||||
|
@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)
|
||||||
|
@Desc("Coordinate fracturing zoom. Higher = less frequent warping, Lower = more frequent and rapid warping / swirls.")
|
||||||
|
private double coordFractureZoom = 8;
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@Desc("This zooms in the land space")
|
||||||
|
private double landZoom = 1;
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@Desc("This zooms oceanic biomes")
|
||||||
|
private double seaZoom = 1;
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@Desc("Zoom in continents")
|
||||||
|
private double continentZoom = 1;
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@Desc("Change the size of regions")
|
||||||
|
private double regionZoom = 1;
|
||||||
|
@Desc("Disable this to stop placing objects, entities, features & updates")
|
||||||
|
private boolean useMantle = true;
|
||||||
|
@Desc("Prevent Leaf decay as if placed in creative mode")
|
||||||
|
private boolean preventLeafDecay = false;
|
||||||
|
@ArrayType(min = 1, type = IrisDepositGenerator.class)
|
||||||
|
@Desc("Define global deposit generators")
|
||||||
|
private KList<IrisDepositGenerator> deposits = new KList<>();
|
||||||
|
@ArrayType(min = 1, type = IrisShapedGeneratorStyle.class)
|
||||||
|
@Desc("Overlay additional noise on top of the interoplated terrain.")
|
||||||
|
private KList<IrisShapedGeneratorStyle> overlayNoise = new KList<>();
|
||||||
|
@Desc("If true, the spawner system has infinite energy. This is NOT recommended because it would allow for mobs to keep spawning over and over without a rate limit")
|
||||||
|
private boolean infiniteEnergy = false;
|
||||||
|
@MinNumber(0.0001)
|
||||||
|
@MaxNumber(512)
|
||||||
|
@Desc("The rock zoom mostly for zooming in on a wispy palette")
|
||||||
|
private double rockZoom = 5;
|
||||||
|
@Desc("The palette of blocks for 'stone'")
|
||||||
|
private IrisMaterialPalette rockPalette = new IrisMaterialPalette().qclear().qadd("stone");
|
||||||
|
@Desc("The palette of blocks for 'water'")
|
||||||
|
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
|
||||||
|
@Desc("Cartographer map trade overrides")
|
||||||
|
private IrisVillagerOverride patchCartographers = new IrisVillagerOverride().setDisableTrade(false);
|
||||||
|
|
||||||
public KList<Position2> getStrongholds(long seed) {
|
public KList<Position2> getStrongholds(long seed) {
|
||||||
return strongholdsCache.aquire(() -> {
|
return strongholdsCache.aquire(() -> {
|
||||||
|
@ -59,6 +59,13 @@ public enum IrisDirection {
|
|||||||
private final int z;
|
private final int z;
|
||||||
private final CuboidDirection f;
|
private final CuboidDirection f;
|
||||||
|
|
||||||
|
IrisDirection(int x, int y, int z, CuboidDirection f) {
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
this.f = f;
|
||||||
|
}
|
||||||
|
|
||||||
public static IrisDirection getDirection(BlockFace f) {
|
public static IrisDirection getDirection(BlockFace f) {
|
||||||
return switch (f) {
|
return switch (f) {
|
||||||
case DOWN -> DOWN_NEGATIVE_Y;
|
case DOWN -> DOWN_NEGATIVE_Y;
|
||||||
@ -92,23 +99,6 @@ public enum IrisDirection {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return switch (this) {
|
|
||||||
case DOWN_NEGATIVE_Y -> "Down";
|
|
||||||
case EAST_POSITIVE_X -> "East";
|
|
||||||
case NORTH_NEGATIVE_Z -> "North";
|
|
||||||
case SOUTH_POSITIVE_Z -> "South";
|
|
||||||
case UP_POSITIVE_Y -> "Up";
|
|
||||||
case WEST_NEGATIVE_X -> "West";
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isVertical() {
|
|
||||||
return equals(DOWN_NEGATIVE_Y) || equals(UP_POSITIVE_Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IrisDirection closest(Vector v) {
|
public static IrisDirection closest(Vector v) {
|
||||||
double m = Double.MAX_VALUE;
|
double m = Double.MAX_VALUE;
|
||||||
IrisDirection s = null;
|
IrisDirection s = null;
|
||||||
@ -160,75 +150,6 @@ public enum IrisDirection {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector toVector() {
|
|
||||||
return new Vector(x, y, z);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCrooked(IrisDirection to) {
|
|
||||||
if (equals(to.reverse())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !equals(to);
|
|
||||||
}
|
|
||||||
|
|
||||||
IrisDirection(int x, int y, int z, CuboidDirection f) {
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
this.f = f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Vector angle(Vector initial, IrisDirection d) {
|
|
||||||
calculatePermutations();
|
|
||||||
|
|
||||||
for (Map.Entry<GBiset<IrisDirection, IrisDirection>, DOP> entry : permute.entrySet()) {
|
|
||||||
GBiset<IrisDirection, IrisDirection> i = entry.getKey();
|
|
||||||
if (i.getA().equals(this) && i.getB().equals(d)) {
|
|
||||||
return entry.getValue().op(initial);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return initial;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IrisDirection reverse() {
|
|
||||||
switch (this) {
|
|
||||||
case DOWN_NEGATIVE_Y:
|
|
||||||
return UP_POSITIVE_Y;
|
|
||||||
case EAST_POSITIVE_X:
|
|
||||||
return WEST_NEGATIVE_X;
|
|
||||||
case NORTH_NEGATIVE_Z:
|
|
||||||
return SOUTH_POSITIVE_Z;
|
|
||||||
case SOUTH_POSITIVE_Z:
|
|
||||||
return NORTH_NEGATIVE_Z;
|
|
||||||
case UP_POSITIVE_Y:
|
|
||||||
return DOWN_NEGATIVE_Y;
|
|
||||||
case WEST_NEGATIVE_X:
|
|
||||||
return EAST_POSITIVE_X;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EAST_POSITIVE_X;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int x() {
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int y() {
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int z() {
|
|
||||||
return z;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CuboidDirection f() {
|
|
||||||
return f;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static KList<IrisDirection> news() {
|
public static KList<IrisDirection> news() {
|
||||||
return new KList<IrisDirection>().add(NORTH_NEGATIVE_Z, EAST_POSITIVE_X, WEST_NEGATIVE_X, SOUTH_POSITIVE_Z);
|
return new KList<IrisDirection>().add(NORTH_NEGATIVE_Z, EAST_POSITIVE_X, WEST_NEGATIVE_X, SOUTH_POSITIVE_Z);
|
||||||
}
|
}
|
||||||
@ -277,32 +198,6 @@ public enum IrisDirection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the byte value represented in some directional blocks
|
|
||||||
*
|
|
||||||
* @return the byte value
|
|
||||||
*/
|
|
||||||
public byte byteValue() {
|
|
||||||
switch (this) {
|
|
||||||
case DOWN_NEGATIVE_Y:
|
|
||||||
return 0;
|
|
||||||
case EAST_POSITIVE_X:
|
|
||||||
return 5;
|
|
||||||
case NORTH_NEGATIVE_Z:
|
|
||||||
return 2;
|
|
||||||
case SOUTH_POSITIVE_Z:
|
|
||||||
return 3;
|
|
||||||
case UP_POSITIVE_Y:
|
|
||||||
return 1;
|
|
||||||
case WEST_NEGATIVE_X:
|
|
||||||
return 4;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void calculatePermutations() {
|
public static void calculatePermutations() {
|
||||||
if (permute != null) {
|
if (permute != null) {
|
||||||
return;
|
return;
|
||||||
@ -391,6 +286,111 @@ public enum IrisDirection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return switch (this) {
|
||||||
|
case DOWN_NEGATIVE_Y -> "Down";
|
||||||
|
case EAST_POSITIVE_X -> "East";
|
||||||
|
case NORTH_NEGATIVE_Z -> "North";
|
||||||
|
case SOUTH_POSITIVE_Z -> "South";
|
||||||
|
case UP_POSITIVE_Y -> "Up";
|
||||||
|
case WEST_NEGATIVE_X -> "West";
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isVertical() {
|
||||||
|
return equals(DOWN_NEGATIVE_Y) || equals(UP_POSITIVE_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector toVector() {
|
||||||
|
return new Vector(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isCrooked(IrisDirection to) {
|
||||||
|
if (equals(to.reverse())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return !equals(to);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector angle(Vector initial, IrisDirection d) {
|
||||||
|
calculatePermutations();
|
||||||
|
|
||||||
|
for (Map.Entry<GBiset<IrisDirection, IrisDirection>, DOP> entry : permute.entrySet()) {
|
||||||
|
GBiset<IrisDirection, IrisDirection> i = entry.getKey();
|
||||||
|
if (i.getA().equals(this) && i.getB().equals(d)) {
|
||||||
|
return entry.getValue().op(initial);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return initial;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IrisDirection reverse() {
|
||||||
|
switch (this) {
|
||||||
|
case DOWN_NEGATIVE_Y:
|
||||||
|
return UP_POSITIVE_Y;
|
||||||
|
case EAST_POSITIVE_X:
|
||||||
|
return WEST_NEGATIVE_X;
|
||||||
|
case NORTH_NEGATIVE_Z:
|
||||||
|
return SOUTH_POSITIVE_Z;
|
||||||
|
case SOUTH_POSITIVE_Z:
|
||||||
|
return NORTH_NEGATIVE_Z;
|
||||||
|
case UP_POSITIVE_Y:
|
||||||
|
return DOWN_NEGATIVE_Y;
|
||||||
|
case WEST_NEGATIVE_X:
|
||||||
|
return EAST_POSITIVE_X;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EAST_POSITIVE_X;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int x() {
|
||||||
|
return x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int y() {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int z() {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CuboidDirection f() {
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the byte value represented in some directional blocks
|
||||||
|
*
|
||||||
|
* @return the byte value
|
||||||
|
*/
|
||||||
|
public byte byteValue() {
|
||||||
|
switch (this) {
|
||||||
|
case DOWN_NEGATIVE_Y:
|
||||||
|
return 0;
|
||||||
|
case EAST_POSITIVE_X:
|
||||||
|
return 5;
|
||||||
|
case NORTH_NEGATIVE_Z:
|
||||||
|
return 2;
|
||||||
|
case SOUTH_POSITIVE_Z:
|
||||||
|
return 3;
|
||||||
|
case UP_POSITIVE_Y:
|
||||||
|
return 1;
|
||||||
|
case WEST_NEGATIVE_X:
|
||||||
|
return 4;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
public BlockFace getFace() {
|
public BlockFace getFace() {
|
||||||
return switch (this) {
|
return switch (this) {
|
||||||
case DOWN_NEGATIVE_Y -> BlockFace.DOWN;
|
case DOWN_NEGATIVE_Y -> BlockFace.DOWN;
|
||||||
|
@ -21,7 +21,12 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
@ -45,132 +50,108 @@ import org.bukkit.util.Vector;
|
|||||||
@Desc("An iris effect")
|
@Desc("An iris effect")
|
||||||
@Data
|
@Data
|
||||||
public class IrisEffect {
|
public class IrisEffect {
|
||||||
|
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<ChronoLatch> latch = new AtomicCache<>();
|
||||||
@Desc("The potion effect to apply in this area")
|
@Desc("The potion effect to apply in this area")
|
||||||
private String potionEffect = "";
|
private String potionEffect = "";
|
||||||
|
|
||||||
@Desc("The particle effect to apply in the area")
|
@Desc("The particle effect to apply in the area")
|
||||||
private Particle particleEffect = null;
|
private Particle particleEffect = null;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(-32)
|
@MinNumber(-32)
|
||||||
@MaxNumber(32)
|
@MaxNumber(32)
|
||||||
@Desc("Randomly offset from the surface to this surface+value")
|
@Desc("Randomly offset from the surface to this surface+value")
|
||||||
private int particleOffset = 0;
|
private int particleOffset = 0;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(-8)
|
@MinNumber(-8)
|
||||||
@MaxNumber(8)
|
@MaxNumber(8)
|
||||||
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||||
private double particleAltX = 0;
|
private double particleAltX = 0;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(-8)
|
@MinNumber(-8)
|
||||||
@MaxNumber(8)
|
@MaxNumber(8)
|
||||||
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||||
private double particleAltY = 0;
|
private double particleAltY = 0;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(-8)
|
@MinNumber(-8)
|
||||||
@MaxNumber(8)
|
@MaxNumber(8)
|
||||||
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
|
||||||
private double particleAltZ = 0;
|
private double particleAltZ = 0;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@Desc("Randomize the altX by -altX to altX")
|
@Desc("Randomize the altX by -altX to altX")
|
||||||
private boolean randomAltX = true;
|
private boolean randomAltX = true;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@Desc("Randomize the altY by -altY to altY")
|
@Desc("Randomize the altY by -altY to altY")
|
||||||
private boolean randomAltY = false;
|
private boolean randomAltY = false;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@Desc("Randomize the altZ by -altZ to altZ")
|
@Desc("Randomize the altZ by -altZ to altZ")
|
||||||
private boolean randomAltZ = true;
|
private boolean randomAltZ = true;
|
||||||
|
|
||||||
@Desc("The sound to play")
|
@Desc("The sound to play")
|
||||||
private Sound sound = null;
|
private Sound sound = null;
|
||||||
|
|
||||||
@DependsOn({"sound"})
|
@DependsOn({"sound"})
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(512)
|
@MaxNumber(512)
|
||||||
@Desc("The max distance from the player the sound will play")
|
@Desc("The max distance from the player the sound will play")
|
||||||
private int soundDistance = 12;
|
private int soundDistance = 12;
|
||||||
|
|
||||||
@DependsOn({"sound", "maxPitch"})
|
@DependsOn({"sound", "maxPitch"})
|
||||||
@MinNumber(0.01)
|
@MinNumber(0.01)
|
||||||
@MaxNumber(1.99)
|
@MaxNumber(1.99)
|
||||||
@Desc("The minimum sound pitch")
|
@Desc("The minimum sound pitch")
|
||||||
private double minPitch = 0.5D;
|
private double minPitch = 0.5D;
|
||||||
|
|
||||||
@DependsOn({"sound", "minVolume"})
|
@DependsOn({"sound", "minVolume"})
|
||||||
@MinNumber(0.01)
|
@MinNumber(0.01)
|
||||||
@MaxNumber(1.99)
|
@MaxNumber(1.99)
|
||||||
@Desc("The max sound pitch")
|
@Desc("The max sound pitch")
|
||||||
private double maxPitch = 1.5D;
|
private double maxPitch = 1.5D;
|
||||||
|
|
||||||
@DependsOn({"sound"})
|
@DependsOn({"sound"})
|
||||||
@MinNumber(0.001)
|
@MinNumber(0.001)
|
||||||
@MaxNumber(512)
|
@MaxNumber(512)
|
||||||
@Desc("The sound volume.")
|
@Desc("The sound volume.")
|
||||||
private double volume = 1.5D;
|
private double volume = 1.5D;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(512)
|
@MaxNumber(512)
|
||||||
@Desc("The particle count. Try setting to zero for using the alt xyz to a motion value instead of an offset")
|
@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;
|
private int particleCount = 0;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(64)
|
@MaxNumber(64)
|
||||||
@Desc("How far away from the player particles can play")
|
@Desc("How far away from the player particles can play")
|
||||||
private int particleDistance = 20;
|
private int particleDistance = 20;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(128)
|
@MaxNumber(128)
|
||||||
@Desc("How wide the particles can play (player's view left and right) RADIUS")
|
@Desc("How wide the particles can play (player's view left and right) RADIUS")
|
||||||
private int particleDistanceWidth = 24;
|
private int particleDistanceWidth = 24;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
|
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
|
||||||
private double extra = 0;
|
private double extra = 0;
|
||||||
|
|
||||||
@DependsOn({"potionEffect"})
|
@DependsOn({"potionEffect"})
|
||||||
@MinNumber(-1)
|
@MinNumber(-1)
|
||||||
@MaxNumber(1024)
|
@MaxNumber(1024)
|
||||||
@Desc("The Potion Strength or -1 to disable")
|
@Desc("The Potion Strength or -1 to disable")
|
||||||
private int potionStrength = -1;
|
private int potionStrength = -1;
|
||||||
|
|
||||||
@DependsOn({"potionEffect", "potionTicksMin"})
|
@DependsOn({"potionEffect", "potionTicksMin"})
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The max time the potion will last for")
|
@Desc("The max time the potion will last for")
|
||||||
private int potionTicksMax = 155;
|
private int potionTicksMax = 155;
|
||||||
|
|
||||||
@DependsOn({"potionEffect", "potionTicksMax"})
|
@DependsOn({"potionEffect", "potionTicksMax"})
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The min time the potion will last for")
|
@Desc("The min time the potion will last for")
|
||||||
private int potionTicksMin = 75;
|
private int potionTicksMin = 75;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("The effect interval in milliseconds")
|
@Desc("The effect interval in milliseconds")
|
||||||
private int interval = 150;
|
private int interval = 150;
|
||||||
|
|
||||||
@DependsOn({"particleEffect"})
|
@DependsOn({"particleEffect"})
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(16)
|
@MaxNumber(16)
|
||||||
@Desc("The effect distance start away")
|
@Desc("The effect distance start away")
|
||||||
private int particleAway = 5;
|
private int particleAway = 5;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The chance is 1 in CHANCE per interval")
|
@Desc("The chance is 1 in CHANCE per interval")
|
||||||
private int chance = 50;
|
private int chance = 50;
|
||||||
|
|
||||||
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<ChronoLatch> latch = new AtomicCache<>();
|
|
||||||
|
|
||||||
public boolean canTick() {
|
public boolean canTick() {
|
||||||
return latch.aquire(() -> new ChronoLatch(interval)).flip();
|
return latch.aquire(() -> new ChronoLatch(interval)).flip();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,11 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterCavern;
|
import com.volmit.iris.util.matter.MatterCavern;
|
||||||
import com.volmit.iris.util.matter.slices.CavernMatter;
|
import com.volmit.iris.util.matter.slices.CavernMatter;
|
||||||
@ -31,24 +35,20 @@ import lombok.Data;
|
|||||||
@Desc("Represents an procedural eliptical shape")
|
@Desc("Represents an procedural eliptical shape")
|
||||||
@Data
|
@Data
|
||||||
public class IrisElipsoid implements IRare {
|
public class IrisElipsoid implements IRare {
|
||||||
|
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
|
||||||
@Required
|
@Required
|
||||||
@Desc("Typically a 1 in RARITY on a per fork basis")
|
@Desc("Typically a 1 in RARITY on a per fork basis")
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
private int rarity = 1;
|
private int rarity = 1;
|
||||||
|
|
||||||
@RegistryListResource(IrisBiome.class)
|
@RegistryListResource(IrisBiome.class)
|
||||||
@Desc("Force this cave to only generate the specified custom biome")
|
@Desc("Force this cave to only generate the specified custom biome")
|
||||||
private String customBiome = "";
|
private String customBiome = "";
|
||||||
|
|
||||||
@Desc("The styled random radius for x")
|
@Desc("The styled random radius for x")
|
||||||
private IrisStyledRange xRadius = new IrisStyledRange(1, 5, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
private IrisStyledRange xRadius = new IrisStyledRange(1, 5, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
||||||
|
|
||||||
@Desc("The styled random radius for y")
|
@Desc("The styled random radius for y")
|
||||||
private IrisStyledRange yRadius = new IrisStyledRange(1, 5, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
private IrisStyledRange yRadius = new IrisStyledRange(1, 5, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
||||||
|
|
||||||
@Desc("The styled random radius for z")
|
@Desc("The styled random radius for z")
|
||||||
private IrisStyledRange zRadius = new IrisStyledRange(1, 5, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
private IrisStyledRange zRadius = new IrisStyledRange(1, 5, new IrisGeneratorStyle(NoiseStyle.STATIC));
|
||||||
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
|
|
||||||
|
|
||||||
@SuppressWarnings("SuspiciousNameCombination")
|
@SuppressWarnings("SuspiciousNameCombination")
|
||||||
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
|
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
|
||||||
|
@ -19,7 +19,11 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -21,7 +21,11 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListSpecialEntity;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
@ -36,10 +40,20 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.bukkit.*;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.attribute.Attributable;
|
import org.bukkit.attribute.Attributable;
|
||||||
import org.bukkit.entity.*;
|
import org.bukkit.entity.Ageable;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.EntityType;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Mob;
|
||||||
|
import org.bukkit.entity.Panda;
|
||||||
import org.bukkit.entity.Panda.Gene;
|
import org.bukkit.entity.Panda.Gene;
|
||||||
|
import org.bukkit.entity.Villager;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.loot.LootContext;
|
import org.bukkit.loot.LootContext;
|
||||||
|
@ -21,7 +21,11 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
import com.volmit.iris.util.matter.slices.MarkerMatter;
|
||||||
@ -40,29 +44,24 @@ import org.bukkit.entity.Entity;
|
|||||||
@Desc("Represents an entity spawn during initial chunk generation")
|
@Desc("Represents an entity spawn during initial chunk generation")
|
||||||
@Data
|
@Data
|
||||||
public class IrisEntitySpawn implements IRare {
|
public class IrisEntitySpawn implements IRare {
|
||||||
|
private final transient AtomicCache<RNG> rng = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<IrisEntity> ent = new AtomicCache<>();
|
||||||
@RegistryListResource(IrisEntity.class)
|
@RegistryListResource(IrisEntity.class)
|
||||||
@Required
|
@Required
|
||||||
@Desc("The entity")
|
@Desc("The entity")
|
||||||
private String entity = "";
|
private String entity = "";
|
||||||
|
|
||||||
@Desc("The energy multiplier when calculating spawn energy usage")
|
@Desc("The energy multiplier when calculating spawn energy usage")
|
||||||
private double energyMultiplier = 1;
|
private double energyMultiplier = 1;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The 1 in RARITY chance for this entity to spawn")
|
@Desc("The 1 in RARITY chance for this entity to spawn")
|
||||||
private int rarity = 1;
|
private int rarity = 1;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The minumum of this entity to spawn")
|
@Desc("The minumum of this entity to spawn")
|
||||||
private int minSpawns = 1;
|
private int minSpawns = 1;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The max of this entity to spawn")
|
@Desc("The max of this entity to spawn")
|
||||||
private int maxSpawns = 1;
|
private int maxSpawns = 1;
|
||||||
|
|
||||||
private transient IrisSpawner referenceSpawner;
|
private transient IrisSpawner referenceSpawner;
|
||||||
private final transient AtomicCache<RNG> rng = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<IrisEntity> ent = new AtomicCache<>();
|
|
||||||
|
|
||||||
public int spawn(Engine gen, Chunk c, RNG rng) {
|
public int spawn(Engine gen, Chunk c, RNG rng) {
|
||||||
int spawns = minSpawns == maxSpawns ? minSpawns : rng.i(Math.min(minSpawns, maxSpawns), Math.max(minSpawns, maxSpawns));
|
int spawns = minSpawns == maxSpawns ? minSpawns : rng.i(Math.min(minSpawns, maxSpawns), Math.max(minSpawns, maxSpawns));
|
||||||
|
@ -20,7 +20,13 @@ package com.volmit.iris.engine.object;
|
|||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
@ -89,6 +95,10 @@ public class IrisFeature {
|
|||||||
|
|
||||||
private transient AtomicCache<Double> actualRadius = new AtomicCache<>();
|
private transient AtomicCache<Double> actualRadius = new AtomicCache<>();
|
||||||
|
|
||||||
|
public static IrisFeature read(DataInputStream s) throws IOException {
|
||||||
|
return new Gson().fromJson(s.readUTF(), IrisFeature.class);
|
||||||
|
}
|
||||||
|
|
||||||
public double getActualRadius() {
|
public double getActualRadius() {
|
||||||
return actualRadius.aquire(() -> {
|
return actualRadius.aquire(() -> {
|
||||||
double o = 0;
|
double o = 0;
|
||||||
@ -101,10 +111,6 @@ public class IrisFeature {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IrisFeature read(DataInputStream s) throws IOException {
|
|
||||||
return new Gson().fromJson(s.readUTF(), IrisFeature.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void write(DataOutputStream s) throws IOException {
|
public void write(DataOutputStream s) throws IOException {
|
||||||
s.writeUTF(new Gson().toJson(this));
|
s.writeUTF(new Gson().toJson(this));
|
||||||
}
|
}
|
||||||
|
@ -42,12 +42,7 @@ import java.io.IOException;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Desc("Represents an Iris zone")
|
@Desc("Represents an Iris zone")
|
||||||
public class IrisFeaturePositional {
|
public class IrisFeaturePositional {
|
||||||
public IrisFeaturePositional(int x, int z, IrisFeature feature) {
|
private static double BLOCK = 1D / 256D; // TODO: WARNING HEIGHT
|
||||||
this.x = x;
|
|
||||||
this.z = z;
|
|
||||||
this.feature = feature;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@Desc("The x coordinate of this zone")
|
@Desc("The x coordinate of this zone")
|
||||||
private int x;
|
private int x;
|
||||||
@ -61,7 +56,11 @@ public class IrisFeaturePositional {
|
|||||||
private IrisFeature feature;
|
private IrisFeature feature;
|
||||||
|
|
||||||
private transient AtomicCache<NoiseProvider> provider = new AtomicCache<>();
|
private transient AtomicCache<NoiseProvider> provider = new AtomicCache<>();
|
||||||
private static double BLOCK = 1D / 256D; // TODO: WARNING HEIGHT
|
public IrisFeaturePositional(int x, int z, IrisFeature feature) {
|
||||||
|
this.x = x;
|
||||||
|
this.z = z;
|
||||||
|
this.feature = feature;
|
||||||
|
}
|
||||||
|
|
||||||
public static IrisFeaturePositional read(DataInputStream s) throws IOException {
|
public static IrisFeaturePositional read(DataInputStream s) throws IOException {
|
||||||
String sx = s.readUTF();
|
String sx = s.readUTF();
|
||||||
|
@ -49,18 +49,17 @@ public class IrisFluidBodies {
|
|||||||
|
|
||||||
@BlockCoordinates
|
@BlockCoordinates
|
||||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
||||||
//TODO: Impl
|
if (rivers.isNotEmpty()) {
|
||||||
// if (rivers.isNotEmpty()) {
|
for (IrisRiver i : rivers) {
|
||||||
// for (IrisRiver i : rivers) {
|
i.generate(writer, rng, engine, x, y, z);
|
||||||
// i.generate(writer, rng, engine, x, y, z);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
//
|
if (lakes.isNotEmpty()) {
|
||||||
// if (lakes.isNotEmpty()) {
|
for (IrisLake i : lakes) {
|
||||||
// for (IrisLake i : lakes) {
|
i.generate(writer, rng, engine, x, y, z);
|
||||||
// i.generate(writer, rng, engine, x, y, z);
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxRange(IrisData data) {
|
public int getMaxRange(IrisData data) {
|
||||||
|
@ -21,7 +21,11 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
@ -44,66 +48,51 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
public class IrisGenerator extends IrisRegistrant {
|
public class IrisGenerator extends IrisRegistrant {
|
||||||
|
private final transient AtomicCache<CellGenerator> cellGen = new AtomicCache<>();
|
||||||
@MinNumber(0.001)
|
@MinNumber(0.001)
|
||||||
@Desc("The zoom or frequency.")
|
@Desc("The zoom or frequency.")
|
||||||
private double zoom = 1;
|
private double zoom = 1;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("The opacity, essentially a multiplier on the output.")
|
@Desc("The opacity, essentially a multiplier on the output.")
|
||||||
private double opacity = 1;
|
private double opacity = 1;
|
||||||
|
|
||||||
@Desc("Multiply the compsites instead of adding them")
|
@Desc("Multiply the compsites instead of adding them")
|
||||||
private boolean multiplicitive = false;
|
private boolean multiplicitive = false;
|
||||||
|
|
||||||
@MinNumber(0.001)
|
@MinNumber(0.001)
|
||||||
@Desc("The size of the cell fractures")
|
@Desc("The size of the cell fractures")
|
||||||
private double cellFractureZoom = 1D;
|
private double cellFractureZoom = 1D;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("Cell Fracture Coordinate Shuffling")
|
@Desc("Cell Fracture Coordinate Shuffling")
|
||||||
private double cellFractureShuffle = 12D;
|
private double cellFractureShuffle = 12D;
|
||||||
|
|
||||||
@Desc("The height of fracture cells. Set to 0 to disable")
|
@Desc("The height of fracture cells. Set to 0 to disable")
|
||||||
private double cellFractureHeight = 0D;
|
private double cellFractureHeight = 0D;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@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.")
|
@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;
|
private double cellPercentSize = 0.75D;
|
||||||
|
|
||||||
@Desc("The offset to shift this noise x")
|
@Desc("The offset to shift this noise x")
|
||||||
private double offsetX = 0;
|
private double offsetX = 0;
|
||||||
|
|
||||||
@Desc("The offset to shift this noise z")
|
@Desc("The offset to shift this noise z")
|
||||||
private double offsetZ = 0;
|
private double offsetZ = 0;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@Desc("The seed for this generator")
|
@Desc("The seed for this generator")
|
||||||
private long seed = 1;
|
private long seed = 1;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@Desc("The interpolator to use when smoothing this generator into other regions & generators")
|
@Desc("The interpolator to use when smoothing this generator into other regions & generators")
|
||||||
private IrisInterpolator interpolator = new IrisInterpolator();
|
private IrisInterpolator interpolator = new IrisInterpolator();
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(8192)
|
@MaxNumber(8192)
|
||||||
@Desc("Cliff Height Max. Disable with 0 for min and max")
|
@Desc("Cliff Height Max. Disable with 0 for min and max")
|
||||||
private double cliffHeightMax = 0;
|
private double cliffHeightMax = 0;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(8192)
|
@MaxNumber(8192)
|
||||||
@Desc("Cliff Height Min. Disable with 0 for min and max")
|
@Desc("Cliff Height Min. Disable with 0 for min and max")
|
||||||
private double cliffHeightMin = 0;
|
private double cliffHeightMin = 0;
|
||||||
|
|
||||||
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
|
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
|
||||||
@Desc("The list of noise gens this gen contains.")
|
@Desc("The list of noise gens this gen contains.")
|
||||||
private KList<IrisNoiseGenerator> composite = new KList<>();
|
private KList<IrisNoiseGenerator> composite = new KList<>();
|
||||||
|
|
||||||
@Desc("The noise gen for cliff height.")
|
@Desc("The noise gen for cliff height.")
|
||||||
private IrisNoiseGenerator cliffHeightGenerator = new IrisNoiseGenerator();
|
private IrisNoiseGenerator cliffHeightGenerator = new IrisNoiseGenerator();
|
||||||
|
|
||||||
private final transient AtomicCache<CellGenerator> cellGen = new AtomicCache<>();
|
|
||||||
|
|
||||||
public double getMax() {
|
public double getMax() {
|
||||||
return opacity;
|
return opacity;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,11 @@ package com.volmit.iris.engine.object;
|
|||||||
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.noise.CNG;
|
import com.volmit.iris.util.noise.CNG;
|
||||||
import com.volmit.iris.util.noise.ExpressionNoise;
|
import com.volmit.iris.util.noise.ExpressionNoise;
|
||||||
@ -36,34 +40,27 @@ import lombok.experimental.Accessors;
|
|||||||
@Desc("A gen style")
|
@Desc("A gen style")
|
||||||
@Data
|
@Data
|
||||||
public class IrisGeneratorStyle {
|
public class IrisGeneratorStyle {
|
||||||
|
private final transient AtomicCache<CNG> cng = new AtomicCache<>();
|
||||||
@Desc("The chance is 1 in CHANCE per interval")
|
@Desc("The chance is 1 in CHANCE per interval")
|
||||||
private NoiseStyle style = NoiseStyle.FLAT;
|
private NoiseStyle style = NoiseStyle.FLAT;
|
||||||
|
|
||||||
@MinNumber(0.00001)
|
@MinNumber(0.00001)
|
||||||
@Desc("The zoom of this style")
|
@Desc("The zoom of this style")
|
||||||
private double zoom = 1;
|
private double zoom = 1;
|
||||||
|
|
||||||
@Desc("Instead of using the style property, use a custom expression to represent this style.")
|
@Desc("Instead of using the style property, use a custom expression to represent this style.")
|
||||||
@RegistryListResource(IrisExpression.class)
|
@RegistryListResource(IrisExpression.class)
|
||||||
private String expression = null;
|
private String expression = null;
|
||||||
|
|
||||||
@MinNumber(0.00001)
|
@MinNumber(0.00001)
|
||||||
@Desc("The Output multiplier. Only used if parent is fracture.")
|
@Desc("The Output multiplier. Only used if parent is fracture.")
|
||||||
private double multiplier = 1;
|
private double multiplier = 1;
|
||||||
|
|
||||||
@Desc("If set to true, each dimension will be fractured with a different order of input coordinates. This is usually 2 or 3 times slower than normal.")
|
@Desc("If set to true, each dimension will be fractured with a different order of input coordinates. This is usually 2 or 3 times slower than normal.")
|
||||||
private boolean axialFracturing = false;
|
private boolean axialFracturing = false;
|
||||||
|
|
||||||
@Desc("Apply a generator to the coordinate field fed into this parent generator. I.e. Distort your generator with another generator.")
|
@Desc("Apply a generator to the coordinate field fed into this parent generator. I.e. Distort your generator with another generator.")
|
||||||
private IrisGeneratorStyle fracture = null;
|
private IrisGeneratorStyle fracture = null;
|
||||||
|
|
||||||
@MinNumber(0.01562)
|
@MinNumber(0.01562)
|
||||||
@MaxNumber(64)
|
@MaxNumber(64)
|
||||||
@Desc("The exponent")
|
@Desc("The exponent")
|
||||||
private double exponent = 1;
|
private double exponent = 1;
|
||||||
|
|
||||||
private final transient AtomicCache<CNG> cng = new AtomicCache<>();
|
|
||||||
|
|
||||||
public IrisGeneratorStyle(NoiseStyle s) {
|
public IrisGeneratorStyle(NoiseStyle s) {
|
||||||
this.style = s;
|
this.style = s;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.function.NoiseProvider;
|
import com.volmit.iris.util.function.NoiseProvider;
|
||||||
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
import com.volmit.iris.util.interpolation.InterpolationMethod;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
|
@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.function.NoiseProvider3;
|
import com.volmit.iris.util.function.NoiseProvider3;
|
||||||
import com.volmit.iris.util.interpolation.InterpolationMethod3D;
|
import com.volmit.iris.util.interpolation.InterpolationMethod3D;
|
||||||
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
import com.volmit.iris.util.interpolation.IrisInterpolation;
|
||||||
|
@ -18,7 +18,14 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.DependsOn;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -18,7 +18,11 @@
|
|||||||
|
|
||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
@ -21,7 +21,12 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.loader.IrisRegistrant;
|
import com.volmit.iris.core.loader.IrisRegistrant;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
import com.volmit.iris.util.json.JSONObject;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
@ -21,7 +21,11 @@ package com.volmit.iris.engine.object;
|
|||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.mantle.MantleWriter;
|
import com.volmit.iris.engine.mantle.MantleWriter;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.matter.MatterFluidBody;
|
import com.volmit.iris.util.matter.MatterFluidBody;
|
||||||
|
@ -20,7 +20,13 @@ package com.volmit.iris.engine.object;
|
|||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListItemType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.B;
|
import com.volmit.iris.util.data.B;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
@ -40,7 +46,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||||
import org.bukkit.material.Colorable;
|
import org.bukkit.material.Colorable;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
|
||||||
@Snippet("loot")
|
@Snippet("loot")
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@ -49,70 +55,54 @@ import java.awt.*;
|
|||||||
@Desc("Represents a loot entry")
|
@Desc("Represents a loot entry")
|
||||||
@Data
|
@Data
|
||||||
public class IrisLoot {
|
public class IrisLoot {
|
||||||
|
private final transient AtomicCache<CNG> chance = new AtomicCache<>();
|
||||||
@Desc("The target inventory slot types to fill this loot with")
|
@Desc("The target inventory slot types to fill this loot with")
|
||||||
private InventorySlotType slotTypes = InventorySlotType.STORAGE;
|
private InventorySlotType slotTypes = InventorySlotType.STORAGE;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The sub rarity of this loot. Calculated after this loot table has been picked.")
|
@Desc("The sub rarity of this loot. Calculated after this loot table has been picked.")
|
||||||
private int rarity = 1;
|
private int rarity = 1;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("Minimum amount of this loot")
|
@Desc("Minimum amount of this loot")
|
||||||
private int minAmount = 1;
|
private int minAmount = 1;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("Maximum amount of this loot")
|
@Desc("Maximum amount of this loot")
|
||||||
private int maxAmount = 1;
|
private int maxAmount = 1;
|
||||||
|
|
||||||
@MinNumber(1)
|
@MinNumber(1)
|
||||||
@Desc("The display name of this item")
|
@Desc("The display name of this item")
|
||||||
private String displayName = null;
|
private String displayName = null;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@Desc("Minimum durability percent")
|
@Desc("Minimum durability percent")
|
||||||
private double minDurability = 0;
|
private double minDurability = 0;
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@MaxNumber(1)
|
@MaxNumber(1)
|
||||||
@Desc("Maximum durability percent")
|
@Desc("Maximum durability percent")
|
||||||
private double maxDurability = 1;
|
private double maxDurability = 1;
|
||||||
|
|
||||||
@Desc("Define a custom model identifier 1.14+ only")
|
@Desc("Define a custom model identifier 1.14+ only")
|
||||||
private Integer customModel = null;
|
private Integer customModel = null;
|
||||||
|
|
||||||
@Desc("Set this to true to prevent it from being broken")
|
@Desc("Set this to true to prevent it from being broken")
|
||||||
private boolean unbreakable = false;
|
private boolean unbreakable = false;
|
||||||
|
|
||||||
@ArrayType(min = 1, type = ItemFlag.class)
|
@ArrayType(min = 1, type = ItemFlag.class)
|
||||||
@Desc("The item flags to add")
|
@Desc("The item flags to add")
|
||||||
private KList<ItemFlag> itemFlags = new KList<>();
|
private KList<ItemFlag> itemFlags = new KList<>();
|
||||||
|
|
||||||
@Desc("Apply enchantments to this item")
|
@Desc("Apply enchantments to this item")
|
||||||
@ArrayType(min = 1, type = IrisEnchantment.class)
|
@ArrayType(min = 1, type = IrisEnchantment.class)
|
||||||
private KList<IrisEnchantment> enchantments = new KList<>();
|
private KList<IrisEnchantment> enchantments = new KList<>();
|
||||||
|
|
||||||
@Desc("Apply attribute modifiers to this item")
|
@Desc("Apply attribute modifiers to this item")
|
||||||
@ArrayType(min = 1, type = IrisAttributeModifier.class)
|
@ArrayType(min = 1, type = IrisAttributeModifier.class)
|
||||||
private KList<IrisAttributeModifier> attributes = new KList<>();
|
private KList<IrisAttributeModifier> attributes = new KList<>();
|
||||||
|
|
||||||
@ArrayType(min = 1, type = String.class)
|
@ArrayType(min = 1, type = String.class)
|
||||||
@Desc("Add lore to this item")
|
@Desc("Add lore to this item")
|
||||||
private KList<String> lore = new KList<>();
|
private KList<String> lore = new KList<>();
|
||||||
|
|
||||||
@RegistryListItemType
|
@RegistryListItemType
|
||||||
@Required
|
@Required
|
||||||
@Desc("This is the item or block type. Does not accept minecraft:*. Only materials such as DIAMOND_SWORD or DIRT.")
|
@Desc("This is the item or block type. Does not accept minecraft:*. Only materials such as DIAMOND_SWORD or DIRT.")
|
||||||
private String type = "";
|
private String type = "";
|
||||||
|
|
||||||
@Desc("The dye color")
|
@Desc("The dye color")
|
||||||
private DyeColor dyeColor = null;
|
private DyeColor dyeColor = null;
|
||||||
|
|
||||||
@Desc("The leather armor color")
|
@Desc("The leather armor color")
|
||||||
private String leatherColor = null;
|
private String leatherColor = null;
|
||||||
|
|
||||||
private final transient AtomicCache<CNG> chance = new AtomicCache<>();
|
|
||||||
|
|
||||||
public Material getType() {
|
public Material getType() {
|
||||||
return B.getMaterial(type);
|
return B.getMaterial(type);
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,11 @@
|
|||||||
package com.volmit.iris.engine.object;
|
package com.volmit.iris.engine.object;
|
||||||
|
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.data.DataProvider;
|
import com.volmit.iris.util.data.DataProvider;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@ -34,20 +38,17 @@ import lombok.experimental.Accessors;
|
|||||||
@Desc("Represents a loot entry")
|
@Desc("Represents a loot entry")
|
||||||
@Data
|
@Data
|
||||||
public class IrisLootReference {
|
public class IrisLootReference {
|
||||||
|
private final transient AtomicCache<KList<IrisLootTable>> tt = new AtomicCache<>();
|
||||||
@Desc("Add = add on top of parent tables, Replace = clear first then add these. Clear = Remove all and dont add loot from this or parent.")
|
@Desc("Add = add on top of parent tables, Replace = clear first then add these. Clear = Remove all and dont add loot from this or parent.")
|
||||||
private IrisLootMode mode = IrisLootMode.ADD;
|
private IrisLootMode mode = IrisLootMode.ADD;
|
||||||
|
|
||||||
@RegistryListResource(IrisLootTable.class)
|
@RegistryListResource(IrisLootTable.class)
|
||||||
@ArrayType(min = 1, type = String.class)
|
@ArrayType(min = 1, type = String.class)
|
||||||
@Desc("Add loot table registries here")
|
@Desc("Add loot table registries here")
|
||||||
private KList<String> tables = new KList<>();
|
private KList<String> tables = new KList<>();
|
||||||
|
|
||||||
@MinNumber(0)
|
@MinNumber(0)
|
||||||
@Desc("Increase the chance of loot in this area")
|
@Desc("Increase the chance of loot in this area")
|
||||||
private double multiplier = 1D;
|
private double multiplier = 1D;
|
||||||
|
|
||||||
private final transient AtomicCache<KList<IrisLootTable>> tt = new AtomicCache<>();
|
|
||||||
|
|
||||||
public KList<IrisLootTable> getLootTables(DataProvider g) {
|
public KList<IrisLootTable> getLootTables(DataProvider g) {
|
||||||
return tt.aquire(() ->
|
return tt.aquire(() ->
|
||||||
{
|
{
|
||||||
|
@ -20,7 +20,11 @@ package com.volmit.iris.engine.object;
|
|||||||
|
|
||||||
import com.volmit.iris.core.loader.IrisData;
|
import com.volmit.iris.core.loader.IrisData;
|
||||||
import com.volmit.iris.engine.data.cache.AtomicCache;
|
import com.volmit.iris.engine.data.cache.AtomicCache;
|
||||||
import com.volmit.iris.engine.object.annotations.*;
|
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Desc;
|
||||||
|
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Required;
|
||||||
|
import com.volmit.iris.engine.object.annotations.Snippet;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.noise.CNG;
|
import com.volmit.iris.util.noise.CNG;
|
||||||
@ -37,22 +41,19 @@ import org.bukkit.block.data.BlockData;
|
|||||||
@Desc("A palette of materials")
|
@Desc("A palette of materials")
|
||||||
@Data
|
@Data
|
||||||
public class IrisMaterialPalette {
|
public class IrisMaterialPalette {
|
||||||
|
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
||||||
|
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
||||||
@Desc("The style of noise")
|
@Desc("The style of noise")
|
||||||
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
|
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
|
||||||
|
|
||||||
@MinNumber(0.0001)
|
@MinNumber(0.0001)
|
||||||
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
|
||||||
private double zoom = 5;
|
private double zoom = 5;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
@ArrayType(min = 1, type = IrisBlockData.class)
|
@ArrayType(min = 1, type = IrisBlockData.class)
|
||||||
@Desc("The palette of blocks to be used in this layer")
|
@Desc("The palette of blocks to be used in this layer")
|
||||||
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("STONE"));
|
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("STONE"));
|
||||||
|
|
||||||
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
|
|
||||||
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
|
|
||||||
|
|
||||||
public BlockData get(RNG rng, double x, double y, double z, IrisData rdata) {
|
public BlockData get(RNG rng, double x, double y, double z, IrisData rdata) {
|
||||||
if (getBlockData(rdata).isEmpty()) {
|
if (getBlockData(rdata).isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user