9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-23 00:59:16 +00:00

Merge remote-tracking branch 'origin/master'

This commit is contained in:
cyberpwn
2021-09-04 14:05:52 -04:00
79 changed files with 623 additions and 740 deletions

View File

@@ -60,9 +60,9 @@ body:
label: Checklist label: Checklist
description: Please ensure you meet each of the requirements below description: Please ensure you meet each of the requirements below
options: options:
- label: I am using an unmodified version of Iris. (If you modified the plugin and see an issue, make sure it is reproducable on the latest spigot version or contact [support](discord.gg/volmit)) - label: I am using an unmodified version of Iris. (If you modified the plugin and see an issue, make sure it is reproducable on the latest spigot version or contact [support](https://discord.gg/volmit))
required: true required: true
- label: I am using Spigot, Paper, Tuinity, or Purpur. (If you are not, and still think it is a valid issue, contact [support](discord.gg/volmit)) - label: I am using Spigot, Paper, Tuinity, or Purpur. (If you are not, and still think it is a valid issue, contact [support](https://discord.gg/volmit))
required: true required: true
- type: markdown - type: markdown
id: thanks id: thanks

View File

@@ -15,16 +15,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.guardsquare:proguard-gradle:7.1.0'
}
}
plugins { plugins {
id 'java' id 'java'
id 'io.freefair.lombok' version '5.2.1' id 'io.freefair.lombok' version '5.2.1'
@@ -32,11 +22,10 @@ plugins {
} }
group 'com.volmit.iris' group 'com.volmit.iris'
version '1.8' version '1.8.3'
def apiVersion = '1.17' def apiVersion = '1.17'
def name = getRootProject().getName() // See settings.gradle def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris' def main = 'com.volmit.iris.Iris'
// You need to also set command usage, aliases and description in src/main/resources/plugin.yml
// ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED // ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED
// ============================================================== // ==============================================================
@@ -47,32 +36,6 @@ registerCustomOutputTask('Coco', 'C:/Users/sjoer/Documents/Development/MCServer/
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins', name) registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins', name)
// ============================================================== // ==============================================================
def dependsDir = "${buildDir}/libs/dependencies/" as String
task copyDepends(type: Copy) {
dependsOn(":shadowJar")
group('proguard')
from configurations.default
into "${dependsDir}"
}
task release(type: proguard.gradle.ProGuardTask) {
dependsOn(":copyDepends")
group('proguard')
configuration 'proguard.pro'
injars("${buildDir}/libs/" + name + "-" + version + "-all.jar")
outjars("${buildDir}/production/" + name + "/" + version + "/" + name + "-" + version + ".jar")
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
libraryjars "${System.getProperty('java.home')}/jmods/"
libraryjars "${dependsDir}"
dontobfuscate()
dontwarn()
dontshrink()
dontoptimize()
dontnote()
verbose()
}
def registerCustomOutputTask(name, path, plugin) { def registerCustomOutputTask(name, path, plugin) {
tasks.register('build' + name, Copy) { tasks.register('build' + name, Copy) {
group('development') group('development')
@@ -86,8 +49,14 @@ def registerCustomOutputTask(name, path, plugin) {
} }
} }
/**
* Gradle is weird sometimes, we need to delete the plugin yml from the build folder to actually filter properly.
*/
file(jar.archiveFile.get().getAsFile().getParentFile().getParentFile().getParentFile().getAbsolutePath() + '/build/resources/main/plugin.yml').delete() file(jar.archiveFile.get().getAsFile().getParentFile().getParentFile().getParentFile().getAbsolutePath() + '/build/resources/main/plugin.yml').delete()
/**
* Expand properties into plugin yml
*/
processResources { processResources {
filesMatching('**/plugin.yml') { filesMatching('**/plugin.yml') {
expand( expand(
@@ -99,6 +68,10 @@ processResources {
} }
} }
/**
* For performance during compilation, we specify which module groups are accessible from which repositories
* This may cause issues resolving new dependencies but normally it shouldn't.
*/
repositories { repositories {
maven { maven {
url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
@@ -153,23 +126,45 @@ repositories {
// maven { allowInsecureProtocol true, url 'http://archive.arcane.art/repository/arcane'} // maven { allowInsecureProtocol true, url 'http://archive.arcane.art/repository/arcane'}
} }
/**
* We need parameter meta for the decree command system
*/
compileJava { compileJava {
options.compilerArgs << '-parameters' options.compilerArgs << '-parameters'
} }
shadowJar /**
{ * Configure Iris for shading
minimize() */
append("plugin.yml") shadowJar {
relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic' minimize()
relocate 'io.papermc.lib', 'com.volmit.iris.util.paper' append("plugin.yml")
dependencies { relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic'
include(dependency('io.papermc:paperlib')) relocate 'io.papermc.lib', 'com.volmit.iris.util.paper'
include(dependency('com.dfsek:Paralithic')) dependencies {
include(dependency('net.kyori:')) include(dependency('io.papermc:paperlib'))
} include(dependency('com.dfsek:Paralithic'))
} include(dependency('net.kyori:'))
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 60, 'minutes'
resolutionStrategy.cacheDynamicVersionsFor 60, 'minutes'
}
/**
* Dependencies.
*
* Provided or classpath dependencies are not shaded and are available on the runtime classpath
*
* Shaded dependencies are not available at runtime, nor are they available on mvn central so they
* need to be shaded into the jar (increasing binary size)
*
* Dynamically loaded dependencies are defined in the plugin.yml (updating these must be updated in the
* plugin.yml also, otherwise they wont be available). These do not increase binary size). Only declare
* these dependencies if they are available on mvn central.
*/
dependencies { dependencies {
// Provided or Classpath // Provided or Classpath
compileOnly 'org.projectlombok:lombok:1.18.20' compileOnly 'org.projectlombok:lombok:1.18.20'

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;
} }
@@ -320,7 +315,7 @@ public class Iris extends VolmitPlugin implements Listener {
IrisSettings.invalidate(); IrisSettings.invalidate();
IrisSettings.get(); IrisSettings.get();
configWatcher.checkModified(); configWatcher.checkModified();
Iris.info("Hotloaded settings.json"); Iris.info("Hotloaded settings.json ");
} }
} }
@@ -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;
@@ -282,9 +267,16 @@ public class CommandStudio implements DecreeExecutor {
@Param(contextual = true, description = "The biome to edit") @Param(contextual = true, description = "The biome to edit")
IrisBiome biome IrisBiome biome
) { ) {
if (noStudio()) return; if (noStudio()) {
return;
}
try { try {
if (biome.getLoadFile() == null) {
sender().sendMessage(C.GOLD + "Cannot find the file for the biome you are in! Perhaps it was not loaded directly from a file?");
return;
}
Desktop.getDesktop().open(biome.getLoadFile()); Desktop.getDesktop().open(biome.getLoadFile());
} catch (Throwable e) { } catch (Throwable e) {
Iris.reportError(e); Iris.reportError(e);

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;
@@ -297,6 +291,14 @@ public class ResourceLoader<T extends IrisRegistrant> {
lock.unlock(); lock.unlock();
if(folderCache == null)
{
synchronized (this)
{
return getFolderCache();
}
}
return folderCache; return folderCache;
} }

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

@@ -23,48 +23,41 @@ 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.IrisFeaturePositional; import com.volmit.iris.engine.object.IrisFeaturePositional;
import com.volmit.iris.util.board.BoardManager;
import com.volmit.iris.util.board.BoardProvider; import com.volmit.iris.util.board.BoardProvider;
import com.volmit.iris.util.board.BoardSettings; import com.volmit.iris.util.board.BoardSettings;
import com.volmit.iris.util.board.ScoreDirection; import com.volmit.iris.util.board.ScoreDirection;
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.format.C; import com.volmit.iris.util.format.C;
import com.volmit.iris.util.format.Form; import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.math.RollingSequence;
import com.volmit.iris.util.plugin.IrisService; import com.volmit.iris.util.plugin.IrisService;
import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.J; import com.volmit.iris.util.scheduling.J;
import org.bukkit.Bukkit; import lombok.Data;
import org.bukkit.World;
import org.bukkit.boss.BarColor;
import org.bukkit.boss.BarStyle;
import org.bukkit.boss.BossBar;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerChangedWorldEvent; import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import java.util.List; import java.util.List;
public class BoardSVC implements IrisService, BoardProvider { public class BoardSVC implements IrisService, BoardProvider {
private BossBar energyBar;
private com.volmit.iris.util.board.BoardManager manager; private com.volmit.iris.util.board.BoardManager manager;
private String mem = "..."; private final KMap<Player, PlayerBoard> boards = new KMap<>();
public final RollingSequence tp = new RollingSequence(100);
private final ChronoLatch cl = new ChronoLatch(1000);
private final ChronoLatch ecl = new ChronoLatch(50);
@Override @Override
public void onEnable() { public void onEnable() {
manager = new com.volmit.iris.util.board.BoardManager(Iris.instance, BoardSettings.builder() J.ar(this::tick, 20);
manager = new BoardManager(Iris.instance, BoardSettings.builder()
.boardProvider(this) .boardProvider(this)
.scoreDirection(ScoreDirection.DOWN) .scoreDirection(ScoreDirection.DOWN)
.build()); .build());
energyBar = Bukkit.createBossBar("Spawner Energy " + 0, BarColor.BLUE, BarStyle.SOLID);
} }
@Override @Override
public void onDisable() { public void onDisable() {
manager.onDisable(); manager.onDisable();
energyBar.removeAll(); boards.clear();
} }
@EventHandler @EventHandler
@@ -72,19 +65,18 @@ public class BoardSVC implements IrisService, BoardProvider {
J.s(() -> updatePlayer(e.getPlayer())); J.s(() -> updatePlayer(e.getPlayer()));
} }
private boolean isIrisWorld(World w) { @EventHandler
return IrisToolbelt.isIrisWorld(w) && IrisToolbelt.access(w).isStudio(); public void on(PlayerJoinEvent e) {
J.s(() -> updatePlayer(e.getPlayer()));
} }
public void updatePlayer(Player p) { public void updatePlayer(Player p) {
if (isIrisWorld(p.getWorld())) { if (IrisToolbelt.isIrisStudioWorld(p.getWorld())) {
manager.remove(p); manager.remove(p);
manager.setup(p); manager.setup(p);
energyBar.removePlayer(p);
energyBar.addPlayer(p);
} else { } else {
manager.remove(p); manager.remove(p);
energyBar.removePlayer(p); boards.remove(p);
} }
} }
@@ -93,73 +85,57 @@ public class BoardSVC implements IrisService, BoardProvider {
return C.GREEN + "Iris"; return C.GREEN + "Iris";
} }
public void tick() {
boards.forEach((k, v) -> v.update());
}
@Override @Override
public List<String> getLines(Player player) { public List<String> getLines(Player player) {
KList<String> v = new KList<>(); PlayerBoard pb = boards.computeIfAbsent(player, PlayerBoard::new);
synchronized (pb.lines) {
return pb.lines;
}
}
if (!isIrisWorld(player.getWorld())) { @Data
return v; public static class PlayerBoard {
private final Player player;
private final KList<String> lines;
public PlayerBoard(Player player) {
this.player = player;
this.lines = new KList<>();
update();
} }
Engine engine = IrisToolbelt.access(player.getWorld()).getEngine(); public void update() {
synchronized (lines) {
lines.clear();
if (cl.flip()) { if (!IrisToolbelt.isIrisStudioWorld(player.getWorld())) {
mem = Form.memSize(0, 2); return;
}
Engine engine = IrisToolbelt.access(player.getWorld()).getEngine();
int x = player.getLocation().getBlockX();
int y = player.getLocation().getBlockY();
int z = player.getLocation().getBlockZ();
KList<IrisFeaturePositional> f = new KList<>();
f.add(engine.getMantle().forEachFeature(x, z));
lines.add("&7&m ");
lines.add(C.GREEN + "Speed" + C.GRAY + ": " + Form.f(engine.getGeneratedPerSecond(), 0) + "/s " + Form.duration(1000D / engine.getGeneratedPerSecond(), 0));
lines.add(C.AQUA + "Cache" + C.GRAY + ": " + Form.f(IrisData.cacheSize()));
lines.add(C.AQUA + "Mantle" + C.GRAY + ": " + engine.getMantle().getLoadedRegionCount());
lines.add("&7&m ");
lines.add(C.AQUA + "Region" + C.GRAY + ": " + engine.getRegion(x, z).getName());
lines.add(C.AQUA + "Biome" + C.GRAY + ": " + engine.getBiomeOrMantle(x, y, z).getName());
lines.add(C.AQUA + "Height" + C.GRAY + ": " + Math.round(engine.getHeight(x, z)));
lines.add(C.AQUA + "Slope" + C.GRAY + ": " + Form.f(engine.getComplex().getSlopeStream().get(x, z), 2));
lines.add(C.AQUA + "Features" + C.GRAY + ": " + Form.f(f.size()));
lines.add(C.AQUA + "BUD/s" + C.GRAY + ": " + Form.f(engine.getBlockUpdatesPerSecond()));
lines.add("&7&m ");
}
} }
int x = player.getLocation().getBlockX();
int y = player.getLocation().getBlockY();
int z = player.getLocation().getBlockZ();
if (ecl.flip()) {
energyBar.setProgress(Math.min(1000D, engine.getWorldManager().getEnergy()) / 1000D);
energyBar.setTitle("Spawner Energy: " + Form.f((int) Math.min(1000D, engine.getWorldManager().getEnergy())));
}
int parallaxChunks = 0;
int parallaxRegions = 0;
long memoryGuess = 0;
int loadedObjects = 0;
loadedObjects += engine.getData().getObjectLoader().getSize();
memoryGuess += engine.getData().getObjectLoader().getTotalStorage() * 225L;
memoryGuess += parallaxChunks * 3500L;
memoryGuess += parallaxRegions * 1700000L;
tp.put(engine.getGeneratedPerSecond());
v.add("&7&m------------------");
v.add(C.GREEN + "Speed" + C.GRAY + ": " + Form.f(tp.getAverage(), 0) + "/s " + Form.duration(1000D / engine.getGeneratedPerSecond(), 0));
v.add(C.GREEN + "Memory Use" + C.GRAY + ": ~" + Form.memSize(memoryGuess, 0));
if (engine != null) {
v.add("&7&m------------------");
KList<IrisFeaturePositional> f = new KList<>();
f.add(engine.getMantle().forEachFeature(x, z));
v.add(C.AQUA + "Region" + C.GRAY + ": " + engine.getRegion(x, z).getName());
v.add(C.AQUA + "Biome" + C.GRAY + ": " + engine.getBiome(x, y, z).getName());
v.add(C.AQUA + "Height" + C.GRAY + ": " + Math.round(engine.getHeight(x, z)));
v.add(C.AQUA + "Slope" + C.GRAY + ": " + Form.f(engine.getComplex().getSlopeStream().get(x, z), 2));
v.add(C.AQUA + "Features" + C.GRAY + ": " + Form.f(f.size()));
v.add(C.AQUA + "Cache" + C.GRAY + ": " + Form.f(IrisData.cacheSize()));
v.add(C.AQUA + "Sat" + C.GRAY + ": " + Form.f(engine.getWorldManager().getEntityCount()) + "e / " + Form.f(engine.getWorldManager().getChunkCount()) + "c (" + Form.pc(engine.getWorldManager().getEntitySaturation(), 0) + ")");
}
if (Iris.jobCount() > 0) {
v.add("&7&m------------------");
v.add(C.LIGHT_PURPLE + "Tasks" + C.GRAY + ": " + Form.f(Iris.jobCount()));
}
if(engine.getBlockUpdatesPerSecond() > 0)
{
v.add("&7&m------------------");
v.add(C.LIGHT_PURPLE + "BUD/s" + C.GRAY + ": " + Form.f(engine.getBlockUpdatesPerSecond()));
}
v.add("&7&m------------------");
return v;
} }
} }

View File

@@ -19,13 +19,16 @@
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.core.tools.IrisToolbelt;
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;
import com.volmit.iris.util.decree.DecreeSystem; import com.volmit.iris.util.decree.DecreeSystem;
import com.volmit.iris.util.decree.virtual.VirtualDecreeCommand; import com.volmit.iris.util.decree.virtual.VirtualDecreeCommand;
import com.volmit.iris.util.format.C;
import com.volmit.iris.util.plugin.IrisService; import com.volmit.iris.util.plugin.IrisService;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.J;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@@ -38,7 +41,7 @@ public class CommandSVC implements IrisService, DecreeSystem {
@Override @Override
public void onEnable() { public void onEnable() {
Iris.instance.getCommand("iris").setExecutor(this); Iris.instance.getCommand("iris").setExecutor(this);
getRoot().cacheAll(); J.a(() -> getRoot().cacheAll());
} }
@Override @Override
@@ -47,21 +50,24 @@ 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);
return;
} }
} }
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);
}
} }
@Override @Override

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

