-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix named attributes in legacy failing when reading back data from Mo…
…dule Metadata (#225)
- Loading branch information
Showing
8 changed files
with
138 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 10 additions & 2 deletions
12
...gacy/java/net/neoforged/moddevgradle/legacyforge/internal/MappingsDisambiguationRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 4 additions & 10 deletions
14
src/legacy/java/net/neoforged/moddevgradle/legacyforge/internal/MinecraftMappings.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,13 @@ | ||
package net.neoforged.moddevgradle.legacyforge.internal; | ||
|
||
import java.util.Locale; | ||
import org.gradle.api.Named; | ||
import org.gradle.api.attributes.Attribute; | ||
import org.jetbrains.annotations.ApiStatus; | ||
|
||
@ApiStatus.Internal | ||
public enum MinecraftMappings implements Named { | ||
NAMED, | ||
SRG; | ||
public interface MinecraftMappings extends Named { | ||
String NAMED = "named"; | ||
String SRG = "srg"; | ||
|
||
public static final Attribute<MinecraftMappings> ATTRIBUTE = Attribute.of("net.neoforged.moddevgradle.legacy.minecraft_mappings", MinecraftMappings.class); | ||
|
||
@Override | ||
public String getName() { | ||
return name().toLowerCase(Locale.ROOT); | ||
} | ||
Attribute<MinecraftMappings> ATTRIBUTE = Attribute.of("net.neoforged.moddevgradle.legacy.minecraft_mappings", MinecraftMappings.class); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/legacy/java/net/neoforged/moddevgradle/legacyforge/internal/SrgMappingsRule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package net.neoforged.moddevgradle.legacyforge.internal; | ||
|
||
import javax.inject.Inject; | ||
import org.gradle.api.artifacts.ComponentMetadataContext; | ||
import org.gradle.api.artifacts.ComponentMetadataRule; | ||
|
||
public class SrgMappingsRule implements ComponentMetadataRule { | ||
private final MinecraftMappings srgMappings; | ||
|
||
@Inject | ||
public SrgMappingsRule(MinecraftMappings srgMappings) { | ||
this.srgMappings = srgMappings; | ||
} | ||
|
||
@Override | ||
public void execute(ComponentMetadataContext context) { | ||
context.getDetails().allVariants(variant -> { | ||
if (variant.getAttributes().contains(MinecraftMappings.ATTRIBUTE)) { | ||
return; | ||
} | ||
|
||
variant.getAttributes().attribute(MinecraftMappings.ATTRIBUTE, srgMappings); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.