Skip to content

Commit

Permalink
Prefer entry points over custom entries for Early Risers
Browse files Browse the repository at this point in the history
Now that they are filled much earlier reliably, they can be used instead
  • Loading branch information
Chocohead committed Feb 13, 2020
1 parent fa896f5 commit 9547496
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
4 changes: 1 addition & 3 deletions example/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
"entrypoints": {
"main": [
"com.chocohead.mm.testing.ExampleMod"
]
},
"custom": {
],
"mm:early_risers": [
"com.chocohead.mm.testing.EarlyRiser"
]
Expand Down
9 changes: 4 additions & 5 deletions src/com/chocohead/mm/Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,13 @@ public String getRefMapperConfig() {
}

@Override
@SuppressWarnings("deprecation") //Not removed in the last Loader version we support
public List<String> getMixins() {
//System.out.println("Have " + mixins);
//Entry points are only created once the game starts, which is way too late if we want to be transforming the game
//FabricLoader.getInstance().getEntrypoints("mm:early_riser", Runnable.class).forEach(Runnable::run);
FabricLoader.getInstance().getEntrypoints("mm:early_risers", Runnable.class).forEach(Runnable::run);
for (ModContainer mod : FabricLoader.getInstance().getAllMods()) {
if (mod.getMetadata().containsCustomElement("mm:early_risers")) {
for (JsonElement riser : mod.getMetadata().getCustomElement("mm:early_risers").getAsJsonArray()) {
if (mod.getMetadata().containsCustomValue("mm:early_risers")) {
System.out.println(mod.getMetadata().getName() + " is still using the traditional Early Riser initialisation");
for (CustomValue riser : mod.getMetadata().getCustomValue("mm:early_risers").getAsArray()) {
try {
Class.forName(riser.getAsString()).asSubclass(Runnable.class).newInstance().run();
} catch (ReflectiveOperationException e) {
Expand Down

0 comments on commit 9547496

Please sign in to comment.