mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-01 07:25:51 +00:00
Merge branch 'dev' into feat/byte_buddy
# Conflicts: # build.gradle.kts # core/build.gradle.kts # core/src/main/java/com/volmit/iris/Iris.java
This commit is contained in:
commit
d537459c5a
@ -105,7 +105,7 @@ nmsBindings.forEach { key, value ->
|
||||
systemProperty("disable.watchdog", "")
|
||||
systemProperty("net.kyori.ansi.colorLevel", color)
|
||||
systemProperty("com.mojang.eula.agree", true)
|
||||
systemProperty("iris.errorReporting", errorReporting)
|
||||
systemProperty("iris.suppressReporting", !errorReporting)
|
||||
jvmArgs("-javaagent:${project(":core:agent").tasks.jar.flatMap { it.archiveFile }.get().asFile.absolutePath}")
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,9 @@ dependencies {
|
||||
compileOnly("com.willfp:EcoItems:5.44.0")
|
||||
compileOnly("io.lumine:Mythic-Dist:5.2.1")
|
||||
compileOnly("io.lumine:MythicCrucible-Dist:2.0.0")
|
||||
compileOnly("me.kryniowesegryderiusz:kgenerators-core:7.3") {
|
||||
isTransitive = false
|
||||
}
|
||||
//implementation files("libs/CustomItems.jar")
|
||||
|
||||
// Shaded
|
||||
|
@ -804,7 +804,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
if (dimension == null) dimension = IrisData.loadAnyDimension(id);
|
||||
if (dimension == null) {
|
||||
Iris.warn("Unable to find dimension type " + id + " Looking for online packs...");
|
||||
Iris.service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, true);
|
||||
Iris.service(StudioSVC.class).downloadSearch(new VolmitSender(Bukkit.getConsoleSender()), id, false);
|
||||
dimension = IrisData.loadAnyDimension(id);
|
||||
|
||||
if (dimension != null) {
|
||||
@ -957,7 +957,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
|
||||
private static void setupSentry() {
|
||||
var settings = IrisSettings.get().getSentry();
|
||||
if (settings.disableAutoReporting || Sentry.isEnabled() || !Boolean.getBoolean("iris.errorReporting")) return;
|
||||
if (settings.disableAutoReporting || Sentry.isEnabled() || Boolean.getBoolean("iris.suppressReporting")) return;
|
||||
Iris.info("Enabling Sentry for anonymous error reporting. You can disable this in the settings.");
|
||||
Iris.info("Your server ID is: " + ServerID.ID);
|
||||
Sentry.init(options -> {
|
||||
|
@ -0,0 +1,88 @@
|
||||
package com.volmit.iris.core.link;
|
||||
|
||||
import com.volmit.iris.core.service.ExternalDataSVC;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.data.B;
|
||||
import com.volmit.iris.util.data.IrisCustomData;
|
||||
import me.kryniowesegryderiusz.kgenerators.Main;
|
||||
import me.kryniowesegryderiusz.kgenerators.api.KGeneratorsAPI;
|
||||
import me.kryniowesegryderiusz.kgenerators.generators.locations.objects.GeneratorLocation;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.MissingResourceException;
|
||||
|
||||
public class KGeneratorsDataProvider extends ExternalDataProvider {
|
||||
public KGeneratorsDataProvider() {
|
||||
super("KGenerators");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull BlockData getBlockData(@NotNull Identifier blockId, @NotNull KMap<String, String> state) throws MissingResourceException {
|
||||
if (Main.getGenerators().get(blockId.key()) == null) throw new MissingResourceException("Failed to find BlockData!", blockId.namespace(), blockId.key());
|
||||
return new IrisCustomData(Material.STRUCTURE_VOID.createBlockData(), ExternalDataSVC.buildState(blockId, state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemStack getItemStack(@NotNull Identifier itemId, @NotNull KMap<String, Object> customNbt) throws MissingResourceException {
|
||||
var gen = Main.getGenerators().get(itemId.key());
|
||||
if (gen == null) throw new MissingResourceException("Failed to find ItemData!", itemId.namespace(), itemId.key());
|
||||
return gen.getGeneratorItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processUpdate(@NotNull Engine engine, @NotNull Block block, @NotNull Identifier blockId) {
|
||||
if (block.getType() != Material.STRUCTURE_VOID) return;
|
||||
var existing = KGeneratorsAPI.getLoadedGeneratorLocation(block.getLocation());
|
||||
if (existing != null) return;
|
||||
block.setBlockData(B.getAir(), false);
|
||||
var gen = Main.getGenerators().get(blockId.key());
|
||||
if (gen == null) return;
|
||||
var loc = new GeneratorLocation(-1, gen, block.getLocation(), Main.getPlacedGenerators().getChunkInfo(block.getChunk()), null, null);
|
||||
Main.getDatabases().getDb().saveGenerator(loc);
|
||||
Main.getPlacedGenerators().addLoaded(loc);
|
||||
Main.getSchedules().schedule(loc, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Identifier[] getBlockTypes() {
|
||||
return Main.getGenerators().getAll().stream()
|
||||
.map(gen -> new Identifier("kgenerators", gen.getId()))
|
||||
.filter(i -> {
|
||||
try {
|
||||
return getBlockData(i) != null;
|
||||
} catch (MissingResourceException e) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.toArray(Identifier[]::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Identifier[] getItemTypes() {
|
||||
return Main.getGenerators().getAll().stream()
|
||||
.map(gen -> new Identifier("kgenerators", gen.getId()))
|
||||
.filter(i -> {
|
||||
try {
|
||||
return getItemStack(i) != null;
|
||||
} catch (MissingResourceException e) {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
.toArray(Identifier[]::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidProvider(@NotNull Identifier id, boolean isItem) {
|
||||
return "kgenerators".equalsIgnoreCase(id.namespace());
|
||||
}
|
||||
}
|
@ -377,17 +377,17 @@ public class IrisProject {
|
||||
KSet<IrisLootTable> loot = new KSet<>();
|
||||
KSet<IrisBlockData> blocks = new KSet<>();
|
||||
|
||||
for (String i : dm.getDimensionLoader().getPossibleKeys()) {
|
||||
for (String i : dm.getBlockLoader().getPossibleKeys()) {
|
||||
blocks.add(dm.getBlockLoader().load(i));
|
||||
}
|
||||
|
||||
dimension.getRegions().forEach((i) -> regions.add(dm.getRegionLoader().load(i)));
|
||||
dimension.getLoot().getTables().forEach((i) -> loot.add(dm.getLootLoader().load(i)));
|
||||
regions.forEach((i) -> biomes.addAll(i.getAllBiomes(null)));
|
||||
regions.forEach((i) -> biomes.addAll(i.getAllBiomes(() -> dm)));
|
||||
regions.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(dm.getLootLoader().load(i))));
|
||||
regions.forEach((r) -> r.getEntitySpawners().forEach((sp) -> spawners.add(dm.getSpawnerLoader().load(sp))));
|
||||
dimension.getEntitySpawners().forEach((sp) -> spawners.add(dm.getSpawnerLoader().load(sp)));
|
||||
biomes.forEach((i) -> i.getGenerators().forEach((j) -> generators.add(j.getCachedGenerator(null))));
|
||||
biomes.forEach((i) -> i.getGenerators().forEach((j) -> generators.add(j.getCachedGenerator(() -> dm))));
|
||||
biomes.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(dm.getLootLoader().load(i))));
|
||||
biomes.forEach((r) -> r.getEntitySpawners().forEach((sp) -> spawners.add(dm.getSpawnerLoader().load(sp))));
|
||||
spawners.forEach((i) -> i.getSpawns().forEach((j) -> entities.add(dm.getEntityLoader().load(j.getEntity()))));
|
||||
|
@ -75,6 +75,10 @@ public class ExternalDataSVC implements IrisService {
|
||||
if (Bukkit.getPluginManager().getPlugin("EcoItems") != null) {
|
||||
Iris.info("EcoItems found, loading EcoItemsDataProvider...");
|
||||
}
|
||||
providers.add(new KGeneratorsDataProvider());
|
||||
if (Bukkit.getPluginManager().getPlugin("KGenerators") != null) {
|
||||
Iris.info("KGenerators found, loading KGeneratorsDataProvider...");
|
||||
}
|
||||
|
||||
for (ExternalDataProvider p : providers) {
|
||||
if (p.isReady()) {
|
||||
|
@ -66,14 +66,12 @@ public class IrisCave extends IrisRegistrant {
|
||||
}
|
||||
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z) {
|
||||
generate(writer, rng, engine, x, y, z, 0, -1);
|
||||
generate(writer, rng, engine, x, y, z, 0, -1, true);
|
||||
}
|
||||
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int recursion, int waterHint) {
|
||||
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int recursion, int waterHint, boolean breakSurface) {
|
||||
double girth = getWorm().getGirth().get(rng, x, z, engine.getData());
|
||||
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, (at) -> {
|
||||
});
|
||||
KList<IrisPosition> points = getWorm().generate(rng, engine.getData(), writer, verticalRange, x, y, z, breakSurface, girth + 9);
|
||||
int highestWater = Math.max(waterHint, -1);
|
||||
|
||||
if (highestWater == -1) {
|
||||
|
@ -86,17 +86,13 @@ public class IrisCavePlacer implements IRare {
|
||||
}
|
||||
|
||||
if (y == -1) {
|
||||
if(!breakSurface) {
|
||||
int eH = engine.getHeight(x, z);
|
||||
if (caveStartHeight.getMax() > eH) {
|
||||
caveStartHeight.setMax(eH);
|
||||
}
|
||||
}
|
||||
y = (int) caveStartHeight.get(rng, x, z, data);
|
||||
int h = (int) caveStartHeight.get(rng, x, z, data);
|
||||
int ma = breakSurface ? h : (int) (engine.getComplex().getHeightStream().get(x, z) - 9);
|
||||
y = Math.min(h, ma);
|
||||
}
|
||||
|
||||
try {
|
||||
cave.generate(mantle, rng, engine, x + rng.nextInt(15), y, z + rng.nextInt(15), recursion, waterHint);
|
||||
cave.generate(mantle, rng, engine, x + rng.nextInt(15), y, z + rng.nextInt(15), recursion, waterHint, breakSurface);
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
fail.set(true);
|
||||
|
@ -97,8 +97,7 @@ public class IrisRavine extends IrisRegistrant {
|
||||
}
|
||||
|
||||
public void generate(MantleWriter writer, RNG rng, Engine engine, int x, int y, int z, int recursion, 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, true, 0);
|
||||
CNG dg = depthStyle.getGenerator().createNoCache(rng, engine.getData());
|
||||
CNG bw = baseWidthStyle.getGenerator().createNoCache(rng, engine.getData());
|
||||
int highestWater = Math.max(waterHint, -1);
|
||||
|
@ -62,7 +62,7 @@ public class IrisWorm {
|
||||
private IrisStyledRange girth = new IrisStyledRange().setMin(3).setMax(5)
|
||||
.setStyle(new IrisGeneratorStyle(NoiseStyle.PERLIN));
|
||||
|
||||
public KList<IrisPosition> generate(RNG rng, IrisData data, MantleWriter writer, IrisRange verticalRange, int x, int y, int z, Consumer<IrisPosition> fork) {
|
||||
public KList<IrisPosition> generate(RNG rng, IrisData data, MantleWriter writer, IrisRange verticalRange, int x, int y, int z, boolean breakSurface, double distance) {
|
||||
int itr = maxIterations;
|
||||
double jx, jy, jz;
|
||||
double cx = x;
|
||||
@ -72,12 +72,11 @@ public class IrisWorm {
|
||||
KList<IrisPosition> pos = new KList<>();
|
||||
KSet<IrisPosition> check = allowLoops ? null : new KSet<>();
|
||||
CNG gx = xStyle.getGenerator().createNoCache(new RNG(rng.lmax()), data);
|
||||
CNG gy = xStyle.getGenerator().createNoCache(new RNG(rng.lmax()), data);
|
||||
CNG gz = xStyle.getGenerator().createNoCache(new RNG(rng.lmax()), data);
|
||||
CNG gy = yStyle.getGenerator().createNoCache(new RNG(rng.lmax()), data);
|
||||
CNG gz = zStyle.getGenerator().createNoCache(new RNG(rng.lmax()), data);
|
||||
|
||||
while (itr-- > 0) {
|
||||
IrisPosition current = new IrisPosition(Math.round(cx), Math.round(cy), Math.round(cz));
|
||||
fork.accept(current);
|
||||
pos.add(current);
|
||||
|
||||
if (check != null) {
|
||||
@ -92,6 +91,10 @@ public class IrisWorm {
|
||||
cz += jz;
|
||||
IrisPosition next = new IrisPosition(Math.round(cx), Math.round(cy), Math.round(cz));
|
||||
|
||||
if (!breakSurface && writer.getEngineMantle().getHighest(next.getX(), next.getZ(), true) <= next.getY() + distance) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (verticalRange != null && !verticalRange.contains(next.getY())) {
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user