diff --git a/src/main/java/com/volmit/iris/generator/IrisComplex.java b/src/main/java/com/volmit/iris/generator/IrisComplex.java index 689c1615d..0cb68431b 100644 --- a/src/main/java/com/volmit/iris/generator/IrisComplex.java +++ b/src/main/java/com/volmit/iris/generator/IrisComplex.java @@ -128,12 +128,12 @@ public class IrisComplex implements DataProvider { Interpolated.of(a -> 0D, a -> focusRegion)) : engine.getDimension().getRegionStyle().create(rng.nextParallelRNG(883)).stream() .zoom(engine.getDimension().getRegionZoom()) - .selectRarity(engine.getDimension().getRegions()) + .selectRarity(engine.getDimension().getRegions(), (i) -> data.getRegionLoader().load(i)) .convertCached((s) -> data.getRegionLoader().load(s)).cache2D(cacheSize); caveBiomeStream = regionStream.convert((r) -> engine.getDimension().getCaveBiomeStyle().create(rng.nextParallelRNG(1221)).stream() .zoom(r.getCaveBiomeZoom()) - .selectRarity(r.getCaveBiomes()) + .selectRarity(r.getCaveBiomes(), (i) -> data.getBiomeLoader().load(i)) .onNull("") .convertCached((s) -> { if (s.isEmpty()) { @@ -147,7 +147,7 @@ public class IrisComplex implements DataProvider { landBiomeStream = regionStream.convert((r) -> engine.getDimension().getLandBiomeStyle().create(rng.nextParallelRNG(234234234)).stream() .zoom(r.getLandBiomeZoom()) - .selectRarity(r.getLandBiomes()) + .selectRarity(r.getLandBiomes(), (i) -> data.getBiomeLoader().load(i)) .convertCached((s) -> data.getBiomeLoader().load(s) .setInferredType(InferredType.LAND)) ).convertAware2D(ProceduralStream::get) @@ -155,7 +155,7 @@ public class IrisComplex implements DataProvider { seaBiomeStream = regionStream.convert((r) -> engine.getDimension().getSeaBiomeStyle().create(rng.nextParallelRNG(11232323)).stream() .zoom(r.getSeaBiomeZoom()) - .selectRarity(r.getSeaBiomes()) + .selectRarity(r.getSeaBiomes(), (i) -> data.getBiomeLoader().load(i)) .convertCached((s) -> data.getBiomeLoader().load(s) .setInferredType(InferredType.SEA)) ).convertAware2D(ProceduralStream::get) @@ -163,7 +163,7 @@ public class IrisComplex implements DataProvider { shoreBiomeStream = regionStream.convert((r) -> engine.getDimension().getShoreBiomeStyle().create(rng.nextParallelRNG(7787845)).stream() .zoom(r.getShoreBiomeZoom()) - .selectRarity(r.getShoreBiomes()) + .selectRarity(r.getShoreBiomes(), (i) -> data.getBiomeLoader().load(i)) .convertCached((s) -> data.getBiomeLoader().load(s) .setInferredType(InferredType.SHORE)) ).convertAware2D(ProceduralStream::get).cache2D(cacheSize); diff --git a/src/main/java/com/volmit/iris/manager/command/studio/CommandIrisStudioGoto.java b/src/main/java/com/volmit/iris/manager/command/studio/CommandIrisStudioGoto.java index f6edbc2ab..2fdd04213 100644 --- a/src/main/java/com/volmit/iris/manager/command/studio/CommandIrisStudioGoto.java +++ b/src/main/java/com/volmit/iris/manager/command/studio/CommandIrisStudioGoto.java @@ -76,7 +76,6 @@ public class CommandIrisStudioGoto extends MortarCommand { IrisAccess g = IrisWorlds.access(world); IrisBiome b = IrisDataManager.loadAnyBiome(args[0]); IrisRegion r = IrisDataManager.loadAnyRegion(args[0]); - IrisObject o = IrisDataManager.loadAnyObject(args[0]); if (b != null) { J.a(() -> { @@ -101,28 +100,6 @@ public class CommandIrisStudioGoto extends MortarCommand { } }); } - /* TODO: Fix this shit - else if (o != null) - { - // Get all object names - for (File f : listf( Iris.instance.getDataFolders + "/objects")){ - - } - J.a(() -> { - Location l = g.lookForObject(o, 60000, (v) -> sender.sendMessage(C.BOLD +""+ C.WHITE + o.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places")); - - if(l == null) - { - sender.sendMessage("Couldn't find " + o.getName() + "."); - } - - else - { - sender.sendMessage("Found " + o.getName() + "!"); - J.s(() -> sender.player().teleport(l)); - } - }); - }*/ else { sender.sendMessage(args[0] + " is not a biome or region in this dimension. (Biome teleportation works best!"); diff --git a/src/main/java/com/volmit/iris/scaffold/stream/ProceduralStream.java b/src/main/java/com/volmit/iris/scaffold/stream/ProceduralStream.java index 27e3da96e..2034df11f 100644 --- a/src/main/java/com/volmit/iris/scaffold/stream/ProceduralStream.java +++ b/src/main/java/com/volmit/iris/scaffold/stream/ProceduralStream.java @@ -301,8 +301,22 @@ public interface ProceduralStream extends ProceduralLayer, Interpolated { } for (V i : types) { - rarityTypes.addMultiple(i, totalRarity / IRare.get(i)); - } + rarityTypes.addMultiple(i, totalRarity / IRare.get(i)); + } + + return new SelectionStream(this, rarityTypes); + } + + default ProceduralStream selectRarity(List types, Function loader) { + KList rarityTypes = new KList<>(); + int totalRarity = 0; + for (V i : types) { + totalRarity += IRare.get(loader.apply(i)); + } + + for (V i : types) { + rarityTypes.addMultiple(i, totalRarity / IRare.get(loader.apply(i))); + } return new SelectionStream(this, rarityTypes); } diff --git a/src/main/java/com/volmit/iris/util/ResourceLoader.java b/src/main/java/com/volmit/iris/util/ResourceLoader.java index 166a419e2..71b76140c 100644 --- a/src/main/java/com/volmit/iris/util/ResourceLoader.java +++ b/src/main/java/com/volmit/iris/util/ResourceLoader.java @@ -124,6 +124,23 @@ public class ResourceLoader { } } + public KList loadAll(KList s) + { + KList m = new KList<>(); + + for(String i : s) + { + T t = load(i); + + if(t != null) + { + m.add(t); + } + } + + return m; + } + public T load(String name) { return load(name, true); }