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