Skip logoFile warning if bannerFile or iconFile is present (#3413)

This commit is contained in:
sciwhiz12 2026-08-18 18:30:44 +08:00 committed by GitHub
parent 880646025f
commit 62ac9fd4d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -25,7 +25,17 @@ public class LogoFileWarningsHandler {
var logoFile = info.getLogoFile()
.or(() -> info.getOwningFile().getConfig().getConfigElement("logoFile"));
if (logoFile.isPresent()) {
// If logoFile is not set, there is nothing to warn about
if (logoFile.isEmpty()) return;
var bannerFile = info.getConfig().getConfigElement("bannerFile")
.or(() -> info.getOwningFile().getConfig().getConfigElement("bannerFile"));
// See DefaultModDisplayInfo#icon()
var iconFile = info.getConfig().getConfigElement("iconFile")
.or(() -> info.getOwningFile().getConfig().getConfigElement("iconFile"));
// Skip warning if bannerFile or iconFile is present, since it means the developer consciously kept the old property (for multi-version compat)
if (bannerFile.isEmpty() && iconFile.isEmpty()) {
// This shouldn't need to be translated, as it will only ever show for developers
//noinspection UnstableApiUsage
ModLoader.addLoadingIssue(ModLoadingIssue.warning("Mod %s uses the deprecated `logoFile` property; change to `bannerFile` and/or (for square icons) `iconFile`", info.getModId()).withAffectedMod(info));