@@ -90,6 +90,10 @@ public class IrisToolbelt {
return world.getGenerator() instanceof PlatformChunkGenerator; return world.getGenerator() instanceof PlatformChunkGenerator;
} }
public static boolean isIrisStudioWorld(World world) {
return isIrisWorld(world) && access(world).isStudio();
}
/** /**
* Get the Iris generator for the given world * Get the Iris generator for the given world
* *

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);
} }
@@ -433,9 +428,9 @@ public class IrisEngine implements Engine {
getTerrainActuator().actuate(x, z, blocks, multicore); getTerrainActuator().actuate(x, z, blocks, multicore);
getBiomeActuator().actuate(x, z, vbiomes, multicore); getBiomeActuator().actuate(x, z, vbiomes, multicore);
getDecorantActuator().actuate(x, z, blocks, multicore); getDecorantActuator().actuate(x, z, blocks, multicore);
getDepositModifier().modify(x, z, blocks, multicore);
getCaveModifier().modify(x >> 4, z >> 4, blocks, multicore); getCaveModifier().modify(x >> 4, z >> 4, blocks, multicore);
getPostModifier().modify(x, z, blocks, multicore); getPostModifier().modify(x, z, blocks, multicore);
getDepositModifier().modify(x, z, blocks, multicore);
getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore); getMantle().insertMatter(x >> 4, z >> 4, BlockData.class, blocks, multicore);
} }
getMetrics().getTotal().put(p.getMilliseconds()); getMetrics().getTotal().put(p.getMilliseconds());

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

@@ -23,15 +23,11 @@ import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.engine.mantle.EngineMantle; import com.volmit.iris.engine.mantle.EngineMantle;
import com.volmit.iris.engine.mantle.MantleComponent; import com.volmit.iris.engine.mantle.MantleComponent;
import com.volmit.iris.engine.mantle.components.*; import com.volmit.iris.engine.mantle.components.MantleCarvingComponent;
import com.volmit.iris.engine.object.IrisBiome; import com.volmit.iris.engine.mantle.components.MantleFeatureComponent;
import com.volmit.iris.engine.object.IrisDepositGenerator; import com.volmit.iris.engine.mantle.components.MantleJigsawComponent;
import com.volmit.iris.engine.object.IrisFeaturePotential; import com.volmit.iris.engine.mantle.components.MantleObjectComponent;
import com.volmit.iris.engine.object.IrisJigsawStructurePlacement; import com.volmit.iris.engine.object.*;
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;
@@ -195,6 +184,21 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
return getComplex().getRegionStream().get(x, z); return getComplex().getRegionStream().get(x, z);
} }
@BlockCoordinates
default IrisBiome getCaveOrMantleBiome(int x, int y, int z) {
MatterCavern m = getMantle().getMantle().get(x, y, z, MatterCavern.class);
if (m != null && m.getCustomBiome() != null && !m.getCustomBiome().isEmpty()) {
IrisBiome biome = getData().getBiomeLoader().load(m.getCustomBiome());
if (biome != null) {
return biome;
}
}
return getCaveBiome(x, z);
}
@BlockCoordinates @BlockCoordinates
default IrisBiome getCaveBiome(int x, int z) { default IrisBiome getCaveBiome(int x, int z) {
return getComplex().getCaveBiomeStream().get(x, z); return getComplex().getCaveBiomeStream().get(x, z);
@@ -672,6 +676,14 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
return getSurfaceBiome(x, z); return getSurfaceBiome(x, z);
} }
default IrisBiome getBiomeOrMantle(int x, int y, int z) {
if (y <= getHeight(x, z) - 2) {
return getCaveOrMantleBiome(x, y, z);
}
return getSurfaceBiome(x, z);
}
default String getObjectPlacementKey(int x, int y, int z) { default String getObjectPlacementKey(int x, int y, int z) {
PlacedObject o = getObjectPlacement(x, y, z); PlacedObject o = getObjectPlacement(x, y, z);
@@ -712,4 +724,8 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
} }
int getCacheID(); int getCacheID();
default IrisBiome getBiomeOrMantle(Location l) {
return getBiomeOrMantle(l.getBlockX(), l.getBlockY(), l.getBlockZ());
}
} }

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)));
} }
}); });
@@ -315,4 +312,8 @@ public interface EngineMantle extends IObjectPlacer {
default boolean dequeueRegenerate(int x, int z) { default boolean dequeueRegenerate(int x, int z) {
return false;// TODO: return false;// TODO:
} }
default int getLoadedRegionCount() {
return getMantle().getLoadedRegionCount();
}
} }

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;
@@ -51,6 +47,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
private final RNG rng; private final RNG rng;
private final BlockData AIR = Material.CAVE_AIR.createBlockData(); private final BlockData AIR = Material.CAVE_AIR.createBlockData();
private final BlockData WATER = Material.WATER.createBlockData(); private final BlockData WATER = Material.WATER.createBlockData();
private final BlockData LAVA = Material.LAVA.createBlockData();
public IrisCarveModifier(Engine engine) { public IrisCarveModifier(Engine engine) {
super(engine, "Carve"); super(engine, "Carve");
@@ -65,8 +62,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 +101,13 @@ 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 if(c.isLava()) {
output.set(rx, yy, rz, LAVA);
} }
else {
else output.set(rx, yy, rz, AIR);
{
output.set(rx, yy, rz, AIR);
} }
}; };
@@ -127,7 +122,7 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
biome.setInferredType(InferredType.CAVE); biome.setInferredType(InferredType.CAVE);
BlockData d = biome.getWall().get(rng, i.getX() + (x << 4), i.getY(), i.getZ() + (z << 4), getData()); BlockData d = biome.getWall().get(rng, i.getX() + (x << 4), i.getY(), i.getZ() + (z << 4), getData());
if (d != null && B.isSolid(output.get(i.getX(), i.getY(), i.getZ()))) { if (d != null && B.isSolid(output.get(i.getX(), i.getY(), i.getZ())) && i.getY() <= getComplex().getHeightStream().get(i.getX() + (x << 4), i.getZ() + (z << 4))) {
output.set(i.getX(), i.getY(), i.getZ(), d); output.set(i.getX(), i.getY(), i.getZ(), d);
} }
} }
@@ -169,20 +164,28 @@ 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(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)))
{
output.set(rx, zone.ceiling, rz, AIR);
}
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);
} }
@@ -240,15 +243,19 @@ public class IrisCarveModifier extends EngineAssignedModifier<BlockData> {
break; break;
} }
if (!B.isSolid(output.get(rx, zone.ceiling + i + 1, rz))) { BlockData b = blocks.get(i);
BlockData up = output.get(rx, zone.ceiling + i + 1, rz);
if (!B.isSolid(up)) {
continue; continue;
} }
if (B.isOre(output.get(rx, zone.ceiling + i + 1, rz))) { if (B.isOre(up)) {
output.set(rx, zone.ceiling + i + 1, rz, B.toDeepSlateOre(up, b));
continue; continue;
} }
output.set(rx, zone.ceiling + i + 1, rz, blocks.get(i)); output.set(rx, zone.ceiling + i + 1, rz, b);
} }
} }

View File

@@ -24,6 +24,7 @@ import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisDepositGenerator; import com.volmit.iris.engine.object.IrisDepositGenerator;
import com.volmit.iris.engine.object.IrisObject; import com.volmit.iris.engine.object.IrisObject;
import com.volmit.iris.engine.object.IrisRegion; import com.volmit.iris.engine.object.IrisRegion;
import com.volmit.iris.util.data.B;
import com.volmit.iris.util.data.HeightMap; import com.volmit.iris.util.data.HeightMap;
import com.volmit.iris.util.hunk.Hunk; import com.volmit.iris.util.hunk.Hunk;
import com.volmit.iris.util.math.RNG; import com.volmit.iris.util.math.RNG;
@@ -120,20 +121,9 @@ public class IrisDepositModifier extends EngineAssignedModifier<BlockData> {
continue; continue;
} }
boolean allow = false; if(!getEngine().getMantle().isCarved((cx << 4) + nx, ny, (cz << 4) + nz))
{
BlockData b = data.get(nx, ny, nz); data.set(nx, ny, nz, B.toDeepSlateOre(data.get(nx, ny, nz), clump.getBlocks().get(j)));
if (b != null) {
for (BlockData f : getDimension().getRockPalette().getBlockData(getData())) {
if (f.getMaterial().equals(b.getMaterial())) {
allow = true;
break;
}
}
}
if (allow) {
data.set(nx, ny, nz, clump.getBlocks().get(j));
} }
} }
} }

View File

@@ -18,6 +18,7 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData; import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant; import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
@@ -65,7 +66,6 @@ public class IrisCave extends IrisRegistrant {
return "Cave"; return "Cave";
} }
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);
} }
@@ -73,42 +73,34 @@ public class IrisCave extends IrisRegistrant {
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) {
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;
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;
break; break;
} }
} }
} }
else
{
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);
} }
MatterCavern c = new MatterCavern(true, customBiome, (byte) 0);
MatterCavern w = new MatterCavern(true, customBiome, (byte) 1);
writer.setLineConsumer(points, writer.setLineConsumer(points,
girth, true, girth, true,
(xf, yf, zf) -> new MatterCavern(true, customBiome, yf <= h)); (xf, yf, zf) -> yf <= h ? w : c);
} }
@Override @Override

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

@@ -287,7 +287,7 @@ public class IrisDimension extends IrisRegistrant {
int jump = strongholdJumpDistance; int jump = strongholdJumpDistance;
RNG rng = new RNG((seed * 223) + 12945); RNG rng = new RNG((seed * 223) + 12945);
for (int i = 0; i < maxStrongholds; i++) { for (int i = 0; i < maxStrongholds+1; i++) {
int m = i + 1; int m = i + 1;
pos.add(new Position2( pos.add(new Position2(
(int) ((rng.i(jump * i) + (jump * i)) * (rng.b() ? -1D : 1D)), (int) ((rng.i(jump * i) + (jump * i)) * (rng.b() ? -1D : 1D)),
@@ -295,6 +295,8 @@ public class IrisDimension extends IrisRegistrant {
)); ));
} }
pos.remove(0);
return pos; return pos;
}); });
} }

View File

@@ -55,7 +55,7 @@ public class IrisElipsoid implements IRare {
writer.setElipsoid(x, y, z, writer.setElipsoid(x, y, z,
xRadius.get(rng, z, y, engine.getData()), xRadius.get(rng, z, y, engine.getData()),
yRadius.get(rng, x, z, engine.getData()), yRadius.get(rng, x, z, engine.getData()),
zRadius.get(rng, y, x, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false))); zRadius.get(rng, y, x, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)));
} }
public double maxSize() { public double maxSize() {

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

@@ -34,6 +34,8 @@ import lombok.experimental.Accessors;
@Desc("Configures rotation for iris") @Desc("Configures rotation for iris")
@Data @Data
public class IrisInterpolator { public class IrisInterpolator {
public static final IrisInterpolator DEFAULT = new IrisInterpolator();
@Required @Required
@Desc("The interpolation method when two biomes use different heights but this same generator") @Desc("The interpolation method when two biomes use different heights but this same generator")
private InterpolationMethod function = InterpolationMethod.BILINEAR_STARCAST_6; private InterpolationMethod function = InterpolationMethod.BILINEAR_STARCAST_6;

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

@@ -46,7 +46,7 @@ public class IrisPyramid implements IRare {
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>(); private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) { public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
writer.setPyramid(x, y, z, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false)), writer.setPyramid(x, y, z, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)),
(int) baseWidth.get(rng, z, y, engine.getData()), true); (int) baseWidth.get(rng, z, y, engine.getData()), true);
} }

View File

@@ -18,6 +18,7 @@
package com.volmit.iris.engine.object; package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.loader.IrisData; import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant; import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.engine.framework.Engine; import com.volmit.iris.engine.framework.Engine;
@@ -62,15 +63,18 @@ public class IrisRavine extends IrisRegistrant {
private IrisShapedGeneratorStyle baseWidthStyle = new IrisShapedGeneratorStyle(NoiseStyle.PERLIN, 3, 6); private IrisShapedGeneratorStyle baseWidthStyle = new IrisShapedGeneratorStyle(NoiseStyle.PERLIN, 3, 6);
@MinNumber(1) @MinNumber(1)
@MaxNumber(70) @MaxNumber(100)
@Desc("The angle at which the ravine widens as it gets closer to the surface") @Desc("The angle at which the ravine widens as it gets closer to the surface")
private double angle = 18; private double angle = 18;
@MinNumber(1) @MinNumber(1)
@MaxNumber(70) @MaxNumber(100)
@Desc("The angle at which the ravine widens as it gets closer to the surface") @Desc("The angle at which the ravine widens as it gets closer to the surface")
private double topAngle = 38; private double topAngle = 38;
@Desc("To fill this cave with lava, set the lava level to a height from the bottom most point of the cave.")
private int lavaLevel = -1;
@Desc("How many worm nodes must be placed to actually generate a ravine? Higher reduces the chances but also reduces ravine 'holes'") @Desc("How many worm nodes must be placed to actually generate a ravine? Higher reduces the chances but also reduces ravine 'holes'")
private int nodeThreshold = 5; private int nodeThreshold = 5;
@@ -88,93 +92,97 @@ 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, (byte) (water ? 1 : 0));
MatterCavern l = new MatterCavern(true, customBiome, (byte) 2);
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;
} }
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c); if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
}
else
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
}
} }
} }
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;
} }
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c); if(lavaLevel >= 0 && i <= lavaLevel + (surface - depthStyle.getMid()))
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, l);
}
else
{
writer.setElipsoid(p.getX(), i, p.getZ(), v, ribThickness, v, true, c);
}
} }
} }
} }

View File

@@ -0,0 +1,47 @@
/*
* 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.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.Snippet;
import com.volmit.iris.util.math.RNG;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Snippet("color")
@Accessors(chain = true)
@NoArgsConstructor
@Desc("Represents a color")
@Data
public class IrisSeed {
@Desc("The seed to use")
private long seed = 1337;
@Desc("To calculate a seed Iris passes in it's natural seed for the current feature, then mixes it with your seed. Setting this to true ignores the parent seed and always uses your exact seed ignoring the input of Iris feature seeds. You can use this to match seeds on other generators.")
private boolean ignoreNaturalSeedInput = false;
public long getSeed(long seed) {
return (seed * 47) + getSeed() + 29334667L;
}
public RNG rng(long inseed) {
return new RNG(getSeed(inseed));
}
}

View File

@@ -66,4 +66,8 @@ public class IrisShapedGeneratorStyle {
public boolean isFlat() { public boolean isFlat() {
return min == max || getGenerator().isFlat(); return min == max || getGenerator().isFlat();
} }
public int getMid() {
return (getMax() + getMin()) / 2;
}
} }

View File

@@ -46,7 +46,7 @@ public class IrisSphere implements IRare {
private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>(); private transient final AtomicCache<MatterCavern> matterNodeCache = new AtomicCache<>();
public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) { public void generate(RNG rng, Engine engine, MantleWriter writer, int x, int y, int z) {
writer.setSphere(x, y, z, radius.get(rng, z, y, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), false))); writer.setSphere(x, y, z, radius.get(rng, z, y, engine.getData()), true, matterNodeCache.aquire(() -> CavernMatter.get(getCustomBiome(), 0)));
} }
public double maxSize() { public double maxSize() {

View File

@@ -65,4 +65,8 @@ public class IrisStyledRange {
public boolean isFlat() { public boolean isFlat() {
return getMax() == getMin() || style.isFlat(); return getMax() == getMin() || style.isFlat();
} }
public int getMid() {
return (int) ((getMax() + getMin()) / 2);
}
} }

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;
@@ -93,7 +93,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
this.dimensionKey = dimensionKey; this.dimensionKey = dimensionKey;
this.folder = new ReactiveFolder(dataLocation, (_a, _b, _c) -> hotload()); this.folder = new ReactiveFolder(dataLocation, (_a, _b, _c) -> hotload());
setupEngine(); setupEngine();
this.hotloader = new Looper() { this.hotloader = studio ? new Looper() {
@Override @Override
protected long loop() { protected long loop() {
if (hotloadChecker.flip()) { if (hotloadChecker.flip()) {
@@ -102,10 +102,14 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
return 250; return 250;
} }
}; } : null;
hotloader.setPriority(Thread.MIN_PRIORITY);
hotloader.start(); if(studio)
hotloader.setName(getTarget().getWorld().name() + " Hotloader"); {
hotloader.setPriority(Thread.MIN_PRIORITY);
hotloader.start();
hotloader.setName(getTarget().getWorld().name() + " Hotloader");
}
} }
private void setupEngine() { private void setupEngine() {
@@ -117,7 +121,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
IrisDimension test = IrisData.loadAnyDimension(dimensionKey); IrisDimension test = IrisData.loadAnyDimension(dimensionKey);
if (test != null) { if (test != null) {
Iris.warn("Looks like " + dimensionKey + " exists in " + test.getLoadFile().getPath()); Iris.warn("Looks like " + dimensionKey + " exists in " + test.getLoadFile().getPath() + " ");
Iris.service(StudioSVC.class).installIntoWorld(Iris.getSender(), dimensionKey, dataLocation.getParentFile().getParentFile()); Iris.service(StudioSVC.class).installIntoWorld(Iris.getSender(), dimensionKey, dataLocation.getParentFile().getParentFile());
Iris.warn("Attempted to install into " + data.getDataFolder().getPath()); Iris.warn("Attempted to install into " + data.getDataFolder().getPath());
data.dump(); data.dump();
@@ -232,7 +236,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Override @Override
public void close() { public void close() {
withExclusiveControl(() -> { withExclusiveControl(() -> {
hotloader.interrupt(); if(isStudio())
{
hotloader.interrupt();
}
getEngine().close(); getEngine().close();
}); });
} }
@@ -244,6 +252,11 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
@Override @Override
public void hotload() { public void hotload() {
if(!isStudio())
{
return;
}
withExclusiveControl(() -> getEngine().hotload()); withExclusiveControl(() -> getEngine().hotload());
} }

View File

@@ -48,7 +48,7 @@ public class BoardManager {
this.plugin = plugin; this.plugin = plugin;
this.boardSettings = boardSettings; this.boardSettings = boardSettings;
this.scoreboards = new ConcurrentHashMap<>(); this.scoreboards = new ConcurrentHashMap<>();
this.updateTask = new BoardUpdateTask(this).runTaskTimer(plugin, 2L, 2L); this.updateTask = new BoardUpdateTask(this).runTaskTimer(plugin, 2L, 20L);
plugin.getServer().getOnlinePlayers().forEach(this::setup); plugin.getServer().getOnlinePlayers().forEach(this::setup);
} }

View File

@@ -22,9 +22,8 @@ import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisSettings; import com.volmit.iris.core.IrisSettings;
import com.volmit.iris.util.collection.KList; import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.scheduling.ChronoLatch; import com.volmit.iris.util.scheduling.ChronoLatch;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.ints.*;
import it.unimi.dsi.fastutil.ints.IntSet; import net.minecraft.world.level.levelgen.OreVeinifier;
import it.unimi.dsi.fastutil.ints.IntSets;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
@@ -43,6 +42,9 @@ public class B {
private static final Material AIR_MATERIAL = Material.AIR; private static final Material AIR_MATERIAL = Material.AIR;
private static final BlockData AIR = AIR_MATERIAL.createBlockData(); private static final BlockData AIR = AIR_MATERIAL.createBlockData();
private static final IntSet foliageCache = buildFoliageCache(); private static final IntSet foliageCache = buildFoliageCache();
private static final IntSet deepslateCache = buildDeepslateCache();
private static final Int2IntMap normal2DeepslateCache = buildNormal2DeepslateCache();
private static final Int2IntMap deepslate2NormalCache = buildNormal2DeepslateCache();
private static final IntSet decorantCache = buildDecorantCache(); private static final IntSet decorantCache = buildDecorantCache();
private static final IntSet storageCache = buildStorageCache(); private static final IntSet storageCache = buildStorageCache();
private static final IntSet storageChestCache = buildStorageChestCache(); private static final IntSet storageChestCache = buildStorageChestCache();
@@ -84,6 +86,54 @@ public class B {
return IntSets.unmodifiable(b); return IntSets.unmodifiable(b);
} }
private static IntSet buildDeepslateCache() {
IntSet b = new IntOpenHashSet();
Arrays.stream(new Material[]{
DEEPSLATE,
DEEPSLATE_BRICKS,
DEEPSLATE_BRICK_SLAB,
DEEPSLATE_BRICK_STAIRS,
DEEPSLATE_BRICK_WALL,
DEEPSLATE_TILE_SLAB,
DEEPSLATE_TILES,
DEEPSLATE_TILE_STAIRS,
DEEPSLATE_TILE_WALL,
CRACKED_DEEPSLATE_TILES
}).forEach((i) -> b.add(i.ordinal()));
return IntSets.unmodifiable(b);
}
private static Int2IntMap buildNormal2DeepslateCache() {
Int2IntMap b = new Int2IntOpenHashMap();
b.put(COAL_ORE.ordinal(), DEEPSLATE_COAL_ORE.ordinal());
b.put(EMERALD_ORE.ordinal(), DEEPSLATE_EMERALD_ORE.ordinal());
b.put(DIAMOND_ORE.ordinal(), DEEPSLATE_DIAMOND_ORE.ordinal());
b.put(COPPER_ORE.ordinal(), DEEPSLATE_COPPER_ORE.ordinal());
b.put(GOLD_ORE.ordinal(), DEEPSLATE_GOLD_ORE.ordinal());
b.put(IRON_ORE.ordinal(), DEEPSLATE_IRON_ORE.ordinal());
b.put(LAPIS_ORE.ordinal(), DEEPSLATE_LAPIS_ORE.ordinal());
b.put(REDSTONE_ORE.ordinal(), DEEPSLATE_REDSTONE_ORE.ordinal());
return b;
}
private static Int2IntMap buildDeepslate2NormalCache() {
Int2IntMap b = new Int2IntOpenHashMap();
b.put(DEEPSLATE_COAL_ORE.ordinal(), COAL_ORE.ordinal());
b.put(DEEPSLATE_EMERALD_ORE.ordinal(), EMERALD_ORE.ordinal());
b.put(DEEPSLATE_DIAMOND_ORE.ordinal(), DIAMOND_ORE.ordinal());
b.put(DEEPSLATE_COPPER_ORE.ordinal(), COPPER_ORE.ordinal());
b.put(DEEPSLATE_GOLD_ORE.ordinal(), GOLD_ORE.ordinal());
b.put(DEEPSLATE_IRON_ORE.ordinal(), IRON_ORE.ordinal());
b.put(DEEPSLATE_LAPIS_ORE.ordinal(), LAPIS_ORE.ordinal());
b.put(DEEPSLATE_REDSTONE_ORE.ordinal(), REDSTONE_ORE.ordinal());
return b;
}
private static IntSet buildDecorantCache() { private static IntSet buildDecorantCache() {
IntSet b = new IntOpenHashSet(); IntSet b = new IntOpenHashSet();
Arrays.stream(new Material[]{ Arrays.stream(new Material[]{
@@ -216,6 +266,32 @@ public class B {
return IntSets.unmodifiable(b); return IntSets.unmodifiable(b);
} }
public static BlockData toDeepSlateOre(BlockData block, BlockData ore) {
int key = ore.getMaterial().ordinal();
if(isDeepSlate(block))
{
if(normal2DeepslateCache.containsKey(key))
{
return Material.values()[normal2DeepslateCache.get(key)].createBlockData();
}
}
else
{
if(deepslate2NormalCache.containsKey(key))
{
return Material.values()[deepslate2NormalCache.get(key)].createBlockData();
}
}
return ore;
}
public static boolean isDeepSlate(BlockData blockData) {
return deepslateCache.contains(blockData.getMaterial().ordinal());
}
public static boolean isOre(BlockData blockData) { public static boolean isOre(BlockData blockData) {
return blockData.getMaterial().name().endsWith("_ORE"); return blockData.getMaterial().name().endsWith("_ORE");
} }

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

@@ -32,7 +32,7 @@ public class BiomeContextHandler implements DecreeContextHandler<IrisBiome> {
if (sender.isPlayer() if (sender.isPlayer()
&& IrisToolbelt.isIrisWorld(sender.player().getWorld()) && IrisToolbelt.isIrisWorld(sender.player().getWorld())
&& IrisToolbelt.access(sender.player().getWorld()).getEngine() != null) { && IrisToolbelt.access(sender.player().getWorld()).getEngine() != null) {
return IrisToolbelt.access(sender.player().getWorld()).getEngine().getBiome(sender.player().getLocation()); return IrisToolbelt.access(sender.player().getWorld()).getEngine().getBiomeOrMantle(sender.player().getLocation());
} }
return null; return null;

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()) {
{ 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

@@ -502,4 +502,8 @@ public class Mantle {
public void deleteChunkSlice(int x, int z, Class<?> c) { public void deleteChunkSlice(int x, int z, Class<?> c) {
getChunk(x, z).deleteSlices(c); getChunk(x, z).deleteSlices(c);
} }
public int getLoadedRegionCount() {
return loadedRegions.size();
}
} }

View File

@@ -26,5 +26,20 @@ import lombok.Data;
public class MatterCavern { public class MatterCavern {
private final boolean cavern; private final boolean cavern;
private final String customBiome; private final String customBiome;
private final boolean water; private final byte liquid; // 0 none 1 water 2 lava
public boolean isAir()
{
return liquid == 0;
}
public boolean isWater()
{
return liquid == 1;
}
public boolean isLava()
{
return liquid == 2;
}
} }

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

@@ -27,8 +27,8 @@ import java.io.IOException;
@Sliced @Sliced
public class CavernMatter extends RawMatter<MatterCavern> { public class CavernMatter extends RawMatter<MatterCavern> {
public static MatterCavern get(String customBiome, boolean underwater) { public static MatterCavern get(String customBiome, int liquid) {
return new MatterCavern(true, customBiome, underwater); return new MatterCavern(true, customBiome, (byte) liquid);
} }
public CavernMatter() { public CavernMatter() {
@@ -42,16 +42,16 @@ public class CavernMatter extends RawMatter<MatterCavern> {
@Override @Override
public void writeNode(MatterCavern b, DataOutputStream dos) throws IOException { public void writeNode(MatterCavern b, DataOutputStream dos) throws IOException {
dos.writeBoolean(b.isCavern()); dos.writeBoolean(b.isCavern());
dos.writeBoolean(b.isWater());
dos.writeUTF(b.getCustomBiome()); dos.writeUTF(b.getCustomBiome());
dos.writeByte(b.getLiquid());
} }
@Override @Override
public MatterCavern readNode(DataInputStream din) throws IOException { public MatterCavern readNode(DataInputStream din) throws IOException {
boolean b = din.readBoolean(); boolean b = din.readBoolean();
boolean w = din.readBoolean();
String v = din.readUTF(); String v = din.readUTF();
byte l = din.readByte();
return new MatterCavern(b, v, w); return new MatterCavern(b, v, l);
} }
} }

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;
} }