mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-02-16 10:30:53 +00:00
rename IrisJigsawDistance to IrisJigsawMinDistance to avoid confusion
This commit is contained in:
@@ -92,7 +92,7 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
KSet<Position2> cachedRegions, KMap<String, KSet<Position2>> cache, KMap<Position2, Double> distanceCache) {
|
||||
for (IrisJigsawStructurePlacement i : structures) {
|
||||
if (rng.nextInt(i.getRarity()) == 0) {
|
||||
if (checkDistances(i.collectDistances(), x, z, cachedRegions, cache, distanceCache))
|
||||
if (checkMinDistances(i.collectMinDistances(), x, z, cachedRegions, cache, distanceCache))
|
||||
continue;
|
||||
IrisPosition position = new IrisPosition((x << 4) + rng.nextInt(15), 0, (z << 4) + rng.nextInt(15));
|
||||
IrisJigsawStructure structure = getData().getJigsawStructureLoader().load(i.getStructure());
|
||||
@@ -104,9 +104,9 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
}
|
||||
|
||||
@ChunkCoordinates
|
||||
private boolean checkDistances(KMap<String, Integer> distances, int x, int z, KSet<Position2> cachedRegions, KMap<String, KSet<Position2>> cache, KMap<Position2, Double> distanceCache) {
|
||||
private boolean checkMinDistances(KMap<String, Integer> minDistances, int x, int z, KSet<Position2> cachedRegions, KMap<String, KSet<Position2>> cache, KMap<Position2, Double> distanceCache) {
|
||||
int range = 0;
|
||||
for (int d : distances.values())
|
||||
for (int d : minDistances.values())
|
||||
range = Math.max(range, d);
|
||||
|
||||
for (int xx = -range; xx <= range; xx++) {
|
||||
@@ -122,9 +122,9 @@ public class MantleJigsawComponent extends IrisMantleComponent {
|
||||
}
|
||||
}
|
||||
Position2 pos = new Position2(x, z);
|
||||
for (String structure : distances.keySet()) {
|
||||
for (String structure : minDistances.keySet()) {
|
||||
if (!cache.containsKey(structure)) continue;
|
||||
double minDist = distances.get(structure);
|
||||
double minDist = minDistances.get(structure);
|
||||
minDist = minDist * minDist;
|
||||
for (Position2 sPos : cache.get(structure)) {
|
||||
double dist = distanceCache.computeIfAbsent(sPos, position2 -> position2.distance(pos));
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.volmit.iris.engine.object;
|
||||
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.MaxNumber;
|
||||
import com.volmit.iris.engine.object.annotations.MinNumber;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListResource;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
@@ -11,13 +10,13 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Snippet("jigsaw-structure-distance")
|
||||
@Snippet("jigsaw-structure-min-distance")
|
||||
@Accessors(chain = true)
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Desc("Represents the min distance between jigsaw structure placements")
|
||||
@Data
|
||||
public class IrisJigsawDistance {
|
||||
public class IrisJigsawMinDistance {
|
||||
@Required
|
||||
@RegistryListResource(IrisJigsawStructure.class)
|
||||
@Desc("The structure to check against")
|
||||
@@ -25,7 +24,6 @@ public class IrisJigsawDistance {
|
||||
|
||||
@Required
|
||||
@MinNumber(0)
|
||||
@MaxNumber(5000)
|
||||
@Desc("The min distance in blocks to a placed structure\nWARNING: The performance impact scales exponentially!")
|
||||
private int distance;
|
||||
}
|
||||
@@ -49,13 +49,13 @@ public class IrisJigsawStructurePlacement {
|
||||
@Desc("The 1 in X chance rarity")
|
||||
private int rarity = 100;
|
||||
|
||||
@ArrayType(type = IrisJigsawDistance.class)
|
||||
@Desc("List of distances to check for")
|
||||
private KList<IrisJigsawDistance> distances = new KList<>();
|
||||
@ArrayType(type = IrisJigsawMinDistance.class)
|
||||
@Desc("List of minimum distances to check for")
|
||||
private KList<IrisJigsawMinDistance> minDistances = new KList<>();
|
||||
|
||||
public KMap<String, Integer> collectDistances() {
|
||||
public KMap<String, Integer> collectMinDistances() {
|
||||
KMap<String, Integer> map = new KMap<>();
|
||||
for (IrisJigsawDistance d : distances) {
|
||||
for (IrisJigsawMinDistance d : minDistances) {
|
||||
map.compute(d.getStructure(), (k, v) -> v != null ? Math.min(toChunks(d.getDistance()), v) : toChunks(d.getDistance()));
|
||||
}
|
||||
return map;
|
||||
|
||||
Reference in New Issue
Block a user