9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-22 16:49:14 +00:00
This commit is contained in:
DanLT
2021-09-01 10:27:49 -08:00
parent 44c807aedd
commit d763967d4b
61 changed files with 208 additions and 553 deletions

View File

@@ -26,11 +26,7 @@ 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.IrisBiome; import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.IrisBiomeCustom;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisCompat;
import com.volmit.iris.engine.object.IrisDimension;
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;
@@ -281,8 +277,7 @@ public class Iris extends VolmitPlugin implements Listener {
if (j.getName().endsWith(".json")) { if (j.getName().endsWith(".json")) {
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]); IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
if(dim == null) if (dim == null) {
{
continue; continue;
} }
@@ -381,8 +376,7 @@ public class Iris extends VolmitPlugin implements Listener {
if (j.getName().endsWith(".json")) { if (j.getName().endsWith(".json")) {
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]); IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
if(dim == null) if (dim == null) {
{
Iris.error("Failed to load " + j.getPath()); Iris.error("Failed to load " + j.getPath());
continue; continue;
} }

View File

@@ -5,13 +5,7 @@ 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.IObjectPlacer; import com.volmit.iris.engine.object.*;
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;

View File

@@ -29,22 +29,7 @@ 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.IrisPosition; 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.IrisScript;
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.IrisLootTable;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisGenerator;
import com.volmit.iris.engine.object.IrisInterpolator;
import com.volmit.iris.engine.object.IrisNoiseGenerator;
import com.volmit.iris.engine.object.NoiseStyle;
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.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;

View File

@@ -134,10 +134,8 @@ public class CommandWhat implements DecreeExecutor {
int m = 1; int m = 1;
AtomicInteger v = new AtomicInteger(0); AtomicInteger v = new AtomicInteger(0);
for(int xxx = c.getX() - 4; xxx <= c.getX() + 4; xxx++) for (int xxx = c.getX() - 4; xxx <= c.getX() + 4; xxx++) {
{ for (int zzz = c.getZ() - 4; zzz <= c.getZ() + 4; zzz++) {
for(int zzz = c.getZ() - 4; zzz <= c.getZ() + 4; zzz++)
{
IrisToolbelt.access(c.getWorld()).getEngine().getMantle().findMarkers(xxx, zzz, new MatterMarker(marker)) IrisToolbelt.access(c.getWorld()).getEngine().getMantle().findMarkers(xxx, zzz, new MatterMarker(marker))
.convert((i) -> i.toLocation(c.getWorld())).forEach((i) -> { .convert((i) -> i.toLocation(c.getWorld())).forEach((i) -> {
J.s(() -> BlockSignal.of(i.getBlock(), 100)); J.s(() -> BlockSignal.of(i.getBlock(), 100));

View File

@@ -33,6 +33,7 @@ import java.util.concurrent.atomic.AtomicInteger;
@SuppressWarnings("InstantiationOfUtilityClass") @SuppressWarnings("InstantiationOfUtilityClass")
public class BlockSignal { public class BlockSignal {
public static final AtomicInteger active = new AtomicInteger(0); public static final AtomicInteger active = new AtomicInteger(0);
public static void of(Block block, int ticks) { public static void of(Block block, int ticks) {
new BlockSignal(block, ticks); new BlockSignal(block, ticks);
} }

View File

@@ -32,8 +32,6 @@ import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import java.util.concurrent.atomic.AtomicInteger;
@SuppressWarnings("ALL") @SuppressWarnings("ALL")
@Data @Data
public class DustRevealer { public class DustRevealer {
@@ -70,13 +68,11 @@ public class DustRevealer {
J.s(() -> { J.s(() -> {
new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 7); new BlockSignal(world.getBlockAt(block.getX(), block.getY(), block.getZ()), 7);
if(M.r(0.25)) if (M.r(0.25)) {
{
world.playSound(block.toBlock(world).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, RNG.r.f(0.2f, 2f)); world.playSound(block.toBlock(world).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 1f, RNG.r.f(0.2f, 2f));
} }
J.a(() -> { J.a(() -> {
while(BlockSignal.active.get() > 128) while (BlockSignal.active.get() > 128) {
{
J.sleep(5); J.sleep(5);
} }
@@ -112,7 +108,7 @@ public class DustRevealer {
e.printStackTrace(); e.printStackTrace();
} }
}); });
}, RNG.r.i(2,8)); }, RNG.r.i(2, 8));
} }
private boolean is(BlockPosition a) { private boolean is(BlockPosition a) {

View File

@@ -21,11 +21,7 @@ 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.IrisPosition; import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.IrisJigsawPiece;
import com.volmit.iris.engine.object.IrisJigsawPieceConnector;
import com.volmit.iris.engine.object.IrisDirection;
import com.volmit.iris.engine.object.IrisObject;
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;

View File

@@ -25,8 +25,8 @@ import com.volmit.iris.core.tools.IrisToolbelt;
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.object.IrisBiome; import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisRegion; import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.engine.object.IrisWorld;
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;

View File

@@ -26,24 +26,8 @@ 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.annotations.Snippet; import com.volmit.iris.engine.object.annotations.Snippet;
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.IrisRavine;
import com.volmit.iris.engine.object.IrisScript;
import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisEntity;
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.IrisExpression;
import com.volmit.iris.engine.object.IrisGenerator;
import com.volmit.iris.engine.object.IrisObject;
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.context.IrisContext; import com.volmit.iris.util.context.IrisContext;
@@ -56,7 +40,6 @@ import lombok.Data;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Objects; import java.util.Objects;
import java.util.function.Function; import java.util.function.Function;
@@ -372,13 +355,9 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
@Override @Override
public boolean shouldSkipClass(Class<?> c) { public boolean shouldSkipClass(Class<?> c) {
if(c.equals(AtomicCache.class)) if (c.equals(AtomicCache.class)) {
{
return true; return true;
} } else if (c.equals(ChronoLatch.class)) {
else if(c.equals(ChronoLatch.class))
{
return true; return true;
} }
@@ -387,8 +366,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
@Override @Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) { public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> typeToken) {
if(!typeToken.getRawType().isAnnotationPresent(Snippet.class)) if (!typeToken.getRawType().isAnnotationPresent(Snippet.class)) {
{
return null; return null;
} }
@@ -407,26 +385,17 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
if (reader.peek().equals(JsonToken.STRING)) { if (reader.peek().equals(JsonToken.STRING)) {
String r = reader.nextString(); String r = reader.nextString();
if(r.startsWith("snippet/" + snippetType + "/")) if (r.startsWith("snippet/" + snippetType + "/")) {
{
File f = new File(getDataFolder(), r + ".json"); File f = new File(getDataFolder(), r + ".json");
if(f.exists()) if (f.exists()) {
{ try {
try
{
JsonReader snippetReader = new JsonReader(new FileReader(f)); JsonReader snippetReader = new JsonReader(new FileReader(f));
return adapter.read(snippetReader); return adapter.read(snippetReader);
} } catch (Throwable e) {
catch(Throwable e)
{
Iris.error("Couldn't read snippet " + r + " in " + reader.getPath() + " (" + e.getMessage() + ")"); Iris.error("Couldn't read snippet " + r + " in " + reader.getPath() + " (" + e.getMessage() + ")");
} }
} } else {
else
{
Iris.error("Couldn't find snippet " + r + " in " + reader.getPath()); Iris.error("Couldn't find snippet " + r + " in " + reader.getPath());
} }
} }
@@ -434,13 +403,9 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
return null; return null;
} }
try try {
{
return adapter.read(reader); return adapter.read(reader);
} } catch (Throwable e) {
catch(Throwable e)
{
Iris.error("Failed to read " + typeToken.getRawType().getCanonicalName() + "... faking objects a little to load the file at least."); Iris.error("Failed to read " + typeToken.getRawType().getCanonicalName() + "... faking objects a little to load the file at least.");
try { try {
return (T) typeToken.getRawType().getConstructor().newInstance(); return (T) typeToken.getRawType().getConstructor().newInstance();
@@ -459,10 +424,8 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
File snippetFolder = new File(getDataFolder(), "snippet/" + f); File snippetFolder = new File(getDataFolder(), "snippet/" + f);
if(snippetFolder.exists() && snippetFolder.isDirectory()) if (snippetFolder.exists() && snippetFolder.isDirectory()) {
{ for (File i : snippetFolder.listFiles()) {
for(File i : snippetFolder.listFiles())
{
l.add("snippet/" + f + "/" + i.getName().split("\\Q.\\E")[0]); l.add("snippet/" + f + "/" + i.getName().split("\\Q.\\E")[0]);
} }
} }

View File

@@ -20,10 +20,10 @@ package com.volmit.iris.core.loader;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.engine.object.IrisScript;
import com.volmit.iris.engine.object.annotations.ArrayType; import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc; import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListResource; import com.volmit.iris.engine.object.annotations.RegistryListResource;
import com.volmit.iris.engine.object.IrisScript;
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;
@@ -49,8 +49,7 @@ public abstract class IrisRegistrant {
public abstract String getTypeName(); public abstract String getTypeName();
public void registerTypeAdapters(GsonBuilder builder) public void registerTypeAdapters(GsonBuilder builder) {
{
} }

View File

@@ -19,13 +19,8 @@
package com.volmit.iris.core.loader; package com.volmit.iris.core.loader;
import com.google.common.util.concurrent.AtomicDouble; import com.google.common.util.concurrent.AtomicDouble;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.project.SchemaBuilder; import com.volmit.iris.core.project.SchemaBuilder;
import com.volmit.iris.engine.data.cache.AtomicCache;
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;
@@ -41,7 +36,6 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import lombok.Data; import lombok.Data;
import java.io.File; import java.io.File;
import java.lang.reflect.Field;
import java.util.Locale; import java.util.Locale;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Predicate; import java.util.function.Predicate;

View File

@@ -22,8 +22,8 @@ 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.ResourceLoader; import com.volmit.iris.core.loader.ResourceLoader;
import com.volmit.iris.core.service.StudioSVC; import com.volmit.iris.core.service.StudioSVC;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.exceptions.IrisException; import com.volmit.iris.util.exceptions.IrisException;
import com.volmit.iris.util.format.Form; import com.volmit.iris.util.format.Form;

View File

@@ -25,16 +25,7 @@ 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.IrisBiome; import com.volmit.iris.engine.object.*;
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.IrisLootTable;
import com.volmit.iris.engine.object.IrisGenerator;
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;
@@ -276,10 +267,8 @@ public class IrisProject {
} }
} }
for(Class<?> i : Iris.getClasses("com.volmit.iris.engine.object.", Snippet.class)) for (Class<?> i : Iris.getClasses("com.volmit.iris.engine.object.", Snippet.class)) {
{ try {
try
{
String snipType = i.getDeclaredAnnotation(Snippet.class).value(); String snipType = i.getDeclaredAnnotation(Snippet.class).value();
JSONObject o = new JSONObject(); JSONObject o = new JSONObject();
KList<String> fm = new KList<>(); KList<String> fm = new KList<>();
@@ -293,20 +282,13 @@ public class IrisProject {
schemas.put(o); schemas.put(o);
File a = new File(dm.getDataFolder(), ".iris/schema/snippet/" + snipType + "-schema.json"); File a = new File(dm.getDataFolder(), ".iris/schema/snippet/" + snipType + "-schema.json");
J.attemptAsync(() -> { J.attemptAsync(() -> {
try try {
{
IO.writeAll(a, new SchemaBuilder(i, dm).compute().toString(4)); IO.writeAll(a, new SchemaBuilder(i, dm).compute().toString(4));
} } catch (Throwable e) {
catch(Throwable e)
{
e.printStackTrace(); e.printStackTrace();
} }
}); });
} } catch (Throwable e) {
catch(Throwable e)
{
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@@ -131,8 +131,7 @@ public class SchemaBuilder {
o.put("properties", properties); o.put("properties", properties);
if(c.isAnnotationPresent(Snippet.class)) if (c.isAnnotationPresent(Snippet.class)) {
{
JSONObject anyOf = new JSONObject(); JSONObject anyOf = new JSONObject();
JSONArray arr = new JSONArray(); JSONArray arr = new JSONArray();
JSONObject str = new JSONObject(); JSONObject str = new JSONObject();
@@ -533,8 +532,7 @@ public class SchemaBuilder {
d.add(fancyType); d.add(fancyType);
d.add(getDescription(k.getType())); d.add(getDescription(k.getType()));
if(k.getType().isAnnotationPresent(Snippet.class)) if (k.getType().isAnnotationPresent(Snippet.class)) {
{
String sm = k.getType().getDeclaredAnnotation(Snippet.class).value(); String sm = k.getType().getDeclaredAnnotation(Snippet.class).value();
d.add(" "); d.add(" ");
d.add("You can instead specify \"snippet/" + sm + "/some-name.json\" to use a snippet file instead of specifying it here."); d.add("You can instead specify \"snippet/" + sm + "/some-name.json\" to use a snippet file instead of specifying it here.");
@@ -556,7 +554,7 @@ public class SchemaBuilder {
d.add("* Default Value is " + value); d.add("* Default Value is " + value);
} }
} }
} catch (Throwable ignored) { } catch (Throwable ignored) {
} }
@@ -564,14 +562,13 @@ public class SchemaBuilder {
prop.put("type", type); prop.put("type", type);
prop.put("description", d.toString("\n")); prop.put("description", d.toString("\n"));
if(k.getType().isAnnotationPresent(Snippet.class)) if (k.getType().isAnnotationPresent(Snippet.class)) {
{
JSONObject anyOf = new JSONObject(); JSONObject anyOf = new JSONObject();
JSONArray arr = new JSONArray(); JSONArray arr = new JSONArray();
JSONObject str = new JSONObject(); JSONObject str = new JSONObject();
str.put("type", "string"); str.put("type", "string");
String key = "enum-snippet-" + k.getType().getDeclaredAnnotation(Snippet.class).value(); String key = "enum-snippet-" + k.getType().getDeclaredAnnotation(Snippet.class).value();
str.put("$ref", "#/definitions/"+key); str.put("$ref", "#/definitions/" + key);
if (!definitions.containsKey(key)) { if (!definitions.containsKey(key)) {
JSONObject j = new JSONObject(); JSONObject j = new JSONObject();

View File

@@ -152,8 +152,7 @@ public class BoardSVC implements IrisService, BoardProvider {
v.add(C.LIGHT_PURPLE + "Tasks" + C.GRAY + ": " + Form.f(Iris.jobCount())); v.add(C.LIGHT_PURPLE + "Tasks" + C.GRAY + ": " + Form.f(Iris.jobCount()));
} }
if(engine.getBlockUpdatesPerSecond() > 0) if (engine.getBlockUpdatesPerSecond() > 0) {
{
v.add("&7&m------------------"); v.add("&7&m------------------");
v.add(C.LIGHT_PURPLE + "BUD/s" + C.GRAY + ": " + Form.f(engine.getBlockUpdatesPerSecond())); v.add(C.LIGHT_PURPLE + "BUD/s" + C.GRAY + ": " + Form.f(engine.getBlockUpdatesPerSecond()));
} }

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.core.service; package com.volmit.iris.core.service;
import com.volmit.iris.Iris; import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.core.commands.CommandIris; import com.volmit.iris.core.commands.CommandIris;
import com.volmit.iris.engine.data.cache.AtomicCache; import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.collection.KMap;
@@ -47,17 +46,14 @@ public class CommandSVC implements IrisService, DecreeSystem {
} }
@EventHandler @EventHandler
public void on(PlayerCommandPreprocessEvent e) public void on(PlayerCommandPreprocessEvent e) {
{
String msg = e.getMessage().startsWith("/") ? e.getMessage().substring(1) : e.getMessage(); String msg = e.getMessage().startsWith("/") ? e.getMessage().substring(1) : e.getMessage();
if(msg.startsWith("irisdecree ")) if (msg.startsWith("irisdecree ")) {
{
String[] args = msg.split("\\Q \\E"); String[] args = msg.split("\\Q \\E");
CompletableFuture<String> future = futures.get(args[1]); CompletableFuture<String> future = futures.get(args[1]);
if(future != null) if (future != null) {
{
future.complete(args[2]); future.complete(args[2]);
e.setCancelled(true); e.setCancelled(true);
} }

View File

@@ -20,12 +20,7 @@ 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.IrisPosition; import com.volmit.iris.engine.object.*;
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.IrisDirection;
import com.volmit.iris.engine.object.IrisObject;
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;

View File

@@ -21,14 +21,7 @@ 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.IrisBiome; import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.IObjectPlacer;
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.TileData;
import com.volmit.iris.engine.object.IrisTreeModes;
import com.volmit.iris.engine.object.IrisTreeSize;
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;

View File

@@ -19,8 +19,8 @@
package com.volmit.iris.core.tools; package com.volmit.iris.core.tools;
import com.volmit.iris.core.loader.IrisData; import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension; 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 org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;

View File

@@ -22,13 +22,7 @@ import com.google.common.util.concurrent.AtomicDouble;
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.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.InferredType; import com.volmit.iris.engine.object.*;
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;

View File

@@ -34,11 +34,7 @@ import com.volmit.iris.engine.mantle.EngineMantle;
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.IrisPostModifier; import com.volmit.iris.engine.modifier.IrisPostModifier;
import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.*;
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.KMap; import com.volmit.iris.util.collection.KMap;
@@ -136,8 +132,7 @@ public class IrisEngine implements Engine {
} }
private void tickRandomPlayer() { private void tickRandomPlayer() {
if(perSecondBudLatch.flip()) if (perSecondBudLatch.flip()) {
{
buds.set(bud.get()); buds.set(bud.get());
bud.set(0); bud.set(0);
} }

View File

@@ -25,7 +25,6 @@ import com.volmit.iris.engine.framework.EnginePlayer;
import com.volmit.iris.util.collection.KMap; import com.volmit.iris.util.collection.KMap;
import com.volmit.iris.util.math.M; import com.volmit.iris.util.math.M;
import com.volmit.iris.util.scheduling.PrecisionStopwatch; import com.volmit.iris.util.scheduling.PrecisionStopwatch;
import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import java.util.List; import java.util.List;

View File

@@ -27,14 +27,7 @@ import com.volmit.iris.engine.mantle.components.MantleCarvingComponent;
import com.volmit.iris.engine.mantle.components.MantleFeatureComponent; import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
import com.volmit.iris.engine.mantle.components.MantleJigsawComponent; import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
import com.volmit.iris.engine.mantle.components.MantleObjectComponent; import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.object.*;
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;

View File

@@ -22,15 +22,7 @@ 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.IrisBiome; import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.IrisBlockDrops;
import com.volmit.iris.engine.object.IRare;
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;
@@ -105,8 +97,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
interrupt(); interrupt();
} }
if(!getEngine().getWorld().hasRealWorld() && clw.flip()) if (!getEngine().getWorld().hasRealWorld() && clw.flip()) {
{
getEngine().getWorld().tryGetRealWorld(); getEngine().getWorld().tryGetRealWorld();
} }
@@ -227,8 +218,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
Chunk c = cc[RNG.r.nextInt(cc.length)]; Chunk c = cc[RNG.r.nextInt(cc.length)];
if(!c.isLoaded() || !Chunks.isSafe(c.getWorld(), c.getX(), c.getZ())) if (!c.isLoaded() || !Chunks.isSafe(c.getWorld(), c.getX(), c.getZ())) {
{
continue; continue;
} }

View File

@@ -26,18 +26,7 @@ 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.IrisColor; import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisWorld;
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.InventorySlotType;
import com.volmit.iris.engine.object.IrisObjectPlacement;
import com.volmit.iris.engine.object.IrisRegion;
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;

View File

@@ -33,13 +33,9 @@ public abstract class EngineAssignedModifier<T> extends EngineAssignedComponent
@BlockCoordinates @BlockCoordinates
@Override @Override
public void modify(int x, int z, Hunk<T> output, boolean multicore) { public void modify(int x, int z, Hunk<T> output, boolean multicore) {
try try {
{
onModify(x, z, output, multicore); onModify(x, z, output, multicore);
} } catch (Throwable e) {
catch(Throwable e)
{
Iris.error("Modifier Failure: " + getName()); Iris.error("Modifier Failure: " + getName());
e.printStackTrace(); e.printStackTrace();
} }

View File

@@ -19,8 +19,8 @@
package com.volmit.iris.engine.framework; package com.volmit.iris.engine.framework;
import com.volmit.iris.core.loader.IrisData; import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.util.parallel.MultiBurst; import com.volmit.iris.util.parallel.MultiBurst;
import lombok.Data; import lombok.Data;

View File

@@ -18,9 +18,9 @@
package com.volmit.iris.engine.framework; package com.volmit.iris.engine.framework;
import com.volmit.iris.engine.object.InventorySlotType;
import com.volmit.iris.engine.object.IrisLootReference; import com.volmit.iris.engine.object.IrisLootReference;
import com.volmit.iris.engine.object.IrisLootTable; import com.volmit.iris.engine.object.IrisLootTable;
import com.volmit.iris.engine.object.InventorySlotType;
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 org.bukkit.block.Block; import org.bukkit.block.Block;

View File

@@ -21,16 +21,7 @@ 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.IrisPosition; import com.volmit.iris.engine.object.*;
import com.volmit.iris.engine.object.IObjectPlacer;
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.InventorySlotType;
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.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;

View File

@@ -35,7 +35,6 @@ import com.volmit.iris.util.mantle.MantleFlag;
import com.volmit.iris.util.matter.Matter; import com.volmit.iris.util.matter.Matter;
import com.volmit.iris.util.matter.MatterCavern; import com.volmit.iris.util.matter.MatterCavern;
import com.volmit.iris.util.matter.MatterMarker; import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.matter.slices.MarkerMatter;
import com.volmit.iris.util.matter.slices.UpdateMatter; import com.volmit.iris.util.matter.slices.UpdateMatter;
import com.volmit.iris.util.parallel.BurstExecutor; import com.volmit.iris.util.parallel.BurstExecutor;
import com.volmit.iris.util.parallel.MultiBurst; import com.volmit.iris.util.parallel.MultiBurst;
@@ -65,12 +64,10 @@ public interface EngineMantle extends IObjectPlacer {
} }
@ChunkCoordinates @ChunkCoordinates
default KList<IrisPosition> findMarkers(int x, int z, MatterMarker marker) default KList<IrisPosition> findMarkers(int x, int z, MatterMarker marker) {
{
KList<IrisPosition> p = new KList<>(); KList<IrisPosition> p = new KList<>();
getMantle().iterateChunk(x, z, MatterMarker.class, (xx, yy, zz, mm) -> { getMantle().iterateChunk(x, z, MatterMarker.class, (xx, yy, zz, mm) -> {
if(marker.equals(mm)) if (marker.equals(mm)) {
{
p.add(new IrisPosition(xx + (x << 4), yy, zz + (z << 4))); p.add(new IrisPosition(xx + (x << 4), yy, zz + (z << 4)));
} }
}); });

View File

@@ -22,9 +22,9 @@ import com.google.common.collect.ImmutableList;
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.Cache; import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.object.IrisPosition;
import com.volmit.iris.engine.object.IObjectPlacer; import com.volmit.iris.engine.object.IObjectPlacer;
import com.volmit.iris.engine.object.IrisFeaturePositional; 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.engine.object.TileData;
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;
@@ -475,7 +475,7 @@ public class MantleWriter implements IObjectPlacer {
} }
} }
public <T> void setConsumer(Set<IrisPosition> positions, Function3<Integer,Integer,Integer,T> data) { public <T> void setConsumer(Set<IrisPosition> positions, Function3<Integer, Integer, Integer, T> data) {
for (IrisPosition i : positions) { for (IrisPosition i : positions) {
set(i, data.apply(i.getX(), i.getY(), i.getZ())); set(i, data.apply(i.getX(), i.getY(), i.getZ()));
} }

View File

@@ -22,13 +22,7 @@ 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.IrisPosition; 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.NoiseStyle;
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;

View File

@@ -23,13 +23,7 @@ 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.IrisBiome; import com.volmit.iris.engine.object.*;
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;

View File

@@ -23,11 +23,7 @@ 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.IrisPosition; 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.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;
@@ -65,8 +61,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
KMap<Long, KList<Integer>> positions = new KMap<>(); KMap<Long, KList<Integer>> positions = new KMap<>();
KMap<IrisPosition, MatterCavern> walls = new KMap<>(); KMap<IrisPosition, MatterCavern> walls = new KMap<>();
Consumer4<Integer, Integer, Integer, MatterCavern> iterator = (xx, yy, zz, c) -> { Consumer4<Integer, Integer, Integer, MatterCavern> iterator = (xx, yy, zz, c) -> {
if(c == null) if (c == null) {
{
return; return;
} }
@@ -105,14 +100,10 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
return; return;
} }
if(c.isWater()) if (c.isWater()) {
{ output.set(rx, yy, rz, WATER);
output.set(rx, yy, rz, WATER); } else {
} output.set(rx, yy, rz, AIR);
else
{
output.set(rx, yy, rz, AIR);
} }
}; };
@@ -169,20 +160,18 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
getEngine().getMetrics().getDeposit().put(p.getMilliseconds()); getEngine().getMetrics().getDeposit().put(p.getMilliseconds());
} }
private void processZone(Hunk<BlockData> output, MantleChunk mc, Mantle mantle, CaveZone zone, int rx, int rz, int xx, int zz) { private void processZone(Hunk<BlockData> output, MantleChunk mc, Mantle mantle, CaveZone zone, int rx, int rz, int xx, int zz) {
boolean decFloor = B.isSolid(output.get(rx, zone.floor - 1, rz)); boolean decFloor = B.isSolid(output.get(rx, zone.floor - 1, rz));
boolean decCeiling = B.isSolid(output.get(rx, zone.ceiling + 1, rz)); boolean decCeiling = B.isSolid(output.get(rx, zone.ceiling + 1, rz));
int center = (zone.floor + zone.ceiling) / 2; int center = (zone.floor + zone.ceiling) / 2;
int thickness = zone.airThickness(); int thickness = zone.airThickness();
String customBiome = ""; String customBiome = "";
if(M.r(1D/16D)) if (M.r(1D / 16D)) {
{
mantle.set(xx, zone.ceiling, zz, MarkerMatter.CAVE_CEILING); mantle.set(xx, zone.ceiling, zz, MarkerMatter.CAVE_CEILING);
} }
if(M.r(1D/16D)) if (M.r(1D / 16D)) {
{
mantle.set(xx, zone.floor, zz, MarkerMatter.CAVE_FLOOR); mantle.set(xx, zone.floor, zz, MarkerMatter.CAVE_FLOOR);
} }

View File

@@ -74,40 +74,34 @@ public class IrisCave extends IrisRegistrant {
double girth = getWorm().getGirth().get(rng, x, z, engine.getData()); double girth = getWorm().getGirth().get(rng, x, z, engine.getData());
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z,
(at) -> {}); (at) -> {
});
int highestWater = Math.max(waterHint, -1); int highestWater = Math.max(waterHint, -1);
boolean water = false; boolean water = false;
if(highestWater == -1) if (highestWater == -1) {
{ for (IrisPosition i : points) {
for(IrisPosition i : points)
{
double yy = i.getY() + girth; double yy = i.getY() + girth;
int th = engine.getHeight(x, z, true); int th = engine.getHeight(x, z, true);
if(yy > th && th < engine.getDimension().getFluidHeight()) if (yy > th && th < engine.getDimension().getFluidHeight()) {
{ highestWater = Math.max(highestWater, (int) yy);
highestWater = Math.max(highestWater, (int)yy);
water = true; water = true;
break; break;
} }
} }
} } else {
else
{
water = true; water = true;
} }
int h = Math.min(Math.max(highestWater, waterHint), engine.getDimension().getFluidHeight()); int h = Math.min(Math.max(highestWater, waterHint), engine.getDimension().getFluidHeight());
for(IrisPosition i : points) for (IrisPosition i : points) {
{
fork.doCarving(writer, rng, engine, i.getX(), i.getY(), i.getZ(), h); fork.doCarving(writer, rng, engine, i.getX(), i.getY(), i.getZ(), h);
} }
writer.setLineConsumer(points, writer.setLineConsumer(points,
girth, true, girth, true,
(xf, yf, zf) -> new MatterCavern(true, customBiome, yf <= h)); (xf, yf, zf) -> new MatterCavern(true, customBiome, yf <= h));
} }

View File

@@ -62,6 +62,7 @@ public class IrisCavePlacer implements IRare {
public IrisCave getRealCave(IrisData data) { public IrisCave getRealCave(IrisData data) {
return caveCache.aquire(() -> data.getCaveLoader().load(getCave())); return caveCache.aquire(() -> data.getCaveLoader().load(getCave()));
} }
public void generateCave(MantleWriter mantle, RNG rng, Engine engine, int x, int y, int z) { public void generateCave(MantleWriter mantle, RNG rng, Engine engine, int x, int y, int z) {
generateCave(mantle, rng, engine, x, y, z, -1); generateCave(mantle, rng, engine, x, y, z, -1);
} }
@@ -101,8 +102,7 @@ public class IrisCavePlacer implements IRare {
public int getSize(IrisData data) { public int getSize(IrisData data) {
IrisCave cave = getRealCave(data); IrisCave cave = getRealCave(data);
if(cave != null) if (cave != null) {
{
return cave.getMaxSize(data); return cave.getMaxSize(data);
} }

View File

@@ -19,7 +19,6 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.object.IrisRate;
import com.volmit.iris.util.math.M; import com.volmit.iris.util.math.M;
import lombok.Data; import lombok.Data;

View File

@@ -166,8 +166,7 @@ public class IrisEntity extends IrisRegistrant {
} }
public Entity spawn(Engine gen, Location at, RNG rng) { public Entity spawn(Engine gen, Location at, RNG rng) {
if(!Chunks.isSafe(at)) if (!Chunks.isSafe(at)) {
{
return null; return null;
} }
@@ -180,8 +179,7 @@ public class IrisEntity extends IrisRegistrant {
Entity ee = doSpawn(at); Entity ee = doSpawn(at);
if(ee == null && !Chunks.isSafe(at)) if (ee == null && !Chunks.isSafe(at)) {
{
return null; return null;
} }
@@ -345,8 +343,7 @@ public class IrisEntity extends IrisRegistrant {
AtomicInteger t = new AtomicInteger(0); AtomicInteger t = new AtomicInteger(0);
AtomicInteger v = new AtomicInteger(0); AtomicInteger v = new AtomicInteger(0);
v.set(J.sr(() -> { v.set(J.sr(() -> {
if(t.get() > 100) if (t.get() > 100) {
{
J.csr(v.get()); J.csr(v.get());
return; return;
} }
@@ -389,8 +386,7 @@ public class IrisEntity extends IrisRegistrant {
} }
private Entity doSpawn(Location at) { private Entity doSpawn(Location at) {
if(!Chunks.isSafe(at)) if (!Chunks.isSafe(at)) {
{
return null; return null;
} }

View File

@@ -19,14 +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.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.*;
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.math.RNG; import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterMarker;
import com.volmit.iris.util.matter.slices.MarkerMatter; import com.volmit.iris.util.matter.slices.MarkerMatter;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@@ -19,7 +19,6 @@
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.*;
import com.volmit.iris.engine.object.IrisBiome;
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;

View File

@@ -21,8 +21,6 @@ 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.*;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisLootTable;
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;

View File

@@ -21,8 +21,6 @@ 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.*;
import com.volmit.iris.engine.object.IrisBlockData;
import com.volmit.iris.engine.object.IrisMaterialPalette;
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;

View File

@@ -88,70 +88,61 @@ public class IrisRavine extends IrisRegistrant {
public String getTypeName() { public String getTypeName() {
return "Ravine"; return "Ravine";
} }
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) {
generate(writer, rng, engine, x, y, z, -1); generate(writer, rng, engine, x, y, z, -1);
} }
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int waterHint) { public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int waterHint) {
KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {}); KList<IrisPosition> pos = getWorm().generate(rng, engine.getData(), writer, null, x, y, z, (at) -> {
});
CNG dg = depthStyle.getGenerator().createNoCache(rng, engine.getData()); CNG dg = depthStyle.getGenerator().createNoCache(rng, engine.getData());
CNG bw = baseWidthStyle.getGenerator().createNoCache(rng, engine.getData()); CNG bw = baseWidthStyle.getGenerator().createNoCache(rng, engine.getData());
int highestWater = Math.max(waterHint, -1); int highestWater = Math.max(waterHint, -1);
boolean water = false; boolean water = false;
if(highestWater == -1) if (highestWater == -1) {
{ for (IrisPosition i : pos) {
for(IrisPosition i : pos)
{
int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y; int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y;
int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), i.getX(), i.getZ())); int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), i.getX(), i.getZ()));
int surface = (int) Math.round(rsurface - depth * 0.45); int surface = (int) Math.round(rsurface - depth * 0.45);
int yy = surface + depth; int yy = surface + depth;
int th = engine.getHeight(x, z, true); int th = engine.getHeight(x, z, true);
if(yy > th && th < engine.getDimension().getFluidHeight()) if (yy > th && th < engine.getDimension().getFluidHeight()) {
{
highestWater = Math.max(highestWater, yy); highestWater = Math.max(highestWater, yy);
water = true; water = true;
break; break;
} }
} }
} } else {
else
{
water = true; water = true;
} }
MatterCavern c = new MatterCavern(true, customBiome, water); MatterCavern c = new MatterCavern(true, customBiome, water);
if(pos.size() < nodeThreshold) if (pos.size() < nodeThreshold) {
{
return; return;
} }
for(IrisPosition p : pos) for (IrisPosition p : pos) {
{
int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y; int rsurface = y == -1 ? engine.getComplex().getHeightStream().get(x, z).intValue() : y;
int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ())); int depth = (int) Math.round(dg.fitDouble(depthStyle.getMin(), depthStyle.getMax(), p.getX(), p.getZ()));
int width = (int) Math.round(bw.fitDouble(baseWidthStyle.getMin(), baseWidthStyle.getMax(), p.getX(), p.getZ())); int width = (int) Math.round(bw.fitDouble(baseWidthStyle.getMin(), baseWidthStyle.getMax(), p.getX(), p.getZ()));
int surface = (int) Math.round(rsurface - depth * 0.45); int surface = (int) Math.round(rsurface - depth * 0.45);
fork.doCarving(writer, rng, engine, p.getX(), rng.i(surface-depth, surface), p.getZ(), Math.max(highestWater, waterHint)); fork.doCarving(writer, rng, engine, p.getX(), rng.i(surface - depth, surface), p.getZ(), Math.max(highestWater, waterHint));
for(int i = surface + depth; i >= surface; i--) for (int i = surface + depth; i >= surface; i--) {
{ if (i % ribThickness == 0) {
if(i % ribThickness == 0) {
double v = width + ((((surface + depth) - i) * (angle / 360D))); double v = width + ((((surface + depth) - i) * (angle / 360D)));
if(v <= 0.25) if (v <= 0.25) {
{
break; break;
} }
if(i <= ribThickness+2) if (i <= ribThickness + 2) {
{
break; break;
} }
@@ -159,18 +150,15 @@ public class IrisRavine extends IrisRegistrant {
} }
} }
for(int i = surface - depth; i <= surface; i++) for (int i = surface - depth; i <= surface; i++) {
{ if (i % ribThickness == 0) {
if(i % ribThickness == 0) {
double v = width - ((((surface - depth) - i) * (angle / 360D))); double v = width - ((((surface - depth) - i) * (angle / 360D)));
if(v <= 0.25) if (v <= 0.25) {
{
break; break;
} }
if(i <= ribThickness+2) if (i <= ribThickness + 2) {
{
break; break;
} }

View File

@@ -21,7 +21,7 @@ package com.volmit.iris.engine.object.annotations;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.Target; import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.*; import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Retention(RUNTIME) @Retention(RUNTIME)

View File

@@ -26,8 +26,8 @@ import com.volmit.iris.engine.data.chunk.TerrainChunk;
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.framework.WrongEngineBroException; import com.volmit.iris.engine.framework.WrongEngineBroException;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.IrisDimension; import com.volmit.iris.engine.object.IrisDimension;
import com.volmit.iris.engine.object.IrisWorld;
import com.volmit.iris.engine.object.StudioMode; import com.volmit.iris.engine.object.StudioMode;
import com.volmit.iris.engine.platform.studio.StudioGenerator; import com.volmit.iris.engine.platform.studio.StudioGenerator;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;

View File

@@ -69,7 +69,7 @@ public interface DecreeParameterHandler<T> {
/** /**
* Should parse a String into the designated type. You can force it to not throw a whichexception * Should parse a String into the designated type. You can force it to not throw a whichexception
* *
* @param in The string to parse * @param in The string to parse
* @param force force an option instead of throwing decreewhich * @param force force an option instead of throwing decreewhich
* @return The value extracted from the string, of the designated type * @return The value extracted from the string, of the designated type
* @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this) * @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this)

View File

@@ -59,11 +59,9 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
KList<String> v = getRoot().tabComplete(enhanced, enhanced.toString(" ")); KList<String> v = getRoot().tabComplete(enhanced, enhanced.toString(" "));
v.removeDuplicates(); v.removeDuplicates();
if(sender instanceof Player) if (sender instanceof Player) {
{ if (IrisSettings.get().getGeneral().isCommandSounds()) {
if(IrisSettings.get().getGeneral().isCommandSounds()) ((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 0.25f, RNG.r.f(0.125f, 1.95f));
{
((Player)sender).playSound(((Player)sender).getLocation(), Sound.BLOCK_AMETHYST_BLOCK_CHIME, 0.25f, RNG.r.f(0.125f, 1.95f));
} }
} }
@@ -79,26 +77,19 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
J.aBukkit(() -> { J.aBukkit(() -> {
if (!call(new VolmitSender(sender), args)) { if (!call(new VolmitSender(sender), args)) {
if(IrisSettings.get().getGeneral().isCommandSounds()) if (IrisSettings.get().getGeneral().isCommandSounds()) {
{ if (sender instanceof Player) {
if(sender instanceof Player) ((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 0.25f);
{ ((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 0.2f, 0.45f);
((Player)sender).playSound(((Player)sender).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 0.25f);
((Player)sender).playSound(((Player)sender).getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 0.2f, 0.45f);
} }
} }
sender.sendMessage(C.RED + "Unknown Iris Command"); sender.sendMessage(C.RED + "Unknown Iris Command");
} } else {
if (IrisSettings.get().getGeneral().isCommandSounds()) {
else if (sender instanceof Player) {
{ ((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 1.65f);
if(IrisSettings.get().getGeneral().isCommandSounds()) ((Player) sender).playSound(((Player) sender).getLocation(), Sound.BLOCK_RESPAWN_ANCHOR_CHARGE, 0.125f, 2.99f);
{
if(sender instanceof Player)
{
((Player)sender).playSound(((Player)sender).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 1.65f);
((Player)sender).playSound(((Player)sender).getLocation(), Sound.BLOCK_RESPAWN_ANCHOR_CHARGE, 0.125f, 2.99f);
} }
} }
} }

View File

@@ -65,21 +65,13 @@ public class BiomeHandler implements DecreeParameterHandler<IrisBiome> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Biome \"" + in + "\""); throw new DecreeParsingException("Unable to find Biome \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -62,21 +62,13 @@ public class DimensionHandler implements DecreeParameterHandler<IrisDimension> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Dimension \"" + in + "\""); throw new DecreeParsingException("Unable to find Dimension \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -82,21 +82,13 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Entity \"" + in + "\""); throw new DecreeParsingException("Unable to find Entity \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -62,21 +62,13 @@ public class GeneratorHandler implements DecreeParameterHandler<IrisGenerator> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Generator \"" + in + "\""); throw new DecreeParsingException("Unable to find Generator \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -46,21 +46,13 @@ public class PlayerHandler implements DecreeParameterHandler<Player> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Player \"" + in + "\""); throw new DecreeParsingException("Unable to find Player \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -65,21 +65,13 @@ public class RegionHandler implements DecreeParameterHandler<IrisRegion> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Region \"" + in + "\""); throw new DecreeParsingException("Unable to find Region \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -62,21 +62,13 @@ public class ScriptHandler implements DecreeParameterHandler<IrisScript> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Script \"" + in + "\""); throw new DecreeParsingException("Unable to find Script \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -51,21 +51,13 @@ public class WorldHandler implements DecreeParameterHandler<World> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find World \"" + in + "\""); throw new DecreeParsingException("Unable to find World \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -56,21 +56,13 @@ public class ObjectHandler implements DecreeParameterHandler<String> {
if (options.isEmpty()) { if (options.isEmpty()) {
throw new DecreeParsingException("Unable to find Object \"" + in + "\""); throw new DecreeParsingException("Unable to find Object \"" + in + "\"");
} else if (options.size() > 1) { } else if (options.size() > 1) {
if(force) if (force) {
{ try {
try
{
return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0); return options.stream().filter((i) -> toString(i).equalsIgnoreCase(in)).collect(Collectors.toList()).get(0);
} } catch (Throwable e) {
catch(Throwable e)
{
throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\""); throw new DecreeParsingException("Unable to filter which Biome \"" + in + "\"");
} }
} } else {
else
{
throw new DecreeWhichException(); throw new DecreeWhichException();
} }
} }

View File

@@ -34,18 +34,18 @@ import com.volmit.iris.util.plugin.CommandDummy;
import com.volmit.iris.util.plugin.VolmitSender; import com.volmit.iris.util.plugin.VolmitSender;
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;
import com.volmit.iris.util.stream.utility.SemaphoreStream;
import lombok.Data; import lombok.Data;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.Objects; import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.*; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
@Data @Data
public class VirtualDecreeCommand { public class VirtualDecreeCommand {
@@ -105,17 +105,14 @@ public class VirtualDecreeCommand {
private ChronoLatch cl = new ChronoLatch(1000); private ChronoLatch cl = new ChronoLatch(1000);
public void cacheAll() public void cacheAll() {
{
VolmitSender sender = new VolmitSender(new CommandDummy()); VolmitSender sender = new VolmitSender(new CommandDummy());
if(isNode()) if (isNode()) {
{
J.a(() -> sender.sendDecreeHelpNode(this)); J.a(() -> sender.sendDecreeHelpNode(this));
} }
for(VirtualDecreeCommand j : nodes) for (VirtualDecreeCommand j : nodes) {
{
j.cacheAll(); j.cacheAll();
} }
} }
@@ -286,8 +283,7 @@ public class VirtualDecreeCommand {
for (int ix = 0; ix < in.size(); ix++) { for (int ix = 0; ix < in.size(); ix++) {
String i = in.get(ix); String i = in.get(ix);
if(i == null) if (i == null) {
{
continue; continue;
} }
@@ -337,8 +333,7 @@ public class VirtualDecreeCommand {
Iris.debug("Found multiple results for " + key + "=" + value + " in " + getPath() + " using the handler " + param.getHandler().getClass().getSimpleName() + " with potential matches [" + validOptions.toString(",") + "]. Asking client to define one"); Iris.debug("Found multiple results for " + key + "=" + value + " in " + getPath() + " using the handler " + param.getHandler().getClass().getSimpleName() + " with potential matches [" + validOptions.toString(",") + "]. Asking client to define one");
String update = pickValidOption(sender, validOptions, param.getHandler(), param.getName(), param.getType().getSimpleName()); String update = pickValidOption(sender, validOptions, param.getHandler(), param.getName(), param.getType().getSimpleName());
if(update == null) if (update == null) {
{
return null; return null;
} }
@@ -360,8 +355,7 @@ public class VirtualDecreeCommand {
KList<?> validOptions = par.getHandler().getPossibilities(i); KList<?> validOptions = par.getHandler().getPossibilities(i);
String update = pickValidOption(sender, validOptions, par.getHandler(), par.getName(), par.getType().getSimpleName()); String update = pickValidOption(sender, validOptions, par.getHandler(), par.getName(), par.getType().getSimpleName());
if(update == null) if (update == null) {
{
return null; return null;
} }
@@ -403,15 +397,10 @@ public class VirtualDecreeCommand {
sender.sendDecreeHelp(this); sender.sendDecreeHelp(this);
return true; return true;
} } else if (args.size() == 1) {
for (String i : args) {
else if(args.size() == 1) if (i.startsWith("help=")) {
{ sender.sendDecreeHelp(this, Integer.parseInt(i.split("\\Q=\\E")[1]) - 1);
for(String i : args)
{
if(i.startsWith("help="))
{
sender.sendDecreeHelp(this, Integer.parseInt(i.split("\\Q=\\E")[1])-1);
return true; return true;
} }
} }
@@ -452,8 +441,7 @@ public class VirtualDecreeCommand {
KList<?> validOptions = i.getHandler().getPossibilities(i.getParam().defaultValue()); KList<?> validOptions = i.getHandler().getPossibilities(i.getParam().defaultValue());
String update = pickValidOption(sender, validOptions, i.getHandler(), i.getName(), i.getType().getSimpleName()); String update = pickValidOption(sender, validOptions, i.getHandler(), i.getName(), i.getType().getSimpleName());
if(update == null) if (update == null) {
{
return false; return false;
} }
@@ -530,17 +518,15 @@ public class VirtualDecreeCommand {
String password = UUID.randomUUID().toString().replaceAll("\\Q-\\E", ""); String password = UUID.randomUUID().toString().replaceAll("\\Q-\\E", "");
int m = 0; int m = 0;
for(String i : validOptions.convert(handler::toStringForce)) for (String i : validOptions.convert(handler::toStringForce)) {
{ sender.sendMessage("<hover:show_text:'" + gradients[m % gradients.length] + i + "</gradient>'><click:run_command:/irisdecree " + password + " " + i + ">" + "- " + gradients[m % gradients.length] + i + "</gradient></click></hover>");
sender.sendMessage( "<hover:show_text:'" + gradients[m%gradients.length] + i+"</gradient>'><click:run_command:/irisdecree "+ password + " " + i+">"+"- " + gradients[m%gradients.length] + i + "</gradient></click></hover>");
m++; m++;
} }
CompletableFuture<String> future = new CompletableFuture<>(); CompletableFuture<String> future = new CompletableFuture<>();
Iris.service(CommandSVC.class).post(password, future); Iris.service(CommandSVC.class).post(password, future);
if(IrisSettings.get().getGeneral().isCommandSounds() && sender.isPlayer()) if (IrisSettings.get().getGeneral().isCommandSounds() && sender.isPlayer()) {
{
(sender.player()).playSound((sender.player()).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 0.65f); (sender.player()).playSound((sender.player()).getLocation(), Sound.BLOCK_AMETHYST_CLUSTER_BREAK, 0.77f, 0.65f);
(sender.player()).playSound((sender.player()).getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 0.125f, 1.99f); (sender.player()).playSound((sender.player()).getLocation(), Sound.BLOCK_BEACON_DEACTIVATE, 0.125f, 1.99f);
} }

View File

@@ -20,7 +20,6 @@ package com.volmit.iris.util.io;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.function.Consumer3; import com.volmit.iris.util.function.Consumer3;
import com.volmit.iris.util.plugin.VolmitSender;
import java.io.File; import java.io.File;
@@ -48,8 +47,7 @@ public class ReactiveFolder {
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) { if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
for (File i : fw.getCreated()) { for (File i : fw.getCreated()) {
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) { if (i.getName().endsWith(".iob") || i.getName().endsWith(".json") || i.getName().endsWith(".js")) {
if(i.getPath().contains(".iris")) if (i.getPath().contains(".iris")) {
{
continue; continue;
} }
@@ -60,8 +58,7 @@ public class ReactiveFolder {
if (!modified) { if (!modified) {
for (File i : fw.getChanged()) { for (File i : fw.getChanged()) {
if(i.getPath().contains(".iris")) if (i.getPath().contains(".iris")) {
{
continue; continue;
} }
@@ -74,8 +71,7 @@ public class ReactiveFolder {
if (!modified) { if (!modified) {
for (File i : fw.getDeleted()) { for (File i : fw.getDeleted()) {
if(i.getPath().contains(".iris")) if (i.getPath().contains(".iris")) {
{
continue; continue;
} }

View File

@@ -18,7 +18,6 @@
package com.volmit.iris.util.matter; package com.volmit.iris.util.matter;
import com.volmit.iris.util.matter.slices.MarkerMatter;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

View File

@@ -23,31 +23,26 @@ import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class Chunks { public class Chunks {
public static boolean isSafe(World w, int x, int z) public static boolean isSafe(World w, int x, int z) {
{
return w.isChunkLoaded(x, z) return w.isChunkLoaded(x, z)
&& w.isChunkLoaded(x+1, z) && w.isChunkLoaded(x + 1, z)
&& w.isChunkLoaded(x, z+1) && w.isChunkLoaded(x, z + 1)
&& w.isChunkLoaded(x-1, z) && w.isChunkLoaded(x - 1, z)
&& w.isChunkLoaded(x, z-1) && w.isChunkLoaded(x, z - 1)
&& w.isChunkLoaded(x-1, z-1) && w.isChunkLoaded(x - 1, z - 1)
&& w.isChunkLoaded(x+1, z+1) && w.isChunkLoaded(x + 1, z + 1)
&& w.isChunkLoaded(x+1, z-1) && w.isChunkLoaded(x + 1, z - 1)
&& w.isChunkLoaded(x-1, z+1); && w.isChunkLoaded(x - 1, z + 1);
} }
public static boolean isSafe(Location l) public static boolean isSafe(Location l) {
{
return isSafe(l.getWorld(), l.getBlockX() >> 4, l.getBlockZ() >> 4); return isSafe(l.getWorld(), l.getBlockX() >> 4, l.getBlockZ() >> 4);
} }
public static boolean hasPlayersNearby(Location at) { public static boolean hasPlayersNearby(Location at) {
try{ try {
return !at.getWorld().getNearbyEntities(at, 32, 32, 32, (i) -> i instanceof Player).isEmpty(); return !at.getWorld().getNearbyEntities(at, 32, 32, 32, (i) -> i instanceof Player).isEmpty();
} } catch (Throwable ignored) {
catch(Throwable ignored)
{
return false; return false;
} }
} }

View File

@@ -42,7 +42,6 @@ import org.bukkit.permissions.Permission;
import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachment;
import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.permissions.PermissionAttachmentInfo;
import org.bukkit.plugin.Plugin; import org.bukkit.plugin.Plugin;
import org.bukkit.util.ChatPaginator;
import java.time.Duration; import java.time.Duration;
import java.util.Set; import java.util.Set;
@@ -251,8 +250,7 @@ public class VolmitSender implements CommandSender {
} }
private Component createNoPrefixComponent(String message) { private Component createNoPrefixComponent(String message) {
if(!IrisSettings.get().getGeneral().canUseCustomColors(this)) if (!IrisSettings.get().getGeneral().canUseCustomColors(this)) {
{
String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(message)); String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(message));
return MiniMessage.get().parse(t); return MiniMessage.get().parse(t);
} }
@@ -267,8 +265,7 @@ public class VolmitSender implements CommandSender {
} }
private Component createComponent(String message) { private Component createComponent(String message) {
if(!IrisSettings.get().getGeneral().canUseCustomColors(this)) if (!IrisSettings.get().getGeneral().canUseCustomColors(this)) {
{
String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(getTag() + message)); String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(getTag() + message));
return MiniMessage.get().parse(t); return MiniMessage.get().parse(t);
} }
@@ -279,8 +276,7 @@ public class VolmitSender implements CommandSender {
} }
private Component createComponentRaw(String message) { private Component createComponentRaw(String message) {
if(!IrisSettings.get().getGeneral().canUseCustomColors(this)) if (!IrisSettings.get().getGeneral().canUseCustomColors(this)) {
{
String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(getTag() + message)); String t = C.translateAlternateColorCodes('&', MiniMessage.get().stripTokens(getTag() + message));
return MiniMessage.get().parse(t); return MiniMessage.get().parse(t);
} }
@@ -315,8 +311,7 @@ public class VolmitSender implements CommandSender {
@Override @Override
public void sendMessage(String message) { public void sendMessage(String message) {
if(s instanceof CommandDummy) if (s instanceof CommandDummy) {
{
return; return;
} }
@@ -341,8 +336,7 @@ public class VolmitSender implements CommandSender {
} }
public void sendMessageRaw(String message) { public void sendMessageRaw(String message) {
if(s instanceof CommandDummy) if (s instanceof CommandDummy) {
{
return; return;
} }
@@ -445,15 +439,13 @@ public class VolmitSender implements CommandSender {
} }
public static <T> KList<T> paginate(KList<T> all, int linesPerPage, int page, AtomicBoolean hasNext) public static <T> KList<T> paginate(KList<T> all, int linesPerPage, int page, AtomicBoolean hasNext) {
{ int totalPages = (int) Math.ceil((double) all.size() / linesPerPage);
int totalPages = (int) Math.ceil((double)all.size() / linesPerPage);
page = page < 0 ? 0 : page >= totalPages ? totalPages - 1 : page; page = page < 0 ? 0 : page >= totalPages ? totalPages - 1 : page;
hasNext.set(page < totalPages-1); hasNext.set(page < totalPages - 1);
KList<T> d = new KList<>(); KList<T> d = new KList<>();
for(int i = linesPerPage * page; i < Math.min(all.size(), linesPerPage * (page + 1)); i++) for (int i = linesPerPage * page; i < Math.min(all.size(), linesPerPage * (page + 1)); i++) {
{
d.add(all.get(i)); d.add(all.get(i));
} }
@@ -461,8 +453,7 @@ public class VolmitSender implements CommandSender {
} }
public void sendDecreeHelp(VirtualDecreeCommand v, int page) { public void sendDecreeHelp(VirtualDecreeCommand v, int page) {
if(!isPlayer()) if (!isPlayer()) {
{
for (VirtualDecreeCommand i : v.getNodes()) { for (VirtualDecreeCommand i : v.getNodes()) {
sendDecreeHelpNode(i); sendDecreeHelpNode(i);
} }
@@ -475,7 +466,7 @@ public class VolmitSender implements CommandSender {
sendMessageRaw("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); sendMessageRaw("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n");
if (v.getNodes().isNotEmpty()) { if (v.getNodes().isNotEmpty()) {
sendHeader(v.getPath() + (page > 0 ? (" {" + (page+1) + "}") : "")); sendHeader(v.getPath() + (page > 0 ? (" {" + (page + 1) + "}") : ""));
if (isPlayer() && v.getParent() != null) { if (isPlayer() && v.getParent() != null) {
sendMessageRaw("<hover:show_text:'" + "<#b54b38>Click to go back to <#3299bf>" + Form.capitalize(v.getParent().getName()) + " Help" + "'><click:run_command:" + v.getParent().getPath() + "><font:minecraft:uniform><#f58571>〈 Back</click></hover>"); sendMessageRaw("<hover:show_text:'" + "<#b54b38>Click to go back to <#3299bf>" + Form.capitalize(v.getParent().getName()) + " Help" + "'><click:run_command:" + v.getParent().getPath() + "><font:minecraft:uniform><#f58571>〈 Back</click></hover>");
} }
@@ -488,16 +479,14 @@ public class VolmitSender implements CommandSender {
String s = ""; String s = "";
int l = 75 - (page > 0 ? 10 : 0) - (next.get() ? 10 : 0); int l = 75 - (page > 0 ? 10 : 0) - (next.get() ? 10 : 0);
if(page > 0) if (page > 0) {
{
s += "<hover:show_text:'<green>Click to go back to page " + page + "'><click:run_command:" + v.getPath() + " help=" + page + "><gradient:#27b84d:#2770b8>〈 Page " + page + "</click></hover><reset> "; s += "<hover:show_text:'<green>Click to go back to page " + page + "'><click:run_command:" + v.getPath() + " help=" + page + "><gradient:#27b84d:#2770b8>〈 Page " + page + "</click></hover><reset> ";
} }
s += "<reset><font:minecraft:uniform><strikethrough><gradient:#32bfad:#34eb6b>" + Form.repeat(" ", l) + "<reset>"; s += "<reset><font:minecraft:uniform><strikethrough><gradient:#32bfad:#34eb6b>" + Form.repeat(" ", l) + "<reset>";
if(next.get()) if (next.get()) {
{ s += " <hover:show_text:'<green>Click to go to back to page " + (page + 2) + "'><click:run_command:" + v.getPath() + " help=" + (page + 2) + "><gradient:#2770b8:#27b84d>Page " + (page + 2) + " ❭</click></hover>";
s += " <hover:show_text:'<green>Click to go to back to page " + (page+2) + "'><click:run_command:" + v.getPath() + " help=" + (page+2) + "><gradient:#2770b8:#27b84d>Page " + (page+2) + " ❭</click></hover>";
} }
sendMessageRaw(s); sendMessageRaw(s);
@@ -512,8 +501,7 @@ public class VolmitSender implements CommandSender {
public void sendDecreeHelpNode(VirtualDecreeCommand i) { public void sendDecreeHelpNode(VirtualDecreeCommand i) {
if (isPlayer() || s instanceof CommandDummy) { if (isPlayer() || s instanceof CommandDummy) {
sendMessageRaw(helpCache.compute(i.getPath(), (k, v) -> { sendMessageRaw(helpCache.compute(i.getPath(), (k, v) -> {
if(v != null) if (v != null) {
{
return v; return v;
} }