mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Fix Rarity, Strings do not implement IRare
This commit is contained in:
parent
2da8ffb8cd
commit
eef548f6a1
@ -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);
|
||||
|
@ -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!");
|
||||
|
@ -301,8 +301,22 @@ public interface ProceduralStream<T> extends ProceduralLayer, Interpolated<T> {
|
||||
}
|
||||
|
||||
for (V i : types) {
|
||||
rarityTypes.addMultiple(i, totalRarity / IRare.get(i));
|
||||
}
|
||||
rarityTypes.addMultiple(i, totalRarity / IRare.get(i));
|
||||
}
|
||||
|
||||
return new SelectionStream<V>(this, rarityTypes);
|
||||
}
|
||||
|
||||
default <V> ProceduralStream<V> selectRarity(List<V> types, Function<V, IRare> loader) {
|
||||
KList<V> 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<V>(this, rarityTypes);
|
||||
}
|
||||
|
@ -124,6 +124,23 @@ public class ResourceLoader<T extends IrisRegistrant> {
|
||||
}
|
||||
}
|
||||
|
||||
public KList<T> loadAll(KList<String> s)
|
||||
{
|
||||
KList<T> 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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user