mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 14:52:58 +00:00
Finish the Recipe generics port
This commit is contained in:
1 parent
99df6a3926
commit
8861e52abf
2 files changed
+10
-9
No files matched your search
@@ -34,6 +34,7 @@ public class IMCHandler {
|
||||
message.equalsIgnoreCase(type.getOldRecipeName() + "Recipe")) {
|
||||
MachineInput input = type.createInput(msg.getNBTValue());
|
||||
if (input != null && input.isValid()) {
|
||||
@SuppressWarnings("unchecked")
|
||||
MachineRecipe recipe = type.createRecipe(input, msg.getNBTValue());
|
||||
if (recipe != null && recipe.recipeOutput != null) {
|
||||
if (delete) {
|
||||
|
||||
@@ -640,9 +640,9 @@ public final class RecipeHandler {
|
||||
@Nonnull
|
||||
private final String jeiCategory;
|
||||
|
||||
private Class<? extends MachineInput> inputClass;
|
||||
private Class<? extends MachineOutput> outputClass;
|
||||
private Class<? extends MachineRecipe> recipeClass;
|
||||
private Class<INPUT> inputClass;
|
||||
private Class<OUTPUT> outputClass;
|
||||
private Class<RECIPE> recipeClass;
|
||||
|
||||
|
||||
private Recipe(String name, String oldName, Class<INPUT> input, Class<OUTPUT> output, Class<RECIPE> recipe) {
|
||||
@@ -681,9 +681,9 @@ public final class RecipeHandler {
|
||||
@Nullable
|
||||
public INPUT createInput(NBTTagCompound nbtTags) {
|
||||
try {
|
||||
MachineInput input = inputClass.newInstance();
|
||||
INPUT input = inputClass.newInstance();
|
||||
input.load(nbtTags);
|
||||
return (INPUT) input;
|
||||
return input;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
@@ -695,11 +695,11 @@ public final class RecipeHandler {
|
||||
MachineOutput output = outputClass.newInstance();
|
||||
output.load(nbtTags);
|
||||
try {
|
||||
Constructor<? extends MachineRecipe> construct = recipeClass.getDeclaredConstructor(inputClass, outputClass);
|
||||
return (RECIPE) construct.newInstance(input, output);
|
||||
Constructor<RECIPE> construct = recipeClass.getDeclaredConstructor(inputClass, outputClass);
|
||||
return construct.newInstance(input, output);
|
||||
} catch (Exception e) {
|
||||
Constructor<? extends MachineRecipe> construct = recipeClass.getDeclaredConstructor(inputClass, outputClass, NBTTagCompound.class);
|
||||
return (RECIPE) construct.newInstance(input, output, nbtTags);
|
||||
Constructor<RECIPE> construct = recipeClass.getDeclaredConstructor(inputClass, outputClass, NBTTagCompound.class);
|
||||
return construct.newInstance(input, output, nbtTags);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user