diff options
| author | miozune <miozune@gmail.com> | 2023-12-04 06:12:47 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-03 22:12:47 +0100 |
| commit | c9c905d0547b9d6f8b7b2836f1b6dbaa8517b33d (patch) | |
| tree | 805da6bcd3ce329653626245792bd6a6cc1d7313 /src | |
| parent | 82b2fdb4d39f46fb1ab5aab25757b4720dec5f1d (diff) | |
| download | GT5-Unofficial-c9c905d0547b9d6f8b7b2836f1b6dbaa8517b33d.tar.gz GT5-Unofficial-c9c905d0547b9d6f8b7b2836f1b6dbaa8517b33d.tar.bz2 GT5-Unofficial-c9c905d0547b9d6f8b7b2836f1b6dbaa8517b33d.zip | |
Migrate to new RecipeMap (#375)
* Convert manual LCR recipe addition to RA2
* Remove outdated recipe addition for replicator
* Remove DynamicGTRecipe constructor that is identical to super
* Remove duplicated replicator recipe generation
* Migrate BW recipemaps
* Migrate recipe loaders
* Remove enforceNobleGas
No material succeeds in this method in the modpack
* Apply recipe categories
* Fix recipe removal code
* Adjust recipe catalysts
* update bs+deps+gradle
* fix
* fix
* change back to gtnh tag
---------
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Former-commit-id: 03486c93813e2b430ddf8eb1b33191068452db74
Diffstat (limited to 'src')
72 files changed, 1028 insertions, 1696 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/AcidGenFuelAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/AcidGenFuelAdder.java deleted file mode 100644 index 1e254993d4..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/AcidGenFuelAdder.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018-2020 bartimaeusnek Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following - * conditions: The above copyright notice and this permission notice shall be included in all copies or substantial - * portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, - * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -package com.github.bartimaeusnek.bartworks.API; - -import net.minecraftforge.fluids.FluidStack; - -import com.github.bartimaeusnek.bartworks.util.BWRecipes; - -import gregtech.api.enums.Materials; - -public final class AcidGenFuelAdder { - - public static void addLiquidFuel(Materials M, int burn) { - ((BWRecipes.BW_Recipe_Map_LiquidFuel) BWRecipes.instance.getMappingsFor((byte) 2)).addLiquidFuel(M, burn); - } - - public static void addLiquidFuel(FluidStack fluidStack, int burn) { - ((BWRecipes.BW_Recipe_Map_LiquidFuel) BWRecipes.instance.getMappingsFor((byte) 2)) - .addLiquidFuel(fluidStack, burn); - } - - public static void addMoltenFuel(Materials M, int burn) { - ((BWRecipes.BW_Recipe_Map_LiquidFuel) BWRecipes.instance.getMappingsFor((byte) 2)).addMoltenFuel(M, burn); - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java index fc09d943bc..4d28c5fb46 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioObjectAdder.java @@ -14,7 +14,7 @@ package com.github.bartimaeusnek.bartworks.API; import static gregtech.api.enums.Mods.Gendustry; -import static gregtech.api.util.GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes; +import static gregtech.api.recipe.RecipeMaps.centrifugeRecipes; import static gregtech.api.util.GT_RecipeBuilder.SECONDS; import java.awt.Color; @@ -177,7 +177,7 @@ public final class BioObjectAdder { GT_Values.RA.stdBuilder().itemInputs(GT_Utility.getIntegratedCircuit(10)) .fluidInputs(new FluidStack(B.getFluid(), 1000)).fluidOutputs(dnaFluid).duration(25 * SECONDS) - .eut(TierEU.RECIPE_MV).addTo(sCentrifugeRecipes); + .eut(TierEU.RECIPE_MV).addTo(centrifugeRecipes); } } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java index 527b62bae3..b1e3fb25df 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/BioRecipeAdder.java @@ -123,46 +123,4 @@ public final class BioRecipeAdder { aSpecialValue, exactSv); } - - // public static boolean addBacterialVatRecipe(ItemStack[] aInputs, ItemStack[] aOutputs, FluidStack[] - // aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSievert) { - // return BWRecipes.instance.addBacterialVatRecipe(aInputs, aOutputs, aFluidInputs, aFluidOutputs, aDuration, - // aEUt, aSievert); - // } - - // @Deprecated - // public static boolean addBioLabRecipeDNAExtraction(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, - // FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ - // return BWRecipes.instance.addBioLabRecipeDNAExtraction(aInputs, aOutput, aChances, aFluidInputs, - // aFluidOutputs, aDuration, aEUt, aSpecialValue); - // } - // - // @Deprecated - // public static boolean addBioLabRecipePCRThermoclycling(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, - // FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ - // return BWRecipes.instance.addBioLabRecipePCRThermoclycling(aInputs, aOutput, aChances, aFluidInputs, - // aFluidOutputs, aDuration, aEUt, aSpecialValue); - // } - // - // @Deprecated - // public static boolean addBioLabRecipePlasmidSynthesis(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, - // FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ - // return BWRecipes.instance.addBioLabRecipePlasmidSynthesis(aInputs, aOutput, aChances, aFluidInputs, - // aFluidOutputs, aDuration, aEUt, aSpecialValue); - // } - // - // @Deprecated - // public static boolean addBioLabRecipeTransformation(ItemStack[] aInputs, ItemStack aOutput, int[] aChances, - // FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ - // return BWRecipes.instance.addBioLabRecipeTransformation(aInputs, aOutput, aChances, aFluidInputs, - // aFluidOutputs, aDuration, aEUt, aSpecialValue); - // } - // - // @Deprecated - // public static boolean addBioLabRecipeClonalCellularSynthesis(ItemStack[] aInputs, ItemStack aOutput, int[] - // aChances, FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int aSpecialValue){ - // return BWRecipes.instance.addBioLabRecipeClonalCellularSynthesis(aInputs, aOutput, aChances, aFluidInputs, - // aFluidOutputs, aDuration, aEUt, aSpecialValue); - // } - } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/recipe/BWNBTDependantCraftingRecipe.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/recipe/BWNBTDependantCraftingRecipe.java new file mode 100644 index 0000000000..dfcf94115a --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/recipe/BWNBTDependantCraftingRecipe.java @@ -0,0 +1,76 @@ +package com.github.bartimaeusnek.bartworks.API.recipe; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.world.World; + +import com.github.bartimaeusnek.bartworks.util.BW_Util; + +public class BWNBTDependantCraftingRecipe implements IRecipe { + + ItemStack result; + Map<Character, ItemStack> charToStackMap = new HashMap<>(9, 1); + String[] shape; + + @SuppressWarnings({ "SuspiciousSystemArraycopy" }) + public BWNBTDependantCraftingRecipe(ItemStack result, Object... recipe) { + this.result = result; + this.shape = new String[3]; + System.arraycopy(recipe, 0, this.shape, 0, 3); + this.charToStackMap.put(' ', null); + for (int i = 3; i < recipe.length; i += 2) { + this.charToStackMap.put((char) recipe[i], ((ItemStack) recipe[i + 1]).copy()); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof BWNBTDependantCraftingRecipe that)) return false; + + if (!Objects.equals(this.result, that.result) || !Objects.equals(this.charToStackMap, that.charToStackMap)) + return false; + // Probably incorrect - comparing Object[] arrays with Arrays.equals + return Arrays.equals(this.shape, that.shape); + } + + @Override + public int hashCode() { + int result1 = this.result != null ? this.result.hashCode() : 0; + result1 = 31 * result1 + (this.charToStackMap != null ? this.charToStackMap.hashCode() : 0); + return 31 * result1 + Arrays.hashCode(this.shape); + } + + @Override + public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) { + for (int x = 0; x < 3; x++) { + for (int y = 0; y < 3; y++) { + ItemStack toCheck = p_77569_1_.getStackInRowAndColumn(y, x); + ItemStack ref = this.charToStackMap.get(this.shape[x].toCharArray()[y]); + if (!BW_Util.areStacksEqualOrNull(toCheck, ref)) return false; + } + } + return true; + } + + @Override + public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) { + return this.result.copy(); + } + + @Override + public int getRecipeSize() { + return 10; + } + + @Override + public ItemStack getRecipeOutput() { + return this.result; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/API/recipe/BacterialVatFrontend.java b/src/main/java/com/github/bartimaeusnek/bartworks/API/recipe/BacterialVatFrontend.java new file mode 100644 index 0000000000..6ed4113017 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/API/recipe/BacterialVatFrontend.java @@ -0,0 +1,92 @@ +package com.github.bartimaeusnek.bartworks.API.recipe; + +import java.util.Arrays; +import java.util.List; + +import javax.annotation.ParametersAreNonnullByDefault; + +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_BioVat; +import com.gtnewhorizons.modularui.api.math.Alignment; + +import gregtech.api.recipe.BasicUIPropertiesBuilder; +import gregtech.api.recipe.NEIRecipePropertiesBuilder; +import gregtech.api.recipe.RecipeMapFrontend; +import gregtech.api.util.MethodsReturnNonnullByDefault; +import gregtech.nei.GT_NEI_DefaultHandler; +import gregtech.nei.RecipeDisplayInfo; +import gregtech.nei.formatter.INEISpecialInfoFormatter; + +@ParametersAreNonnullByDefault +@MethodsReturnNonnullByDefault +public class BacterialVatFrontend extends RecipeMapFrontend { + + public BacterialVatFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder, + NEIRecipePropertiesBuilder neiPropertiesBuilder) { + super( + uiPropertiesBuilder, + neiPropertiesBuilder.neiSpecialInfoFormatter(new BacterialVatSpecialValueFormatter())); + } + + @Override + protected List<String> handleNEIItemInputTooltip(List<String> currentTip, + GT_NEI_DefaultHandler.FixedPositionedStack pStack) { + if (pStack.isFluid()) { + currentTip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("nei.biovat.input.tooltip")); + return currentTip; + } + return super.handleNEIItemInputTooltip(currentTip, pStack); + } + + @Override + protected Lis |
