generated from tilera/1710mod
fix: infusion crafting api
This commit is contained in:
parent
465e6922b9
commit
ee27c10e77
|
@ -24,7 +24,7 @@ apply from: './gradle/scripts/mixins.gradle'
|
|||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
|
||||
version = "1.4.1"
|
||||
version = "1.4.2"
|
||||
group= "dev.tilera"
|
||||
archivesBaseName = "auracore"
|
||||
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
package dev.tilera.auracore.api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import dev.tilera.auracore.api.crafting.CrucibleRecipe;
|
||||
import dev.tilera.auracore.api.crafting.IInfusionRecipe;
|
||||
import dev.tilera.auracore.api.crafting.ShapedInfusionCraftingRecipe;
|
||||
import dev.tilera.auracore.api.crafting.ShapelessInfusionCraftingRecipe;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.tiles.TileCrucible;
|
||||
|
@ -88,4 +93,72 @@ public class AuracoreRecipes {
|
|||
return infusionRecipes;
|
||||
}
|
||||
|
||||
public static void addInfusionCraftingRecipe(String key, String research, int cost, AspectList tags, ItemStack result, Object ... ingredients) {
|
||||
int var9;
|
||||
String var3 = "";
|
||||
int var4 = 0;
|
||||
int var5 = 0;
|
||||
int var6 = 0;
|
||||
if (ingredients[var4] instanceof String[]) {
|
||||
String[] var7;
|
||||
String[] var8 = var7 = (String[])ingredients[var4++];
|
||||
var9 = var7.length;
|
||||
for (int var10 = 0; var10 < var9; ++var10) {
|
||||
String var11 = var8[var10];
|
||||
++var6;
|
||||
var5 = var11.length();
|
||||
var3 = var3 + var11;
|
||||
}
|
||||
} else {
|
||||
while (ingredients[var4] instanceof String) {
|
||||
String var13 = (String)ingredients[var4++];
|
||||
++var6;
|
||||
var5 = var13.length();
|
||||
var3 = var3 + var13;
|
||||
}
|
||||
}
|
||||
HashMap<Character, ItemStack> var14 = new HashMap<Character, ItemStack>();
|
||||
while (var4 < ingredients.length) {
|
||||
Character var16 = (Character)ingredients[var4];
|
||||
ItemStack var17 = null;
|
||||
if (ingredients[var4 + 1] instanceof Item) {
|
||||
var17 = new ItemStack((Item)ingredients[var4 + 1]);
|
||||
} else if (ingredients[var4 + 1] instanceof Block) {
|
||||
var17 = new ItemStack((Block)ingredients[var4 + 1], 1, -1);
|
||||
} else if (ingredients[var4 + 1] instanceof ItemStack) {
|
||||
var17 = (ItemStack)ingredients[var4 + 1];
|
||||
}
|
||||
var14.put(var16, var17);
|
||||
var4 += 2;
|
||||
}
|
||||
ItemStack[] var15 = new ItemStack[var5 * var6];
|
||||
for (var9 = 0; var9 < var5 * var6; ++var9) {
|
||||
char var18 = var3.charAt(var9);
|
||||
var15[var9] = var14.containsKey(Character.valueOf(var18)) ? ((ItemStack)var14.get(Character.valueOf(var18))).copy() : null;
|
||||
}
|
||||
infusionRecipes.add(new ShapedInfusionCraftingRecipe(key, research, var5, var6, var15, result, cost, tags));
|
||||
}
|
||||
|
||||
public static void addShapelessInfusionCraftingRecipe(String key, String research, int cost, AspectList tags, ItemStack result, Object ... ingredients) {
|
||||
ArrayList<ItemStack> var3 = new ArrayList<ItemStack>();
|
||||
Object[] var4 = ingredients;
|
||||
int var5 = ingredients.length;
|
||||
for (int var6 = 0; var6 < var5; ++var6) {
|
||||
Object var7 = var4[var6];
|
||||
if (var7 instanceof ItemStack) {
|
||||
var3.add(((ItemStack)var7).copy());
|
||||
continue;
|
||||
}
|
||||
if (var7 instanceof Item) {
|
||||
var3.add(new ItemStack((Item)var7));
|
||||
continue;
|
||||
}
|
||||
if (!(var7 instanceof Block)) {
|
||||
throw new RuntimeException("Invalid shapeless recipe!");
|
||||
}
|
||||
var3.add(new ItemStack((Block)var7));
|
||||
}
|
||||
infusionRecipes.add(new ShapelessInfusionCraftingRecipe(key, research, result, var3, cost, tags));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ public class ShapedInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
public int recipeWidth;
|
||||
public int recipeHeight;
|
||||
public String key;
|
||||
public String research;
|
||||
public int cost;
|
||||
public AspectList tags;
|
||||
public ItemStack[] recipeItems;
|
||||
|
@ -23,13 +24,14 @@ public class ShapedInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
return this.key;
|
||||
}
|
||||
|
||||
public ShapedInfusionCraftingRecipe(String key, int par1, int par2, ItemStack[] par3ArrayOfItemStack, ItemStack par4ItemStack, int cost, AspectList tags) {
|
||||
public ShapedInfusionCraftingRecipe(String key, String research, int par1, int par2, ItemStack[] par3ArrayOfItemStack, ItemStack par4ItemStack, int cost, AspectList tags) {
|
||||
this.recipeOutputItem = par4ItemStack.getItem();
|
||||
this.recipeWidth = par1;
|
||||
this.recipeHeight = par2;
|
||||
this.recipeItems = par3ArrayOfItemStack;
|
||||
this.recipeOutput = par4ItemStack;
|
||||
this.key = key;
|
||||
this.research = research;
|
||||
this.cost = cost;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
@ -41,7 +43,7 @@ public class ShapedInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
|
||||
@Override
|
||||
public boolean matches(IInventory par1InventoryCrafting, World world, EntityPlayer player) {
|
||||
if (this.key.length() > 0 && !ThaumcraftApiHelper.isResearchComplete(player.getDisplayName(), this.key)) {
|
||||
if (this.research.length() > 0 && !ThaumcraftApiHelper.isResearchComplete(player.getDisplayName(), this.research)) {
|
||||
return false;
|
||||
}
|
||||
for (int var2 = 0; var2 <= 3 - this.recipeWidth; ++var2) {
|
||||
|
@ -105,6 +107,6 @@ public class ShapedInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
|
||||
@Override
|
||||
public String getResearch() {
|
||||
return this.key;
|
||||
return this.research;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ public class ShapelessInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
private final ItemStack recipeOutput;
|
||||
public final List<ItemStack> recipeItems;
|
||||
public String key;
|
||||
public String research;
|
||||
public int cost;
|
||||
public AspectList tags;
|
||||
|
||||
|
@ -22,10 +23,11 @@ public class ShapelessInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
return this.key;
|
||||
}
|
||||
|
||||
public ShapelessInfusionCraftingRecipe(String key, ItemStack par1ItemStack, List<ItemStack> par2List, int cost, AspectList tags) {
|
||||
public ShapelessInfusionCraftingRecipe(String key, String research, ItemStack par1ItemStack, List<ItemStack> par2List, int cost, AspectList tags) {
|
||||
this.recipeOutput = par1ItemStack;
|
||||
this.recipeItems = par2List;
|
||||
this.key = key;
|
||||
this.research = research;
|
||||
this.cost = cost;
|
||||
this.tags = tags;
|
||||
}
|
||||
|
@ -37,7 +39,7 @@ public class ShapelessInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
|
||||
@Override
|
||||
public boolean matches(IInventory par1InventoryCrafting, World world, EntityPlayer player) {
|
||||
if (this.key.length() > 0 && !ThaumcraftApiHelper.isResearchComplete(player.getDisplayName(), this.key)) {
|
||||
if (this.research.length() > 0 && !ThaumcraftApiHelper.isResearchComplete(player.getDisplayName(), this.research)) {
|
||||
return false;
|
||||
}
|
||||
ArrayList<ItemStack> var2 = new ArrayList<>(this.recipeItems);
|
||||
|
@ -86,6 +88,6 @@ public class ShapelessInfusionCraftingRecipe implements IInfusionRecipe {
|
|||
|
||||
@Override
|
||||
public String getResearch() {
|
||||
return this.key;
|
||||
return this.research;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue