Skip to content

Commit

Permalink
Fix #173 Allow recipe types to be specified by interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Feb 20, 2016
1 parent b90925a commit 28866e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
6 changes: 5 additions & 1 deletion changelog.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h2>2.27.3</h2>
<h2>2.28.0</h2>
<h4>Features:</h4>
<ul>
<li>Show JEI description pages last.</li>
Expand All @@ -8,6 +8,10 @@ <h4>Fixes:</h4>
<ul>
<li>Make search option names more clear.</li>
</ul>
<h4>API:</h4>
<ul>
<li>Allow recipe types to be specified by interfaces.</li>
</ul>
<br/>
<hr/>
<h2>2.27.2</h2>
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ mcp_mappings=snapshot_20160219
curse_project_id=238222

version_major=2
version_minor=27
version_patch=3
version_minor=28
version_patch=0
9 changes: 5 additions & 4 deletions src/main/java/mezz/jei/RecipeRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,13 @@ public IRecipeHandler getRecipeHandler(@Nullable Class recipeClass) {
return null;
}

IRecipeHandler recipeHandler;
while ((recipeHandler = recipeHandlers.get(recipeClass)) == null && (recipeClass != Object.class)) {
recipeClass = recipeClass.getSuperclass();
for (Class<?> handledClass : recipeHandlers.keySet()) {
if (handledClass.isAssignableFrom(recipeClass)) {
return recipeHandlers.get(handledClass);
}
}

return recipeHandler;
return null;
}

@Nullable
Expand Down

0 comments on commit 28866e5

Please sign in to comment.