Improve multiverse similarity logic and fix incorrect log

This commit is contained in:
James Seibel
2023-11-21 07:43:46 -06:00
parent 7e869105cb
commit 9c918c7bbb
2 changed files with 6 additions and 3 deletions
@@ -57,7 +57,7 @@ public class SubDimCompare implements Comparable<SubDimCompare>
}
/** returns a number between 0 (no equal datapoint) and 1 (totally equal) */
public double getPercentEqual() { return (double) equalDataPoints / (double) totalDataPoints; }
public double getPercentEqual() { return (double) this.equalDataPoints / (double) this.totalDataPoints; }
@Override
@@ -66,7 +66,7 @@ public class SubDimCompare implements Comparable<SubDimCompare>
if (this.equalDataPoints != other.equalDataPoints)
{
// compare based on data points
return Integer.compare(this.equalDataPoints, other.equalDataPoints);
return Double.compare(this.getPercentEqual(), other.getPercentEqual());
}
else
{
@@ -83,4 +83,7 @@ public class SubDimCompare implements Comparable<SubDimCompare>
|| this.playerPosDist <= MAX_SIMILAR_PLAYER_POS_DISTANCE_IN_BLOCKS;
}
@Override
public String toString() { return this.equalDataPoints + "/" + this.totalDataPoints + ": " + this.getPercentEqual() + " playerPos: " + this.playerPosDist; }
}
@@ -332,7 +332,7 @@ public class SubDimensionLevelMatcher implements AutoCloseable
String subDimShortName = LodUtil.shortenString(testLevelFolder.getName(), 8); // variables are separated out for easier debugging
String equalPercent = LodUtil.shortenString(subDimCompare.getPercentEqual()+"", 5);
String equalPercent = LodUtil.shortenString(mostSimilarSubDim.getPercentEqual()+"", 5);
LOGGER.info("Sub dimension ["+subDimShortName+"...] is current dimension probability: "+equalPercent+" ("+equalDataPoints+"/"+totalDataPointCount+")");
}
catch (Exception e)