Merge branch 'master' into Fixes

This commit is contained in:
CocoTheOwner 2021-09-05 11:39:21 +02:00
commit 8123ba9a01
33 changed files with 857 additions and 105 deletions

View File

@ -22,7 +22,7 @@ plugins {
}
group 'com.volmit.iris'
version '1.8.2'
version '1.8.4'
def apiVersion = '1.17'
def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris'

View File

@ -22,14 +22,27 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.decree.DecreeContext;
import com.volmit.iris.util.decree.DecreeExecutor;
import com.volmit.iris.util.decree.DecreeOrigin;
import com.volmit.iris.util.decree.annotations.Decree;
import com.volmit.iris.util.decree.annotations.Param;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.jobs.QueueJob;
import org.bukkit.Chunk;
import java.io.File;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@Decree(name = "iris", aliases = {"ir", "irs"}, description = "Basic Command")
public class CommandIris implements DecreeExecutor {
@ -37,6 +50,7 @@ public class CommandIris implements DecreeExecutor {
private CommandPregen pregen;
private CommandSettings settings;
private CommandObject object;
private CommandJigsaw jigsaw;
private CommandWhat what;
@Decree(description = "Create a new world", aliases = {"+", "c"})
@ -148,20 +162,83 @@ public class CommandIris implements DecreeExecutor {
Iris.service(StudioSVC.class).downloadSearch(sender(), "IrisDimensions/" + pack + "/" + branch, trim, overwrite);
}
@Decree(description = "Get metrics for your world", aliases = "measure", origin = DecreeOrigin.PLAYER)
public void metrics() {
if (!IrisToolbelt.isIrisWorld(world())) {
sender().sendMessage(C.RED + "You must be in an Iris world");
return;
}
sender().sendMessage(C.GREEN + "Sending metrics...");
engine().printMetrics(sender());
}
@Decree(description = "Reload configuration file (this is also done automatically)")
public void reload() {
IrisSettings.invalidate();
IrisSettings.get();
sender().sendMessage(C.GREEN + "Hotloaded settings");
}
@Decree(name = "regen", description = "Regenerate nearby chunks.", aliases = "rg", sync = true, origin = DecreeOrigin.PLAYER)
public void regen(
@Param(name = "radius", description = "The radius of nearby cunks", defaultValue = "5")
int radius
) {
if (IrisToolbelt.isIrisWorld(player().getWorld())) {
VolmitSender sender = sender();
J.a(() -> {
DecreeContext.touch(sender);
PlatformChunkGenerator plat = IrisToolbelt.access(player().getWorld());
Engine engine = plat.getEngine();
try {
int vd = radius;
int rg = 0;
Chunk cx = player().getLocation().getChunk();
KList<Runnable> js = new KList<>();
BurstExecutor b = MultiBurst.burst.burst();
b.setMulticore(false);
int rad = engine.getMantle().getRealRadius();
for (int i = -(vd + rad); i <= vd + rad; i++) {
for (int j = -(vd + rad); j <= vd + rad; j++) {
engine.getMantle().getMantle().deleteChunk(i + cx.getX(), j + cx.getZ());
}
}
for (int i = -vd; i <= vd; i++) {
for (int j = -vd; j <= vd; j++) {
int finalJ = j;
int finalI = i;
b.queue(() -> plat.injectChunkReplacement(player().getWorld(), finalI + cx.getX(), finalJ + cx.getZ(), (f) -> {
synchronized (js) {
js.add(f);
}
}));
}
}
b.complete();
sender().sendMessage(C.GREEN + "Regenerating " + Form.f(js.size()) + " Sections");
QueueJob<Runnable> r = new QueueJob<>() {
final KList<Future<?>> futures = new KList<>();
@Override
public void execute(Runnable runnable) {
futures.add(J.sfut(runnable));
if (futures.size() > 64) {
while (futures.isNotEmpty()) {
try {
futures.remove(0).get();
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
}
}
@Override
public String getName() {
return "Regenerating";
}
};
r.queue(js);
r.execute(sender());
} catch (Throwable e) {
sender().sendMessage("Unable to parse view-distance");
}
});
} else {
sender().sendMessage(C.RED + "You must be in an Iris World to use regen!");
}
}
}

View File

@ -0,0 +1,94 @@
package com.volmit.iris.core.commands;
import com.volmit.iris.Iris;
import com.volmit.iris.core.edit.JigsawEditor;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.jigsaw.PlannedStructure;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.util.decree.DecreeExecutor;
import com.volmit.iris.util.decree.DecreeOrigin;
import com.volmit.iris.util.decree.annotations.Decree;
import com.volmit.iris.util.decree.annotations.Param;
import com.volmit.iris.util.decree.specialhandlers.ObjectHandler;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import java.io.File;
@Decree(name = "jigsaw", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris jigsaw commands")
public class CommandJigsaw implements DecreeExecutor {
@Decree(description = "Edit a jigsaw piece")
public void edit(
@Param(description = "The jigsaw piece to edit")
IrisJigsawPiece piece
) {
File dest = piece.getLoadFile();
new JigsawEditor(player(), piece, IrisData.loadAnyObject(piece.getObject()), dest);
}
@Decree(description = "Place a jigsaw structure")
public void place(
@Param(description = "The jigsaw structure to place")
IrisJigsawStructure structure
) {
PrecisionStopwatch p = PrecisionStopwatch.start();
PlannedStructure ps = new PlannedStructure(structure, new IrisPosition(player().getLocation()), new RNG());
sender().sendMessage(C.GREEN + "Generated " + ps.getPieces().size() + " pieces in " + Form.duration(p.getMilliseconds(), 2));
ps.place(world());
}
@Decree(description = "Create a jigsaw piece")
public void create(
@Param(description = "The name of the jigsaw piece")
String piece,
@Param(description = "The project to add the jigsaw piece to")
String project,
@Param(description = "The object to use for this piece", customHandler = ObjectHandler.class)
String object
) {
IrisObject o = IrisData.loadAnyObject(object);
if (object == null) {
sender().sendMessage(C.RED + "Failed to find existing object");
return;
}
File dest = Iris.instance.getDataFile("packs", project, "jigsaw-pieces", piece + ".json");
new JigsawEditor(player(), null, o, dest);
sender().sendMessage(C.GRAY + "* Right Click blocks to make them connectors");
sender().sendMessage(C.GRAY + "* Right Click connectors to orient them");
sender().sendMessage(C.GRAY + "* Shift + Right Click connectors to remove them");
sender().sendMessage(C.GREEN + "Remember to use /iris jigsaw save");
}
@Decree(description = "Exit the current jigsaw editor")
public void exit() {
JigsawEditor editor = JigsawEditor.editors.get(player());
if (editor == null) {
sender().sendMessage(C.GOLD + "You don't have any pieces open to exit!");
return;
}
editor.exit();
sender().sendMessage(C.GREEN + "Exited Jigsaw Editor");
}
@Decree(description = "Save & Exit the current jigsaw editor")
public void save() {
JigsawEditor editor = JigsawEditor.editors.get(player());
if (editor == null) {
sender().sendMessage(C.GOLD + "You don't have any pieces open to save!");
return;
}
editor.close();
sender().sendMessage(C.GREEN + "Saved & Exited Jigsaw Editor");
}
}

View File

@ -107,7 +107,7 @@ public class CommandObject implements DecreeExecutor {
sender().playSound(Sound.AMBIENT_SOUL_SAND_VALLEY_ADDITIONS, 1f, 1.5f);
}
@Decree(description = "Contract a selection based on your looking direction", aliases = "-")
@Decree(description = "Contract a selection based on your looking direction")
public void contract(
@Param(description = "The amount to inset by", defaultValue = "1")
int amount
@ -345,7 +345,7 @@ public class CommandObject implements DecreeExecutor {
sender().sendMessage(C.GREEN + "Successfully object to saved: " + dimension.getLoadKey() + "/objects/" + name);
}
@Decree(description = "Shift a selection in your looking direction", aliases = "-")
@Decree(description = "Shift a selection in your looking direction")
public void shift(
@Param(description = "The amount to shift by", defaultValue = "1")
int amount
@ -369,7 +369,7 @@ public class CommandObject implements DecreeExecutor {
sender().playSound(Sound.ENTITY_ITEM_FRAME_ROTATE_ITEM, 1f, 0.55f);
}
@Decree(description = "Undo a number of pastes", aliases = "-")
@Decree(description = "Undo a number of pastes")
public void undo(
@Param(description = "The amount of pastes to undo", defaultValue = "1")
int amount

View File

@ -65,7 +65,7 @@ public class CommandPregen implements DecreeExecutor {
}
}
@Decree(description = "Pause / continue the active pregeneration task", aliases = {"t", "resume", "unpause"})
@Decree(description = "Pause / continue the active pregeneration task", aliases = {"resume", "unpause"})
public void pause() {
if (PregeneratorJob.pauseResume()) {
sender().sendMessage(C.GREEN + "Paused/unpaused pregeneration task, now: " + (PregeneratorJob.isPaused() ? "Paused" : "Running") + ".");

View File

@ -79,9 +79,9 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.function.Supplier;
@Decree(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", studio = true)
@Decree(name = "studio", aliases = {"std"}, description = "Studio Commands", studio = true)
public class CommandStudio implements DecreeExecutor {
@Decree(description = "Open a new studio world", aliases = "o", sync = true)
@Decree(description = "Open a new studio world", sync = true)
public void open(
@Param(defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
IrisDimension dimension,
@ -91,7 +91,7 @@ public class CommandStudio implements DecreeExecutor {
Iris.service(StudioSVC.class).open(sender(), seed, dimension.getLoadKey());
}
@Decree(description = "Open VSCode for a dimension", aliases = {"vsc", "edit"})
@Decree(description = "Open VSCode for a dimension", aliases = {"edit"})
public void vscode(
@Param(defaultValue = "overworld", description = "The dimension to open VSCode for", aliases = "dim")
IrisDimension dimension
@ -100,7 +100,7 @@ public class CommandStudio implements DecreeExecutor {
Iris.service(StudioSVC.class).openVSCode(sender(), dimension.getLoadKey());
}
@Decree(description = "Close an open studio project", aliases = {"x", "c"}, sync = true)
@Decree(description = "Close an open studio project", aliases = {"x"}, sync = true)
public void close() {
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
sender().sendMessage(C.RED + "No open studio projects.");
@ -111,7 +111,7 @@ public class CommandStudio implements DecreeExecutor {
sender().sendMessage(C.GREEN + "Project Closed.");
}
@Decree(description = "Create a new studio project", aliases = "+", sync = true)
@Decree(description = "Create a new studio project", sync = true)
public void create(
@Param(description = "The name of this new Iris Project.")
String name,
@ -262,7 +262,7 @@ public class CommandStudio implements DecreeExecutor {
}
@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 = {"eb"}, origin = DecreeOrigin.PLAYER)
public void editbiome(
@Param(contextual = true, description = "The biome to edit")
IrisBiome biome
@ -309,7 +309,7 @@ public class CommandStudio implements DecreeExecutor {
engine().getWorldManager().chargeEnergy();
}
@Decree(description = "Preview noise gens (External GUI)", aliases = {"generator", "gen"})
@Decree(description = "Preview noise gens (External GUI)", aliases = {"generator"})
public void explore(
@Param(description = "The generator to explore", contextual = true)
IrisGenerator generator,
@ -330,7 +330,7 @@ public class CommandStudio implements DecreeExecutor {
NoiseExplorerGUI.launch(l, "Custom Generator");
}
@Decree(description = "Find any biome or region", aliases = {"goto", "g"}, origin = DecreeOrigin.PLAYER)
@Decree(description = "Find any biome or region", aliases = {"goto"}, origin = DecreeOrigin.PLAYER)
public void find(
@Param(description = "The biome or region to find", defaultValue = "null")
IrisBiome biome,
@ -446,7 +446,7 @@ public class CommandStudio implements DecreeExecutor {
sender().sendMessage(C.GREEN + "Opening map!");
}
@Decree(description = "Package a dimension into a compressed format", aliases = "package")
@Decree(name = "package", description = "Package a dimension into a compressed format")
public void pkg(
@Param(name = "dimension", description = "The dimension pack to compress", contextual = true, defaultValue = "overworld")
IrisDimension dimension,
@ -662,7 +662,7 @@ public class CommandStudio implements DecreeExecutor {
entity.spawn(engine(), new Location(world(), location.getX(), location.getY(), location.getZ()));
}
@Decree(description = "Teleport to the active studio world", aliases = "stp", origin = DecreeOrigin.PLAYER, sync = true)
@Decree(description = "Teleport to the active studio world", aliases = {"tp"}, origin = DecreeOrigin.PLAYER, sync = true)
public void tpstudio() {
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
sender().sendMessage(C.RED + "No studio world is open!");
@ -691,7 +691,7 @@ public class CommandStudio implements DecreeExecutor {
}
}
@Decree(aliases = {"find-features", "nf"}, description = "Get the noise feature data in your chunk")
@Decree(aliases = "nf", description = "Get the noise feature data in your chunk")
public void features() {
if (!IrisToolbelt.isIrisWorld(player().getWorld())) {
@ -706,7 +706,7 @@ public class CommandStudio implements DecreeExecutor {
}
}
@Decree(aliases = "find-objects", description = "Get information about nearby structures")
@Decree(description = "Get information about nearby structures")
public void objects() {
if (!IrisToolbelt.isIrisWorld(player().getWorld())) {
sender().sendMessage(C.RED + "You must be in an Iris world");

View File

@ -357,11 +357,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
public boolean shouldSkipClass(Class<?> c) {
if (c.equals(AtomicCache.class)) {
return true;
} else if (c.equals(ChronoLatch.class)) {
return true;
}
return false;
} else return c.equals(ChronoLatch.class);
}
@Override

View File

@ -297,10 +297,8 @@ public class ResourceLoader<T extends IrisRegistrant> {
lock.unlock();
if(folderCache == null)
{
synchronized (this)
{
if (folderCache == null) {
synchronized (this) {
return getFolderCache();
}
}

View File

@ -64,7 +64,7 @@ public class CommandSVC implements IrisService, DecreeSystem {
}
}
if ((msg.startsWith("locate ") || msg.startsWith("locatebiome ")) && IrisToolbelt.isIrisWorld(e.getPlayer().getWorld())){
if ((msg.startsWith("locate ") || msg.startsWith("locatebiome ")) && IrisToolbelt.isIrisWorld(e.getPlayer().getWorld())) {
new VolmitSender(e.getPlayer()).sendMessage(C.RED + "Locating biomes & objects is disabled in Iris Worlds. Use /iris studio goto <biome>");
e.setCancelled(true);
}

View File

@ -23,10 +23,7 @@ import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.MantleComponent;
import com.volmit.iris.engine.mantle.components.MantleCarvingComponent;
import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
import com.volmit.iris.engine.mantle.components.*;
import com.volmit.iris.engine.object.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
@ -56,6 +53,7 @@ public class IrisEngineMantle implements EngineMantle {
radius = radCache.aquire(this::computeParallaxSize);
components = new KList<>();
registerComponent(new MantleCarvingComponent(this));
registerComponent(new MantleFluidBodyComponent(this));
registerComponent(new MantleFeatureComponent(this));
registerComponent(new MantleJigsawComponent(this));
registerComponent(new MantleObjectComponent(this));
@ -288,7 +286,7 @@ public class IrisEngineMantle implements EngineMantle {
x = Math.max(z, x);
int u = x;
int v = computeFeatureRange();
int c = computeCarvingRange();
int c = Math.max(computeCarvingRange(), computeBodyRange());
x = Math.max(jig, x);
x = Math.max(x, v);
x = Math.max(x, c);
@ -303,6 +301,22 @@ public class IrisEngineMantle implements EngineMantle {
return x;
}
private int computeBodyRange() {
int m = 0;
m = Math.max(m, getDimension().getFluidBodies().getMaxRange(getData()));
for (IrisRegion i : getDimension().getAllRegions(getEngine())) {
m = Math.max(m, i.getFluidBodies().getMaxRange(getData()));
}
for (IrisBiome i : getDimension().getAllBiomes(getEngine())) {
m = Math.max(m, i.getFluidBodies().getMaxRange(getData()));
}
return m;
}
private int computeCarvingRange() {
int m = 0;

View File

@ -66,6 +66,10 @@ public class MantleWriter implements IObjectPlacer {
}
public <T> void setData(int x, int y, int z, T t) {
if (t == null) {
return;
}
int cx = x >> 4;
int cz = z >> 4;
@ -161,6 +165,10 @@ public class MantleWriter implements IObjectPlacer {
setElipsoid(cx, cy, cz, radius, radius, radius, fill, data);
}
public <T> void setElipsoid(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, T data) {
setElipsoidFunction(cx, cy, cz, rx, ry, rz, fill, (a, b, c) -> data);
}
/**
* Set an elipsoid into the mantle
*
@ -174,7 +182,7 @@ public class MantleWriter implements IObjectPlacer {
* @param data the data to set
* @param <T> the type of data to apply to the mantle
*/
public <T> void setElipsoid(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, T data) {
public <T> void setElipsoidFunction(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, Function3<Integer, Integer, Integer, T> data) {
rx += 0.5;
ry += 0.5;
rz += 0.5;
@ -217,15 +225,15 @@ public class MantleWriter implements IObjectPlacer {
}
}
setData(x + cx, y + cy, z + cz, data);
setData(-x + cx, y + cy, z + cz, data);
setData(x + cx, -y + cy, z + cz, data);
setData(x + cx, y + cy, -z + cz, data);
setData(-x + cx, y + cy, -z + cz, data);
setData(-x + cx, -y + cy, z + cz, data);
setData(x + cx, -y + cy, -z + cz, data);
setData(-x + cx, y + cy, -z + cz, data);
setData(-x + cx, -y + cy, -z + cz, data);
setData(x + cx, y + cy, z + cz, data.apply(x + cx, y + cy, z + cz));
setData(-x + cx, y + cy, z + cz, data.apply(-x + cx, y + cy, z + cz));
setData(x + cx, -y + cy, z + cz, data.apply(x + cx, -y + cy, z + cz));
setData(x + cx, y + cy, -z + cz, data.apply(x + cx, y + cy, -z + cz));
setData(-x + cx, y + cy, -z + cz, data.apply(-x + cx, y + cy, -z + cz));
setData(-x + cx, -y + cy, z + cz, data.apply(-x + cx, -y + cy, z + cz));
setData(x + cx, -y + cy, -z + cz, data.apply(x + cx, -y + cy, -z + cz));
setData(-x + cx, y + cy, -z + cz, data.apply(-x + cx, y + cy, -z + cz));
setData(-x + cx, -y + cy, -z + cz, data.apply(-x + cx, -y + cy, -z + cz));
}
}
}

View File

@ -0,0 +1,60 @@
/*
* 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.mantle.components;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.IrisMantleComponent;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisFluidBodies;
import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.mantle.MantleFlag;
import com.volmit.iris.util.math.RNG;
import java.util.function.Consumer;
public class MantleFluidBodyComponent extends IrisMantleComponent {
public MantleFluidBodyComponent(EngineMantle engineMantle) {
super(engineMantle, MantleFlag.FLUID_BODIES);
}
@Override
public void generateLayer(MantleWriter writer, int x, int z, Consumer<Runnable> post) {
RNG rng = new RNG(Cache.key(x, z) + seed() + 405666);
int xxx = 8 + (x << 4);
int zzz = 8 + (z << 4);
IrisRegion region = getComplex().getRegionStream().get(xxx, zzz);
IrisBiome biome = getComplex().getTrueBiomeStreamNoFeatures().get(xxx, zzz);
generate(writer, rng, x, z, region, biome);
}
@ChunkCoordinates
private void generate(MantleWriter writer, RNG rng, int cx, int cz, IrisRegion region, IrisBiome biome) {
generate(getDimension().getFluidBodies(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
generate(biome.getFluidBodies(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
generate(region.getFluidBodies(), writer, new RNG((rng.nextLong() * cx) + 490495 + cz), cx, cz);
}
@ChunkCoordinates
private void generate(IrisFluidBodies bodies, MantleWriter writer, RNG rng, int cx, int cz) {
bodies.generate(writer, rng, getEngineMantle().getEngine(), cx << 4, -1, cz << 4);
}
}

View File

@ -103,10 +103,9 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
if (c.isWater()) {
output.set(rx, yy, rz, WATER);
} else if(c.isLava()) {
} else if (c.isLava()) {
output.set(rx, yy, rz, LAVA);
}
else {
} else {
output.set(rx, yy, rz, AIR);
}
};
@ -171,13 +170,11 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
int thickness = zone.airThickness();
String customBiome = "";
if(B.isDecorant(output.get(rx, zone.ceiling+1, rz)))
{
output.set(rx, zone.ceiling+1, rz, AIR);
if (B.isDecorant(output.get(rx, zone.ceiling + 1, rz))) {
output.set(rx, zone.ceiling + 1, rz, AIR);
}
if(B.isDecorant(output.get(rx, zone.ceiling, rz)))
{
if (B.isDecorant(output.get(rx, zone.ceiling, rz))) {
output.set(rx, zone.ceiling, rz, AIR);
}

View File

@ -121,8 +121,7 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
continue;
}
if(!getEngine().getMantle().isCarved((cx << 4) + nx, ny, (cz << 4) + nz))
{
if (!getEngine().getMantle().isCarved((cx << 4) + nx, ny, (cz << 4) + nz)) {
data.set(nx, ny, nz, B.toDeepSlateOre(data.get(nx, ny, nz), clump.getBlocks().get(j)));
}
}

View File

@ -103,6 +103,9 @@ public class IrisBiome extends IrisRegistrant implements IRare {
@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)")

View File

@ -111,6 +111,10 @@ public class IrisCarving {
max = Math.max(max, i.getSize(data));
}
for (IrisRavinePlacer i : ravines) {
max = Math.max(max, i.getSize(data));
}
if (elipsoids.isNotEmpty()) {
max = (int) Math.max(elipsoids.stream().mapToDouble(IrisElipsoid::maxSize).max().getAsDouble(), max);
}

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.framework.Engine;
@ -44,7 +43,7 @@ import lombok.experimental.Accessors;
@Data
public class IrisCave extends IrisRegistrant {
@Desc("Define the shape of this cave")
private IrisWorm worm;
private IrisWorm worm = new IrisWorm();
@Desc("Define potential forking features")
private IrisCarving fork = new IrisCarving();
@ -73,7 +72,8 @@ public class IrisCave extends IrisRegistrant {
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int waterHint) {
double girth = getWorm().getGirth().get(rng, x, z, engine.getData());
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, (at) -> {});
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, (at) -> {
});
int highestWater = Math.max(waterHint, -1);
if (highestWater == -1) {

View File

@ -165,6 +165,9 @@ public class IrisDimension extends IrisRegistrant {
@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;
@ -284,7 +287,7 @@ public class IrisDimension extends IrisRegistrant {
int jump = strongholdJumpDistance;
RNG rng = new RNG((seed * 223) + 12945);
for (int i = 0; i < maxStrongholds+1; i++) {
for (int i = 0; i < maxStrongholds + 1; i++) {
int m = i + 1;
pos.add(new Position2(
(int) ((rng.i(jump * i) + (jump * i)) * (rng.b() ? -1D : 1D)),

View File

@ -0,0 +1,80 @@
/*
* 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.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("fluid-bodies")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents a fluid body configuration")
@Data
public class IrisFluidBodies {
@ArrayType(type = IrisRiver.class, min = 1)
@Desc("Define rivers")
private KList<IrisRiver> rivers = new KList<>();
@ArrayType(type = IrisLake.class, min = 1)
@Desc("Define lakes")
private KList<IrisLake> lakes = new KList<>();
@BlockCoordinates
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
//TODO: Impl
// if (rivers.isNotEmpty()) {
// for (IrisRiver i : rivers) {
// i.generate(writer, rng, engine, x, y, z);
// }
// }
//
// if (lakes.isNotEmpty()) {
// for (IrisLake i : lakes) {
// i.generate(writer, rng, engine, x, y, z);
// }
// }
}
public int getMaxRange(IrisData data) {
int max = 0;
for (IrisRiver i : rivers) {
max = Math.max(max, i.getSize(data));
}
for (IrisLake i : lakes) {
max = Math.max(max, i.getSize(data));
}
return max;
}
}

View File

@ -0,0 +1,107 @@
/*
* 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.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterFluidBody;
import com.volmit.iris.util.matter.slices.FluidBodyMatter;
import com.volmit.iris.util.noise.CNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("lake")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents an Iris Lake")
@Data
public class IrisLake implements IRare {
@Required
@Desc("Typically a 1 in RARITY on a per chunk/fork basis")
@MinNumber(1)
private int rarity = 15;
@Desc("The width style of this lake")
private IrisShapedGeneratorStyle widthStyle = new IrisShapedGeneratorStyle(NoiseStyle.PERLIN.style(), 5, 9);
@Desc("The depth style of this lake")
private IrisShapedGeneratorStyle depthStyle = new IrisShapedGeneratorStyle(NoiseStyle.PERLIN.style(), 4, 7);
@Desc("Define the shape of this lake")
private IrisWorm worm = new IrisWorm();
@RegistryListResource(IrisBiome.class)
@Desc("Force this lake to only generate the specified custom biome")
private String customBiome = "";
public int getSize(IrisData data) {
return worm.getMaxDistance();
}
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {
});
CNG dg = depthStyle.getGenerator().createNoCache(rng, engine.getData());
CNG bw = widthStyle.getGenerator().createNoCache(rng, engine.getData());
IrisPosition avg;
double ax = 0;
double ay = 0;
double az = 0;
double[] surfaces = new double[pos.size()];
int i = 0;
for (IrisPosition p : pos) {
surfaces[i] = engine.getComplex().getHeightStream().get(x, z);
ax += p.getX();
ay += surfaces[i];
az += p.getZ();
i++;
}
avg = new IrisPosition(ax / pos.size(), ay / pos.size(), az / pos.size());
MatterFluidBody body = FluidBodyMatter.get(customBiome, false);
i = 0;
for (IrisPosition p : pos) {
double surface = surfaces[i];
double depth = dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ()) + (surface - avg.getY());
double width = bw.fitDouble(widthStyle.getMin(), widthStyle.getMax(), p.getX(), p.getZ());
if (depth > 1) {
writer.setElipsoidFunction(p.getX(), avg.getY(), p.getZ(), width, depth, width, true, (xx, yy, zz) -> {
if (yy > avg.getY()) {
return null;
}
return body;
});
}
i++;
}
}
}

View File

@ -18,7 +18,6 @@
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.framework.Engine;
@ -47,7 +46,7 @@ import lombok.experimental.Accessors;
@Data
public class IrisRavine extends IrisRegistrant {
@Desc("Define the shape of this ravine (2d, ignores Y)")
private IrisWorm worm;
private IrisWorm worm = new IrisWorm();
@RegistryListResource(IrisBiome.class)
@Desc("Force this cave to only generate the specified custom biome")
@ -150,13 +149,9 @@ public class IrisRavine extends IrisRegistrant {
break;
}
if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
{
if (lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid())) {
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
}
else
{
} else {
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
}
}
@ -174,13 +169,9 @@ public class IrisRavine extends IrisRegistrant {
break;
}
if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
{
if (lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid())) {
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
}
else
{
} else {
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
}
}

View File

@ -131,6 +131,9 @@ public class IrisRegion extends IrisRegistrant implements IRare {
@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();
@RegistryListResource(IrisBiome.class)
@Required
@ArrayType(min = 1, type = String.class)

View File

@ -0,0 +1,59 @@
/*
* 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.object;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.MantleWriter;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("river")
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents an Iris river")
@Data
public class IrisRiver implements IRare {
@Required
@Desc("Typically a 1 in RARITY on a per chunk/fork basis")
@MinNumber(1)
private int rarity = 15;
@Desc("The width style of this river")
private IrisStyledRange width = new IrisStyledRange(3, 6, NoiseStyle.PERLIN.style());
@Desc("Define the shape of this river")
private IrisWorm worm = new IrisWorm();
@RegistryListResource(IrisBiome.class)
@Desc("Force this river to only generate the specified custom biome")
private String customBiome = "";
public int getSize(IrisData data) {
return worm.getMaxDistance();
}
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
}
}

View File

@ -104,8 +104,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
}
} : null;
if(studio)
{
if (studio) {
hotloader.setPriority(Thread.MIN_PRIORITY);
hotloader.start();
hotloader.setName(getTarget().getWorld().name() + " Hotloader");
@ -236,8 +235,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Override
public void close() {
withExclusiveControl(() -> {
if(isStudio())
{
if (isStudio()) {
hotloader.interrupt();
}
@ -252,8 +250,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Override
public void hotload() {
if(!isStudio())
{
if (!isStudio()) {
return;
}

View File

@ -23,7 +23,6 @@ import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.scheduling.ChronoLatch;
import it.unimi.dsi.fastutil.ints.*;
import net.minecraft.world.level.levelgen.OreVeinifier;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
@ -269,18 +268,12 @@ public class B {
public static BlockData toDeepSlateOre(BlockData block, BlockData ore) {
int key = ore.getMaterial().ordinal();
if(isDeepSlate(block))
{
if(normal2DeepslateCache.containsKey(key))
{
if (isDeepSlate(block)) {
if (normal2DeepslateCache.containsKey(key)) {
return Material.values()[normal2DeepslateCache.get(key)].createBlockData();
}
}
else
{
if(deepslate2NormalCache.containsKey(key))
{
} else {
if (deepslate2NormalCache.containsKey(key)) {
return Material.values()[deepslate2NormalCache.get(key)].createBlockData();
}
}

View File

@ -0,0 +1,91 @@
/*
* 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.util.decree.handlers;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.decree.DecreeParameterHandler;
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
import java.io.File;
import java.util.stream.Collectors;
public class JigsawPieceHandler implements DecreeParameterHandler<IrisJigsawPiece> {
@Override
public KList<IrisJigsawPiece> getPossibilities() {
KMap<String, IrisJigsawPiece> p = new KMap<>();
//noinspection ConstantConditions
for (File i : Iris.instance.getDataFolder("packs").listFiles()) {
if (i.isDirectory()) {
IrisData data = IrisData.get(i);
for (IrisJigsawPiece j : data.getJigsawPieceLoader().loadAll(data.getJigsawPieceLoader().getPossibleKeys())) {
p.putIfAbsent(j.getLoadKey(), j);
}
data.close();
}
}
return p.v();
}
@Override
public String toString(IrisJigsawPiece dim) {
return dim.getLoadKey();
}
@Override
public IrisJigsawPiece parse(String in, boolean force) throws DecreeParsingException, DecreeWhichException {
if (in.equals("null")) {
return null;
}
KList<IrisJigsawPiece> options = getPossibilities(in);
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Jigsaw Piece \"" + in + "\"");
} else if (options.size() > 1) {
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Jigsaw Piece \"" + in + "\"");
}
} else {
throw new DecreeWhichException();
}
}
return options.get(0);
}
@Override
public boolean supports(Class<?> type) {
return type.equals(IrisJigsawPiece.class);
}
@Override
public String getRandomDefault() {
return "jigsaw-piece";
}
}

View File

@ -0,0 +1,91 @@
/*
* 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.util.decree.handlers;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisJigsawStructure;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.decree.DecreeParameterHandler;
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
import java.io.File;
import java.util.stream.Collectors;
public class JigsawStructureHandler implements DecreeParameterHandler<IrisJigsawStructure> {
@Override
public KList<IrisJigsawStructure> getPossibilities() {
KMap<String, IrisJigsawStructure> p = new KMap<>();
//noinspection ConstantConditions
for (File i : Iris.instance.getDataFolder("packs").listFiles()) {
if (i.isDirectory()) {
IrisData data = IrisData.get(i);
for (IrisJigsawStructure j : data.getJigsawStructureLoader().loadAll(data.getJigsawStructureLoader().getPossibleKeys())) {
p.putIfAbsent(j.getLoadKey(), j);
}
data.close();
}
}
return p.v();
}
@Override
public String toString(IrisJigsawStructure dim) {
return dim.getLoadKey();
}
@Override
public IrisJigsawStructure parse(String in, boolean force) throws DecreeParsingException, DecreeWhichException {
if (in.equals("null")) {
return null;
}
KList<IrisJigsawStructure> options = getPossibilities(in);
if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Jigsaw Structure \"" + in + "\"");
} else if (options.size() > 1) {
if (force) {
try {
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} catch (Throwable e) {
throw new DecreeParsingException("Unable to filter which Jigsaw Structure \"" + in + "\"");
}
} else {
throw new DecreeWhichException();
}
}
return options.get(0);
}
@Override
public boolean supports(Class<?> type) {
return type.equals(IrisJigsawStructure.class);
}
@Override
public String getRandomDefault() {
return "jigsaw-structure";
}
}

View File

@ -483,6 +483,7 @@ public class VirtualDecreeCommand {
vm++;
}
DecreeContext.touch(sender);
Runnable rx = () -> {
try {
DecreeContext.touch(sender);

View File

@ -27,7 +27,8 @@ public enum MantleFlag {
FEATURE,
INITIAL_SPAWNED,
REAL,
CARVED;
CARVED,
FLUID_BODIES;
static StateList getStateList() {
return new StateList(MantleFlag.values());

View File

@ -28,18 +28,15 @@ public class MatterCavern {
private final String customBiome;
private final byte liquid; // 0 none 1 water 2 lava
public boolean isAir()
{
public boolean isAir() {
return liquid == 0;
}
public boolean isWater()
{
public boolean isWater() {
return liquid == 1;
}
public boolean isLava()
{
public boolean isLava() {
return liquid == 2;
}
}

View File

@ -0,0 +1,30 @@
/*
* 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.util.matter;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class MatterFluidBody {
private final boolean body;
private final String customBiome;
private final boolean lava;
}

View File

@ -0,0 +1,57 @@
/*
* 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.util.matter.slices;
import com.volmit.iris.util.matter.MatterFluidBody;
import com.volmit.iris.util.matter.Sliced;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
@Sliced
public class FluidBodyMatter extends RawMatter<MatterFluidBody> {
public static MatterFluidBody get(String customBiome, boolean lava) {
return new MatterFluidBody(true, customBiome, lava);
}
public FluidBodyMatter() {
this(1, 1, 1);
}
public FluidBodyMatter(int width, int height, int depth) {
super(width, height, depth, MatterFluidBody.class);
}
@Override
public void writeNode(MatterFluidBody b, DataOutputStream dos) throws IOException {
dos.writeBoolean(b.isBody());
dos.writeBoolean(b.isLava());
dos.writeUTF(b.getCustomBiome());
}
@Override
public MatterFluidBody readNode(DataInputStream din) throws IOException {
boolean b = din.readBoolean();
boolean l = din.readBoolean();
String v = din.readUTF();
return new MatterFluidBody(b, v, l);
}
}

View File

@ -18,6 +18,7 @@
package com.volmit.iris.util.scheduling.jobs;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.J;
@ -66,7 +67,7 @@ public interface Job {
}, sender.isPlayer() ? 0 : 20);
f.whenComplete((fs, ff) -> {
J.car(c);
sender.sendMessage("Completed " + getName() + " in " + Form.duration(p.getMilliseconds(), 1));
sender.sendMessage(C.AQUA + "Completed " + getName() + " in " + Form.duration(p.getMilliseconds(), 1));
whenComplete.run();
});
}