forked from FabricMC/fabric-loom
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
157 additions
and
51 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/main/java/dev/architectury/loom/metadata/ForgeModsToml.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,29 @@ | ||
package dev.architectury.loom.metadata; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
|
||
import com.electronwill.nightconfig.core.Config; | ||
|
||
public final class ForgeModsToml extends ModsToml { | ||
private ForgeModsToml(Config config) { | ||
super(config); | ||
} | ||
|
||
public static ForgeModsToml of(byte[] utf8) { | ||
return of(utf8, ForgeModsToml::new); | ||
} | ||
|
||
public static ForgeModsToml of(String text) { | ||
return of(text, ForgeModsToml::new); | ||
} | ||
|
||
public static ForgeModsToml of(Path path) throws IOException { | ||
return of(path, ForgeModsToml::new); | ||
} | ||
|
||
public static ForgeModsToml of(File file) throws IOException { | ||
return of(file.toPath(), ForgeModsToml::new); | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
src/main/java/dev/architectury/loom/metadata/NeoForgeModsToml.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,47 @@ | ||
package dev.architectury.loom.metadata; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import com.electronwill.nightconfig.core.Config; | ||
import com.google.common.collect.ImmutableList; | ||
|
||
public final class NeoForgeModsToml extends ModsToml { | ||
private NeoForgeModsToml(Config config) { | ||
super(config); | ||
} | ||
|
||
public static NeoForgeModsToml of(byte[] utf8) { | ||
return of(utf8, NeoForgeModsToml::new); | ||
} | ||
|
||
public static NeoForgeModsToml of(String text) { | ||
return of(text, NeoForgeModsToml::new); | ||
} | ||
|
||
public static NeoForgeModsToml of(Path path) throws IOException { | ||
return of(path, NeoForgeModsToml::new); | ||
} | ||
|
||
public static NeoForgeModsToml of(File file) throws IOException { | ||
return of(file.toPath(), NeoForgeModsToml::new); | ||
} | ||
|
||
@Override | ||
public List<String> getMixinConfigs() { | ||
Optional<List<Config>> mixins = config.getOptional("mixins"); | ||
if (mixins.isEmpty()) return List.of(); | ||
|
||
final ImmutableList.Builder<String> configs = ImmutableList.builder(); | ||
|
||
for (final Config mixin : mixins.get()) { | ||
final Optional<String> config = mixin.getOptional("config"); | ||
config.ifPresent(configs::add); | ||
} | ||
|
||
return configs.build(); | ||
} | ||
} |
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
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
Oops, something went wrong.