aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
diff options
context:
space:
mode:
authorbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-09-21 23:08:22 +0200
committerbartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>2020-12-31 02:02:36 +0100
commit2db36cb988b58ace9d91d6f7b636a6059507c873 (patch)
tree144a1b36d73c9e92245a08ae832433932b9c972e /src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
parente95b871625d4c7471da57c3eb5c0890944b2e947 (diff)
downloadGT5-Unofficial-2db36cb988b58ace9d91d6f7b636a6059507c873.tar.gz
GT5-Unofficial-2db36cb988b58ace9d91d6f7b636a6059507c873.tar.bz2
GT5-Unofficial-2db36cb988b58ace9d91d6f7b636a6059507c873.zip
Disassembler rework
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gregtech/api/util/GT_Shaped_Recipe.java')
-rw-r--r--src/main/java/gregtech/api/util/GT_Shaped_Recipe.java63
1 files changed, 45 insertions, 18 deletions
diff --git a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
index e51c490519..ea4182a16e 100644
--- a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
+++ b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java
@@ -1,17 +1,20 @@
package gregtech.api.util;
import gregtech.api.interfaces.internal.IGT_CraftingRecipe;
-import gregtech.api.items.GT_MetaGenerated_Tool;
+import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe;
+import java.util.List;
+
public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRecipe {
- public final boolean mDismantleable, mRemovableByGT, mKeepingNBT;
+ public final boolean /*mDismantleable,*/ mRemovableByGT, mKeepingNBT;
private final Enchantment[] mEnchantmentsAdded;
private final int[] mEnchantmentLevelsAdded;
@@ -21,7 +24,31 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec
mEnchantmentLevelsAdded = aEnchantmentLevelsAdded;
mRemovableByGT = aRemovableByGT;
mKeepingNBT = aKeepingNBT;
- mDismantleable = aDismantleAble;
+// mDismantleable = aDismantleAble;
+ if (aDismantleAble){
+ for (Object o : aRecipe) {
+ String toPrint = null;
+ if (o instanceof String) {
+ toPrint = (String) o;
+ toPrint += " String";
+ } else if (o instanceof ItemStack) {
+ toPrint = GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName((ItemStack) o));
+ toPrint += " ItemStack";
+ } else if (o instanceof List) {
+ toPrint = String.join(", ", ((List<String>) o));
+ toPrint += " List<String>";
+ } else if (o instanceof Item) {
+ toPrint = GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName(new ItemStack((Item) o)));
+ toPrint += " Item";
+ } else if (o instanceof Block) {
+ toPrint = GT_LanguageManager.getTranslation(GT_LanguageManager.getTranslateableItemStackName(new ItemStack((Block) o)));
+ toPrint += " Block";
+ }
+ if (toPrint != null)
+ System.out.println(toPrint);
+ }
+ }
+ //TODO: Register Dissassembler "Recipe"
}
@Override
@@ -66,21 +93,21 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec
}
// Saving Ingredients inside the Item.
- if (mDismantleable) {
- NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound();
- if (rNBT == null) rNBT = new NBTTagCompound();
- for (int i = 0; i < 9; i++) {
- ItemStack tStack = aGrid.getStackInSlot(i);
- if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) {
- tStack = GT_Utility.copyAmount(1, tStack);
- if(GT_Utility.isStackValid(tStack)){
- GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true);
- tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound()));}
- }
- }
- rNBT.setTag("GT.CraftingComponents", tNBT);
- rStack.setTagCompound(rNBT);
- }
+// if (mDismantleable) {
+// NBTTagCompound rNBT = rStack.getTagCompound(), tNBT = new NBTTagCompound();
+// if (rNBT == null) rNBT = new NBTTagCompound();
+// for (int i = 0; i < 9; i++) {
+// ItemStack tStack = aGrid.getStackInSlot(i);
+// if (tStack != null && GT_Utility.getContainerItem(tStack, true) == null && !(tStack.getItem() instanceof GT_MetaGenerated_Tool)) {
+// tStack = GT_Utility.copyAmount(1, tStack);
+// if(GT_Utility.isStackValid(tStack)){
+// GT_ModHandler.dischargeElectricItem(tStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true);
+// tNBT.setTag("Ingredient." + i, tStack.writeToNBT(new NBTTagCompound()));}
+// }
+// }
+// rNBT.setTag("GT.CraftingComponents", tNBT);
+// rStack.setTagCompound(rNBT);
+// }
// Add Enchantments
for (int i = 0; i < mEnchantmentsAdded.length; i++)