diff options
| author | Danielshe <shekwancheung0528@gmail.com> | 2019-11-06 21:40:11 +0800 |
|---|---|---|
| committer | Danielshe <shekwancheung0528@gmail.com> | 2019-11-06 21:40:15 +0800 |
| commit | 0cc101e5cb57e62674abe421983444f79ea630fc (patch) | |
| tree | b3d1c4c1853a3e9d60ae2857e7aa1b5430f2f559 /src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java | |
| parent | d26cb24ffffc1e6063a2dd1053ccbc886c60767f (diff) | |
| download | RoughlyEnoughItems-0cc101e5cb57e62674abe421983444f79ea630fc.tar.gz RoughlyEnoughItems-0cc101e5cb57e62674abe421983444f79ea630fc.tar.bz2 RoughlyEnoughItems-0cc101e5cb57e62674abe421983444f79ea630fc.zip | |
3.2.6
Diffstat (limited to 'src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java index 37480fdd3..fd013ae51 100644 --- a/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java +++ b/src/main/java/me/shedaniel/rei/impl/RecipeHelperImpl.java @@ -251,14 +251,25 @@ public class RecipeHelperImpl implements RecipeHelper { Version reiVersion = FabricLoader.getInstance().getModContainer("roughlyenoughitems").get().getMetadata().getVersion(); if (!(reiVersion instanceof SemanticVersion)) RoughlyEnoughItemsCore.LOGGER.warn("[REI] Roughly Enough Items is not using semantic versioning, will be ignoring plugins' minimum versions!"); - plugins.forEach(plugin -> { + for (REIPluginEntry plugin : plugins) { + try { + if (reiVersion instanceof SemanticVersion) + if (plugin.getMinimumVersion().compareTo((SemanticVersion) reiVersion) > 0) { + throw new IllegalStateException("Requires " + plugin.getMinimumVersion().getFriendlyString() + " version of REI!"); + } + if (plugin instanceof REIPluginV0) + ((REIPluginV0) plugin).preRegister(); + } catch (Exception e) { + RoughlyEnoughItemsCore.LOGGER.error("[REI] " + plugin.getPluginIdentifier().toString() + " plugin failed to pre register!", e); + } + } + for (REIPluginEntry plugin : plugins) { Identifier identifier = plugin.getPluginIdentifier(); try { + if (reiVersion instanceof SemanticVersion) + if (plugin.getMinimumVersion().compareTo((SemanticVersion) reiVersion) > 0) + return; if (plugin instanceof REIPluginV0) { - if (reiVersion instanceof SemanticVersion) - if (((REIPluginV0) plugin).getMinimumVersion().compareTo((SemanticVersion) reiVersion) > 0) { - throw new IllegalStateException("Requires " + ((REIPluginV0) plugin).getMinimumVersion().getFriendlyString() + " version of REI!"); - } ((REIPluginV0) plugin).registerBounds(RoughlyEnoughItemsCore.getDisplayHelper()); ((REIPluginV0) plugin).registerEntries(RoughlyEnoughItemsCore.getEntryRegistry()); ((REIPluginV0) plugin).registerPluginCategories(this); @@ -270,7 +281,18 @@ public class RecipeHelperImpl implements RecipeHelper { } catch (Exception e) { RoughlyEnoughItemsCore.LOGGER.error("[REI] " + identifier.toString() + " plugin failed to load!", e); } - }); + } + for (REIPluginEntry plugin : plugins) { + try { + if (reiVersion instanceof SemanticVersion) + if (plugin.getMinimumVersion().compareTo((SemanticVersion) reiVersion) > 0) + return; + if (plugin instanceof REIPluginV0) + ((REIPluginV0) plugin).postRegister(); + } catch (Exception e) { + RoughlyEnoughItemsCore.LOGGER.error("[REI] " + plugin.getPluginIdentifier().toString() + " plugin failed to post register!", e); + } + } if (!recipeFunctions.isEmpty()) { List<Recipe> allSortedRecipes = getAllSortedRecipes(); Collections.reverse(allSortedRecipes); |
