mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 02:03:59 +00:00
Cleanup sources
This commit is contained in:
parent
51a056b3d7
commit
43d7dfde4c
@ -22,7 +22,6 @@ import com.volmit.iris.core.*;
|
||||
import com.volmit.iris.core.command.CommandIris;
|
||||
import com.volmit.iris.core.command.PermissionIris;
|
||||
import com.volmit.iris.core.command.world.CommandLocate;
|
||||
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
|
||||
import com.volmit.iris.core.link.IrisPapiExpansion;
|
||||
import com.volmit.iris.core.link.MultiverseCoreLink;
|
||||
import com.volmit.iris.core.link.OraxenLink;
|
||||
|
@ -30,7 +30,6 @@ import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.plugin.MortarCommand;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class CommandIrisStudioExplorerGenerator extends MortarCommand {
|
||||
@ -73,7 +72,6 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand {
|
||||
}
|
||||
|
||||
|
||||
|
||||
Supplier<Function2<Double, Double, Double>> l = () -> {
|
||||
long seed = 12345;
|
||||
IrisGenerator generator;
|
||||
@ -84,8 +82,7 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand {
|
||||
generator = IrisData.loadAnyGenerator(args[0]);
|
||||
}
|
||||
|
||||
if(generator == null)
|
||||
{
|
||||
if (generator == null) {
|
||||
return (x, z) -> 0D;
|
||||
}
|
||||
|
||||
@ -94,7 +91,6 @@ public class CommandIrisStudioExplorerGenerator extends MortarCommand {
|
||||
};
|
||||
|
||||
|
||||
|
||||
NoiseExplorerGUI.launch(l, "Custom Generator");
|
||||
|
||||
return true;
|
||||
|
@ -42,7 +42,6 @@ import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, Listener {
|
||||
@ -108,8 +107,7 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void on(IrisEngineHotloadEvent e)
|
||||
{
|
||||
public void on(IrisEngineHotloadEvent e) {
|
||||
generator = loader.get();
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,7 @@ public class ResourceLoader<T extends IrisRegistrant> {
|
||||
}
|
||||
}
|
||||
|
||||
public Stream<T> streamAll(Stream<String> s)
|
||||
{
|
||||
public Stream<T> streamAll(Stream<String> s) {
|
||||
return s.map(this::load);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
}
|
||||
|
||||
for (int ig = 0; ig < data.get(i).size() / 8; ig++) {
|
||||
Chunk c = data.get(i).getRandom();
|
||||
Chunk c = data.get(i).getRandom();
|
||||
IrisBiome biome = getEngine().getSurfaceBiome(c);
|
||||
IrisRegion region = getEngine().getRegion(c);
|
||||
spawnIn(c, biome, region, i, maxGroups);
|
||||
@ -111,25 +111,25 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
||||
|
||||
//@builder
|
||||
spawnRandomly(Stream.concat(Stream.concat(
|
||||
getData().getSpawnerLoader()
|
||||
.loadAll(getDimension().getEntitySpawners())
|
||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn),
|
||||
getData().getSpawnerLoader().streamAll(getEngine().getFramework().getEngineParallax()
|
||||
.getFeaturesInChunk(c).stream()
|
||||
.flatMap((o) -> o.getFeature().getEntitySpawners().stream()))
|
||||
.filter(this::canSpawn))
|
||||
.filter((i) -> i.isValid(biome))
|
||||
.flatMap(this::stream),
|
||||
Stream.concat(getData().getSpawnerLoader()
|
||||
.loadAll(getEngine().getRegion(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
||||
.flatMap(this::stream),
|
||||
getData().getSpawnerLoader()
|
||||
.loadAll(getEngine().getSurfaceBiome(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
||||
.flatMap(this::stream)))
|
||||
.collect(Collectors.toList()))
|
||||
.popRandom(RNG.r, max).forEach((i) -> spawn(c, id, i));
|
||||
getData().getSpawnerLoader()
|
||||
.loadAll(getDimension().getEntitySpawners())
|
||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn),
|
||||
getData().getSpawnerLoader().streamAll(getEngine().getFramework().getEngineParallax()
|
||||
.getFeaturesInChunk(c).stream()
|
||||
.flatMap((o) -> o.getFeature().getEntitySpawners().stream()))
|
||||
.filter(this::canSpawn))
|
||||
.filter((i) -> i.isValid(biome))
|
||||
.flatMap(this::stream),
|
||||
Stream.concat(getData().getSpawnerLoader()
|
||||
.loadAll(getEngine().getRegion(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
||||
.flatMap(this::stream),
|
||||
getData().getSpawnerLoader()
|
||||
.loadAll(getEngine().getSurfaceBiome(c.getX() << 4, c.getZ() << 4).getEntitySpawners())
|
||||
.shuffleCopy(RNG.r).stream().filter(this::canSpawn)
|
||||
.flatMap(this::stream)))
|
||||
.collect(Collectors.toList()))
|
||||
.popRandom(RNG.r, max).forEach((i) -> spawn(c, id, i));
|
||||
//@done
|
||||
}
|
||||
|
||||
|
@ -413,13 +413,11 @@ public interface Engine extends DataProvider, Fallible, GeneratorAccess, LootPro
|
||||
|
||||
IrisEngineData getEngineData();
|
||||
|
||||
default IrisBiome getSurfaceBiome(Chunk c)
|
||||
{
|
||||
return getSurfaceBiome((c.getX()<<4) + 8, (c.getZ()<<4) + 8);
|
||||
default IrisBiome getSurfaceBiome(Chunk c) {
|
||||
return getSurfaceBiome((c.getX() << 4) + 8, (c.getZ() << 4) + 8);
|
||||
}
|
||||
|
||||
default IrisRegion getRegion(Chunk c)
|
||||
{
|
||||
return getRegion((c.getX()<<4) + 8, (c.getZ()<<4) + 8);
|
||||
default IrisRegion getRegion(Chunk c) {
|
||||
return getRegion((c.getX() << 4) + 8, (c.getZ() << 4) + 8);
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,6 @@ import com.volmit.iris.engine.cache.Cache;
|
||||
import com.volmit.iris.engine.data.B;
|
||||
import com.volmit.iris.engine.data.DataProvider;
|
||||
import com.volmit.iris.engine.hunk.Hunk;
|
||||
import com.volmit.iris.engine.interpolation.InterpolationMethod;
|
||||
import com.volmit.iris.engine.jigsaw.PlannedStructure;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||
@ -198,18 +197,17 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(int x, int z)
|
||||
{
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(int x, int z) {
|
||||
KList<IrisFeaturePositional> pos = new KList<>();
|
||||
|
||||
for (IrisFeaturePositional i : getEngine().getDimension().getSpecificFeatures()) {
|
||||
if (i.shouldFilter((x<<4) + 8, (z<<4) + 8, getEngine().getFramework().getComplex().getRng(), getData())) {
|
||||
if (i.shouldFilter((x << 4) + 8, (z << 4) + 8, getEngine().getFramework().getComplex().getRng(), getData())) {
|
||||
pos.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (IrisFeaturePositional i : getParallaxAccess().getMetaR(x, z).getFeatures()) {
|
||||
if (i.shouldFilter((x<<4) + 8, (z<<4) + 8, getEngine().getFramework().getComplex().getRng(), getData())) {
|
||||
if (i.shouldFilter((x << 4) + 8, (z << 4) + 8, getEngine().getFramework().getComplex().getRng(), getData())) {
|
||||
pos.add(i);
|
||||
}
|
||||
}
|
||||
@ -567,8 +565,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
|
||||
}, null, getData());
|
||||
|
||||
if(p.usesFeatures())
|
||||
{
|
||||
if (p.usesFeatures()) {
|
||||
if (p.isVacuum()) {
|
||||
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
||||
double a = Math.max(v.getW(), v.getD());
|
||||
@ -588,8 +585,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
rw.getFeatures().add(new IrisFeaturePositional(xx, zz, f));
|
||||
}
|
||||
|
||||
for(IrisFeaturePotential j : p.getAddFeatures())
|
||||
{
|
||||
for (IrisFeaturePotential j : p.getAddFeatures()) {
|
||||
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
||||
double a = Math.max(v.getW(), v.getD());
|
||||
|
||||
@ -629,8 +625,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
|
||||
}, null, getData());
|
||||
|
||||
if(objectPlacement.usesFeatures())
|
||||
{
|
||||
if (objectPlacement.usesFeatures()) {
|
||||
if (objectPlacement.isVacuum()) {
|
||||
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
||||
double a = Math.max(v.getW(), v.getD());
|
||||
@ -650,8 +645,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
rw.getFeatures().add(new IrisFeaturePositional(xx, zz, f));
|
||||
}
|
||||
|
||||
for(IrisFeaturePotential j : objectPlacement.getAddFeatures())
|
||||
{
|
||||
for (IrisFeaturePotential j : objectPlacement.getAddFeatures()) {
|
||||
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
||||
double a = Math.max(v.getW(), v.getD());
|
||||
|
||||
@ -952,8 +946,7 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(Chunk c)
|
||||
{
|
||||
default KList<IrisFeaturePositional> getFeaturesInChunk(Chunk c) {
|
||||
return getFeaturesInChunk(c.getX(), c.getZ());
|
||||
}
|
||||
}
|
||||
|
@ -21,11 +21,9 @@ package com.volmit.iris.engine.object;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.engine.IrisComplex;
|
||||
import com.volmit.iris.engine.cache.AtomicCache;
|
||||
import com.volmit.iris.engine.data.B;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.EngineFramework;
|
||||
import com.volmit.iris.engine.modifier.IrisCaveModifier;
|
||||
import com.volmit.iris.engine.modifier.IrisPostModifier;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||
@ -41,14 +39,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.block.data.type.Slab;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.potion.PotionType;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@ -87,9 +78,8 @@ public class IrisEntitySpawn implements IRare {
|
||||
int z = (c.getZ() * 16) + rng.i(15);
|
||||
int h = gen.getHeight(x, z, true);
|
||||
int hf = gen.getHeight(x, z, false);
|
||||
Location l = switch(getReferenceSpawner().getGroup())
|
||||
{
|
||||
case NORMAL -> new Location(c.getWorld(), x, hf+1, z);
|
||||
Location l = switch (getReferenceSpawner().getGroup()) {
|
||||
case NORMAL -> new Location(c.getWorld(), x, hf + 1, z);
|
||||
case CAVE -> {
|
||||
IrisComplex comp = gen.getFramework().getComplex();
|
||||
EngineFramework frame = gen.getFramework();
|
||||
@ -97,7 +87,7 @@ public class IrisEntitySpawn implements IRare {
|
||||
KList<Location> r = new KList<>();
|
||||
if (cave != null) {
|
||||
for (CaveResult i : ((IrisCaveModifier) frame.getCaveModifier()).genCaves(x, z)) {
|
||||
if (i.getCeiling() >= gen.getHeight() || i.getFloor() < 0 || i.getCeiling()-2 <= i.getFloor()) {
|
||||
if (i.getCeiling() >= gen.getHeight() || i.getFloor() < 0 || i.getCeiling() - 2 <= i.getFloor()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -108,18 +98,17 @@ public class IrisEntitySpawn implements IRare {
|
||||
yield r.getRandom(rng);
|
||||
}
|
||||
|
||||
case UNDERWATER, BEACH -> new Location(c.getWorld(), x, rng.i(h+1, hf), z);
|
||||
case UNDERWATER, BEACH -> new Location(c.getWorld(), x, rng.i(h + 1, hf), z);
|
||||
};
|
||||
|
||||
if(l != null)
|
||||
{
|
||||
if (l != null) {
|
||||
spawn100(gen, l);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return s>0;
|
||||
return s > 0;
|
||||
}
|
||||
|
||||
public IrisEntity getRealEntity(Engine g) {
|
||||
|
@ -218,8 +218,7 @@ public class IrisObjectPlacement {
|
||||
return getMode().equals(ObjectPlaceMode.VACUUM);
|
||||
}
|
||||
|
||||
public boolean usesFeatures()
|
||||
{
|
||||
public boolean usesFeatures() {
|
||||
return isVacuum() || getAddFeatures().isNotEmpty();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -52,24 +51,22 @@ public class IrisSpawner extends IrisRegistrant {
|
||||
@Desc("Where should these spawns be placed")
|
||||
private IrisSpawnGroup group = IrisSpawnGroup.NORMAL;
|
||||
|
||||
public boolean isValid(IrisBiome biome)
|
||||
{
|
||||
return switch (group)
|
||||
{
|
||||
case NORMAL -> switch(biome.getInferredType()) {
|
||||
case SHORE, SEA, CAVE, RIVER, LAKE, DEFER -> false;
|
||||
case LAND -> true;
|
||||
};
|
||||
case CAVE -> true;
|
||||
case UNDERWATER -> switch(biome.getInferredType()) {
|
||||
case SHORE, LAND, CAVE, RIVER, LAKE, DEFER -> false;
|
||||
case SEA -> true;
|
||||
};
|
||||
case BEACH -> switch(biome.getInferredType()) {
|
||||
case SHORE -> true;
|
||||
case LAND, CAVE, RIVER, LAKE, SEA, DEFER -> false;
|
||||
};
|
||||
};
|
||||
public boolean isValid(IrisBiome biome) {
|
||||
return switch (group) {
|
||||
case NORMAL -> switch (biome.getInferredType()) {
|
||||
case SHORE, SEA, CAVE, RIVER, LAKE, DEFER -> false;
|
||||
case LAND -> true;
|
||||
};
|
||||
case CAVE -> true;
|
||||
case UNDERWATER -> switch (biome.getInferredType()) {
|
||||
case SHORE, LAND, CAVE, RIVER, LAKE, DEFER -> false;
|
||||
case SEA -> true;
|
||||
};
|
||||
case BEACH -> switch (biome.getInferredType()) {
|
||||
case SHORE -> true;
|
||||
case LAND, CAVE, RIVER, LAKE, SEA, DEFER -> false;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
public boolean isValid(World world) {
|
||||
|
@ -114,8 +114,7 @@ public class RNG extends Random {
|
||||
}
|
||||
|
||||
public double d(double lowerBound, double upperBound) {
|
||||
if(lowerBound > upperBound)
|
||||
{
|
||||
if (lowerBound > upperBound) {
|
||||
return M.lerp(upperBound, lowerBound, nextDouble());
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user