mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Fix imported feature height warning
- Warn on any height other than -64..320 - Point at disabled and disabledSteps to remove ores - Cover shorter worlds and the advice in tests
This commit is contained in:
2 files changed
+18
-4
No files matched your search
@@ -290,11 +290,13 @@ final class PackDimensionValidator {
|
||||
JSONObject height = resolveDimensionHeight(packFolder, dimension);
|
||||
int minY = height == null ? VANILLA_OVERWORLD_MIN_Y : (int) height.optDouble("min", 16D);
|
||||
int maxY = height == null ? VANILLA_OVERWORLD_MAX_Y : (int) height.optDouble("max", 32D);
|
||||
if (minY >= VANILLA_OVERWORLD_MIN_Y && maxY <= VANILLA_OVERWORLD_MAX_Y) {
|
||||
// Vanilla anchors ore bands to the world bottom and top, so any height other than -64..320 moves them.
|
||||
if (minY == VANILLA_OVERWORLD_MIN_Y && maxY == VANILLA_OVERWORLD_MAX_Y) {
|
||||
return;
|
||||
}
|
||||
warnings.add("Dimension '" + dimensionKey + "' runs importedFeatures in a " + minY + ".." + maxY
|
||||
+ " world. Vanilla ores shift with the height; limit them with importedFeatures.steps or disabled.");
|
||||
+ " world. Vanilla ores shift with the height; remove them with importedFeatures.disabled"
|
||||
+ " (minecraft:ore) or disabledSteps (UNDERGROUND_ORES).");
|
||||
}
|
||||
|
||||
static void validateStaticObjects(File packFolder, String dimensionKey, JSONObject dimension,
|
||||
|
||||
+14
-2
@@ -30,8 +30,20 @@ public class PackValidatorImportedFeatureHeightTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shorterWorldInsideVanillaBoundsStaysSilent() {
|
||||
assertTrue(validate(featuresEnabled(true).put("dimensionHeight", height(0, 256))).isEmpty());
|
||||
public void shorterWorldInsideVanillaBoundsWarns() {
|
||||
List<String> warnings = validate(featuresEnabled(true).put("dimensionHeight", height(0, 256)));
|
||||
|
||||
assertEquals(1, warnings.size());
|
||||
assertTrue(warnings.get(0), warnings.get(0).contains("in a 0..256 world"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void warningPointsAtTheSettingsThatRemoveOres() {
|
||||
String warning = validate(featuresEnabled(true).put("dimensionHeight", height(-256, 512))).get(0);
|
||||
|
||||
assertTrue(warning, warning.contains("importedFeatures.disabled"));
|
||||
assertTrue(warning, warning.contains("disabledSteps"));
|
||||
assertTrue(warning, !warning.contains("importedFeatures.steps"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user