mirror of
https://github.com/GTNewHorizons/ModTweaker.git
synced 2026-11-20 04:19:44 +00:00
Changes in ReflectionHelper
This commit is contained in:
1 parent
17d9b78930
commit
6bf0797054
13 files changed
+115
-143
No files matched your search
@@ -2,9 +2,9 @@ package modtweaker2.mods.factorization;
|
||||
|
||||
import static modtweaker2.helpers.ReflectionHelper.getStaticObject;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.List;
|
||||
|
||||
import modtweaker2.helpers.ReflectionHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class FactorizationHelper {
|
||||
@@ -22,36 +22,30 @@ public class FactorizationHelper {
|
||||
|
||||
private FactorizationHelper() {}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Object getLaceratorRecipe(ItemStack input, ItemStack output, float probability) {
|
||||
try {
|
||||
Class clazz = Class.forName("factorization.oreprocessing.TileEntityGrinder$GrinderRecipe");
|
||||
Constructor constructor = clazz.getDeclaredConstructor(Object.class, ItemStack.class, float.class);
|
||||
constructor.setAccessible(true);
|
||||
return constructor.newInstance(input, output, probability);
|
||||
} catch (Exception e) {
|
||||
throw new NullPointerException("Failed to instantiate Lacerator Recipe");
|
||||
}
|
||||
return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntityGrinder$GrinderRecipe", Object.class, ItemStack.class, float.class),
|
||||
input,
|
||||
output,
|
||||
probability);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Object getSlagFurnaceRecipe(ItemStack input, float chance1, ItemStack output1, float chance2, ItemStack output2) {
|
||||
try {
|
||||
Class clazz = Class.forName("factorization.oreprocessing.TileEntitySlagFurnace$SmeltingResult");
|
||||
Constructor constructor = clazz.getDeclaredConstructor(ItemStack.class, float.class, ItemStack.class, float.class, ItemStack.class);
|
||||
constructor.setAccessible(true);
|
||||
return constructor.newInstance(input, chance1, output1, chance2, output2);
|
||||
} catch (Exception e) {
|
||||
throw new NullPointerException("Failed to instantiate SmeltingResult");
|
||||
}
|
||||
return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntitySlagFurnace$SmeltingResult", ItemStack.class, float.class, ItemStack.class, float.class, ItemStack.class),
|
||||
input,
|
||||
chance1,
|
||||
output1,
|
||||
chance2,
|
||||
output2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Object getCrystallizerRecipe(ItemStack input, ItemStack output, ItemStack solution, float output_count) {
|
||||
try {
|
||||
Class clazz = Class.forName("factorization.oreprocessing.TileEntityCrystallizer$CrystalRecipe");
|
||||
Constructor constructor = clazz.getDeclaredConstructor(ItemStack.class, ItemStack.class, float.class, ItemStack.class);
|
||||
constructor.setAccessible(true);
|
||||
return constructor.newInstance(input, output, output_count, solution);
|
||||
} catch (Exception e) {
|
||||
throw new NullPointerException("Failed to instantiate CrystalRecipe");
|
||||
}
|
||||
return ReflectionHelper.getInstance(ReflectionHelper.getConstructor("factorization.oreprocessing.TileEntityCrystallizer$CrystalRecipe", ItemStack.class, ItemStack.class, float.class, ItemStack.class),
|
||||
input,
|
||||
output,
|
||||
output_count,
|
||||
solution);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user