BracketHandler for thaumcraft aspects

This commit is contained in:
Zixxl committed 2015-07-20 10:14:18 +02:00
1 parent db9b0e3c11
commit 99bd8eaa1e
10 files changed
+420 -18

No files matched your search

@@ -4,7 +4,12 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import minetweaker.api.item.IItemStack;
import modtweaker2.helpers.LogHelper;
import modtweaker2.helpers.ReflectionHelper;
import modtweaker2.mods.thaumcraft.aspect.AspectStack;
import modtweaker2.mods.thaumcraft.aspect.IAspectStack;
import net.minecraft.item.ItemStack;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.ThaumcraftApi.EntityTags;
import thaumcraft.api.aspects.Aspect;
@@ -103,4 +108,30 @@ public class ThaumcraftHelper {
}
return output;
}
public static AspectStack[] toStacks(IAspectStack[] iStack) {
if (iStack == null) {
return null;
} else {
AspectStack[] output = new AspectStack[iStack.length];
for (int i = 0; i < iStack.length; i++) {
output[i] = toStack(iStack[i]);
}
return output;
}
}
public static AspectStack toStack(IAspectStack iStack) {
if (iStack == null) {
return null;
} else {
Object internal = iStack.getInternal();
if (!(internal instanceof AspectStack)) {
LogHelper.logError("Not a valid aspect stack: " + iStack);
}
return (AspectStack) internal;
}
}
}