Merge pull request #198 from Zixxl/master

Last bugfixes for 0.9.1
This commit is contained in:
Zixxl 2015-07-20 09:10:55 +02:00
commit 6fbca2547f
6 changed files with 19 additions and 21 deletions

View file

@ -17,7 +17,7 @@ buildscript {
apply plugin: 'forge'
version = "0.9.0"
version = "0.9.1"
group= "modtweaker" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "ModTweaker~2"

View file

@ -4,6 +4,6 @@ public class ModProps {
public static final String NAME = "Mod Tweaker 2", name = NAME;
public static final String MODID = "modtweaker2", modid = MODID;
public static final String VERSION = "0.9.0", version = VERSION;
public static final String VERSION = "0.9.1", version = VERSION;
public static final String DEPENDENCIES = "required-after:MineTweaker3", dependencies = DEPENDENCIES;
}

View file

@ -41,16 +41,14 @@ public class InputHelper {
public static IItemStack[] toStacks(IIngredient[] iIngredient) {
ArrayList<IItemStack> stacks = new ArrayList<IItemStack>();
for (IIngredient ing : iIngredient) {
for (IItemStack stack : ing.getItems()) {
stacks.add(stack);
}
}
IItemStack[] returnArray = new IItemStack[stacks.size()];
for(int i = 0; i < returnArray.length;i++){
returnArray[i] = stacks.get(i);
}
return returnArray;
return stacks.toArray(new IItemStack[stacks.size()]);
}
public static boolean isABlock(ItemStack block) {
@ -62,11 +60,11 @@ public class InputHelper {
}
public static ItemStack toStack(IItemStack iStack) {
if (iStack == null)
if (iStack == null) {
return null;
else {
} else {
Object internal = iStack.getInternal();
if (internal == null || !(internal instanceof ItemStack)) {
if (!(internal instanceof ItemStack)) {
LogHelper.logError("Not a valid item stack: " + iStack);
}
@ -79,8 +77,9 @@ public class InputHelper {
}
public static IIngredient toIngredient(FluidStack stack) {
if(stack == null)
if(stack == null) {
return null;
}
return new MCLiquidStack(stack);
}
@ -102,9 +101,9 @@ public class InputHelper {
}
public static ItemStack[] toStacks(IItemStack[] iStack) {
if (iStack == null)
if (iStack == null) {
return null;
else {
} else {
ItemStack[] output = new ItemStack[iStack.length];
for (int i = 0; i < iStack.length; i++) {
output[i] = toStack(iStack[i]);

View file

@ -53,7 +53,7 @@ public class ReflectionHelper {
Constructor<T> constructor = clazz.getDeclaredConstructor(types);
constructor.setAccessible(true);
return constructor;
} catch (Exception ex) { LogHelper.logError("Exception getting constructore of " + clazz.getName(), ex); }
} catch (Exception ex) { LogHelper.logError("Exception getting constructor of " + clazz.getName(), ex); }
return null;
}
@ -73,7 +73,7 @@ public class ReflectionHelper {
Field result = cls.getDeclaredField(field);
result.setAccessible(true);
return (T) result.get(object);
} catch (Exception ex) {}
} catch (Exception ex) { LogHelper.logError("Exception in getObject()", ex); }
}
LogHelper.logError("Could not retrieve any object for the provided field names.");
@ -99,7 +99,7 @@ public class ReflectionHelper {
modifiersField.setAccessible(true);
modifiersField.setInt(result, result.getModifiers() & ~Modifier.FINAL);
return (T) result.get(object);
} catch (Exception ex) {}
} catch (Exception ex) { LogHelper.logError("Exception in getFinalObject()", ex); }
}
LogHelper.logError("Could not retrieve any final object for the provided field names.");
@ -120,7 +120,7 @@ public class ReflectionHelper {
Field result = clazz.getDeclaredField(field);
result.setAccessible(true);
return (T) result.get(null);
} catch (Exception e) {}
} catch (Exception e) { LogHelper.logError("Exception in getStaticObject()", e); }
}
LogHelper.logError("Could not retrieve any static object for the provided field names.");
@ -138,7 +138,7 @@ public class ReflectionHelper {
try {
Class<?> clazz = Class.forName(className);
return getStaticObject(clazz, fieldNames);
} catch (ClassNotFoundException e) { }
} catch (ClassNotFoundException e) { LogHelper.logError("Exception in getStaticObject()", e); }
LogHelper.logError("Could not retrieve any static object for the provided field names.");
@ -150,7 +150,7 @@ public class ReflectionHelper {
Field f = cls.getDeclaredField(field);
f.setAccessible(true);
f.setInt(null, var);
} catch (Exception e) {}
} catch (Exception e) { LogHelper.logError("Exception in setPrivateValue()", e); }
}
@SuppressWarnings({ "rawtypes", "unchecked" })

View file

@ -52,6 +52,7 @@ public class Infuser {
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings({ "unchecked", "rawtypes" })
@ZenMethod
public static void removeRecipe(IIngredient itemOutput, @Optional IIngredient itemInput, @Optional String infuseType) {
if(itemOutput == null) {
LogHelper.logError(String.format("Required parameters missing for %s Recipe.", name));

View file

@ -12,12 +12,10 @@ import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.research.ResearchCategories;
public class ThaumcraftHelper {
public static ArrayList recipes = null;
public static HashMap<Object, Integer> warpList;
static {
try {
recipes = ReflectionHelper.getStaticObject(ThaumcraftApi.class, "recipes");
warpList = ReflectionHelper.getStaticObject(ThaumcraftApi.class, "warpMap");
} catch (Exception e) {}
}