diff options
author | Jason Mitchell <mitchej@gmail.com> | 2023-01-30 10:56:42 -0800 |
---|---|---|
committer | Jason Mitchell <mitchej@gmail.com> | 2023-01-30 10:56:42 -0800 |
commit | 0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a (patch) | |
tree | 1e2c649f3a6ce3f6b2babd0098a5f4819e9cd0b6 /src/main/java/gregtech/api/util/GT_Shaped_Recipe.java | |
parent | f8cc82edeb9810c45cba762d733a2c909a302faa (diff) | |
download | GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.gz GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.tar.bz2 GT5-Unofficial-0d9aab72aa570f13dc3e32e0d32b3f3a95f95e0a.zip |
[ci skip] spotlessApply with the new settings
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.java | 54 |
1 files changed, 25 insertions, 29 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 ae8d804ee9..62096c1ebd 100644 --- a/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java +++ b/src/main/java/gregtech/api/util/GT_Shaped_Recipe.java @@ -1,7 +1,5 @@ package gregtech.api.util; -import gregtech.api.interfaces.internal.IGT_CraftingRecipe; -import gregtech.api.objects.ReverseShapedRecipe; import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.inventory.InventoryCrafting; @@ -10,19 +8,17 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.oredict.ShapedOreRecipe; +import gregtech.api.interfaces.internal.IGT_CraftingRecipe; +import gregtech.api.objects.ReverseShapedRecipe; + public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRecipe { + public final boolean mRemovableByGT, mKeepingNBT; private final Enchantment[] mEnchantmentsAdded; private final int[] mEnchantmentLevelsAdded; - public GT_Shaped_Recipe( - ItemStack aResult, - boolean aDismantleAble, - boolean aRemovableByGT, - boolean aKeepingNBT, - Enchantment[] aEnchantmentsAdded, - int[] aEnchantmentLevelsAdded, - Object... aRecipe) { + public GT_Shaped_Recipe(ItemStack aResult, boolean aDismantleAble, boolean aRemovableByGT, boolean aKeepingNBT, + Enchantment[] aEnchantmentsAdded, int[] aEnchantmentLevelsAdded, Object... aRecipe) { super(aResult, aRecipe); mEnchantmentsAdded = aEnchantmentsAdded; mEnchantmentLevelsAdded = aEnchantmentLevelsAdded; @@ -42,8 +38,8 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec if (tStack != null) { if ((tStack.hasTagCompound() != aGrid.getStackInSlot(i).hasTagCompound()) || (tStack.hasTagCompound() - && !tStack.getTagCompound() - .equals(aGrid.getStackInSlot(i).getTagCompound()))) return false; + && !tStack.getTagCompound().equals(aGrid.getStackInSlot(i).getTagCompound()))) + return false; } tStack = aGrid.getStackInSlot(i); } @@ -60,33 +56,33 @@ public class GT_Shaped_Recipe extends ShapedOreRecipe implements IGT_CraftingRec GT_Utility.updateItemStack(rStack); // Keeping NBT - if (mKeepingNBT) - for (int i = 0; i < aGrid.getSizeInventory(); i++) { - if (aGrid.getStackInSlot(i) != null - && aGrid.getStackInSlot(i).hasTagCompound()) { - rStack.setTagCompound((NBTTagCompound) - aGrid.getStackInSlot(i).getTagCompound().copy()); - break; - } + if (mKeepingNBT) for (int i = 0; i < aGrid.getSizeInventory(); i++) { + if (aGrid.getStackInSlot(i) != null && aGrid.getStackInSlot(i).hasTagCompound()) { + rStack.setTagCompound((NBTTagCompound) aGrid.getStackInSlot(i).getTagCompound().copy()); + break; } + } // Charge Values if (GT_ModHandler.isElectricItem(rStack)) { GT_ModHandler.dischargeElectricItem(rStack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false, true); int tCharge = 0; - for (int i = 0; i < aGrid.getSizeInventory(); i++) - tCharge += GT_ModHandler.dischargeElectricItem( - aGrid.getStackInSlot(i), Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, true); + for (int i = 0; i < aGrid.getSizeInventory(); i++) tCharge += GT_ModHandler.dischargeElectricItem( + aGrid.getStackInSlot(i), + Integer.MAX_VALUE, + Integer.MAX_VALUE, + true, + true, + true); if (tCharge > 0) GT_ModHandler.chargeElectricItem(rStack, tCharge, Integer.MAX_VALUE, true, false); } // Add Enchantments - for (int i = 0; i < mEnchantmentsAdded.length; i++) - GT_Utility.ItemNBT.addEnchantment( - rStack, - mEnchantmentsAdded[i], - EnchantmentHelper.getEnchantmentLevel(mEnchantmentsAdded[i].effectId, rStack) - + mEnchantmentLevelsAdded[i]); + for (int i = 0; i < mEnchantmentsAdded.length; i++) GT_Utility.ItemNBT.addEnchantment( + rStack, + mEnchantmentsAdded[i], + EnchantmentHelper.getEnchantmentLevel(mEnchantmentsAdded[i].effectId, rStack) + + mEnchantmentLevelsAdded[i]); // Update the Stack again GT_Utility.updateItemStack(rStack); |