Fixed incorrect ItemStack matching by temporary Recipes

Closes #137.
This commit is contained in:
TheDarkDnKTv 2021-08-17 04:21:27 +03:00
parent e0b7b3a99e
commit b1edcf9135
6 changed files with 14 additions and 12 deletions

View file

@ -7,7 +7,7 @@ import java.util.function.Predicate;
import gregtechmod.api.recipe.Recipe; import gregtechmod.api.recipe.Recipe;
import gregtechmod.api.util.GT_ModHandler; import gregtechmod.api.util.GT_ModHandler;
import gregtechmod.common.recipe.RecipeEntry; import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -38,7 +38,7 @@ public class FurnanceRecipeMap extends DummyRecipeMap {
in.stackSize = 1; in.stackSize = 1;
// It shall cook at 3 EU/t, if this Machine is overclocked then it will consume more // It shall cook at 3 EU/t, if this Machine is overclocked then it will consume more
// The time it usually needs, the Heating Coils re decreasing this Time, and if the Machine is overclocked, then it gets processed faster // The time it usually needs, the Heating Coils re decreasing this Time, and if the Machine is overclocked, then it gets processed faster
return new Recipe(0, 3, 130, false, Collections.singletonList(RecipeEntry.singleton(in)), Collections.singletonList(output), Collections.emptyList()); return new Recipe(0, 3, 130, false, Collections.singletonList(RecipeEntry.singleton(in, Match.STRICT)), Collections.singletonList(output), Collections.emptyList());
} }
} }

View file

@ -8,7 +8,7 @@ import java.util.function.Predicate;
import gregtechmod.api.recipe.Recipe; import gregtechmod.api.recipe.Recipe;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.recipe.RecipeEntry; import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -33,7 +33,7 @@ public class IC2RecipeMap extends DummyRecipeMap {
if (results != null && !results.isEmpty()) { if (results != null && !results.isEmpty()) {
inValid.stackSize = in.stackSize - inValid.stackSize; inValid.stackSize = in.stackSize - inValid.stackSize;
return new Recipe(0, 2, 200, false, return new Recipe(0, 2, 200, false,
Collections.singleton(RecipeEntry.singleton(inValid)), Collections.singleton(RecipeEntry.singleton(inValid, Match.STRICT)),
results, results,
Collections.emptyList()); Collections.emptyList());
} }

View file

@ -14,6 +14,7 @@ import gregtechmod.api.recipe.RecipeMap;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.recipe.ChancedStack; import gregtechmod.common.recipe.ChancedStack;
import gregtechmod.common.recipe.RecipeEntry; import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import gregtechmod.common.recipe.factory.SimpleRecipeFactory; import gregtechmod.common.recipe.factory.SimpleRecipeFactory;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
@ -69,7 +70,7 @@ public class PulverizerRecipeMap extends RecipeMap<SimpleRecipeFactory> {
} }
return new Recipe(0, 32, 500, false, // 25 seconds per 32 EU/t will be total 16,000EU return new Recipe(0, 32, 500, false, // 25 seconds per 32 EU/t will be total 16,000EU
Collections.singleton(RecipeEntry.singleton(input)), // In RC Recipe running 5 seconds and with consumption 160RF total 16,000RF = 64,000EU Collections.singleton(RecipeEntry.singleton(input, Match.STRICT)), // In RC Recipe running 5 seconds and with consumption 160RF total 16,000RF = 64,000EU
outputs, outputs,
chanced); chanced);
} }
@ -82,7 +83,7 @@ public class PulverizerRecipeMap extends RecipeMap<SimpleRecipeFactory> {
if (recipe != null) { if (recipe != null) {
input.stackSize = input.stackSize - copy2.stackSize; input.stackSize = input.stackSize - copy2.stackSize;
return new Recipe(0, 2, 400, false, return new Recipe(0, 2, 400, false,
Collections.singleton(RecipeEntry.singleton(input)), Collections.singleton(RecipeEntry.singleton(input, Match.STRICT)),
GT_Utility.copy(recipe.items), GT_Utility.copy(recipe.items),
Collections.emptyList()); Collections.emptyList());
} }
@ -94,7 +95,7 @@ public class PulverizerRecipeMap extends RecipeMap<SimpleRecipeFactory> {
ItemStack secondary = recipe.getSecondaryOutput(); ItemStack secondary = recipe.getSecondaryOutput();
input.stackSize = recipe.getInput().stackSize; input.stackSize = recipe.getInput().stackSize;
return new Recipe(0, 16, recipe.getEnergy() / 16, false, return new Recipe(0, 16, recipe.getEnergy() / 16, false,
Collections.singleton(RecipeEntry.singleton(input)), Collections.singleton(RecipeEntry.singleton(input, Match.STRICT)),
Collections.singleton(recipe.getPrimaryOutput()), Collections.singleton(recipe.getPrimaryOutput()),
secondary == null ? Collections.emptyList() : Collections.singleton(new ChancedStack(secondary, recipe.getSecondaryOutputChance() * 100))); secondary == null ? Collections.emptyList() : Collections.singleton(new ChancedStack(secondary, recipe.getSecondaryOutputChance() * 100)));
} }

View file

@ -10,7 +10,7 @@ import gregtechmod.api.util.GT_ModHandler;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.recipe.ChancedStack; import gregtechmod.common.recipe.ChancedStack;
import gregtechmod.common.recipe.RecipeEntry; import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -32,7 +32,7 @@ public class RecyclerRecipeMap extends DummyRecipeMap {
ChancedStack st = new ChancedStack(GT_Items.IC2_Scrap.get(1), (GT_ModHandler.getRecyclerOutput(instance, 0) != null) ? 12_50 : 0); ChancedStack st = new ChancedStack(GT_Items.IC2_Scrap.get(1), (GT_ModHandler.getRecyclerOutput(instance, 0) != null) ? 12_50 : 0);
return new Recipe(0, 1, 45, false, return new Recipe(0, 1, 45, false,
Collections.singleton(RecipeEntry.singleton(instance)), Collections.singleton(RecipeEntry.singleton(instance, Match.STRICT)),
Collections.emptyList(), Collections.emptyList(),
Collections.singleton(st)); Collections.singleton(st));
} }

View file

@ -8,6 +8,7 @@ import gregtechmod.api.enums.GT_Items;
import gregtechmod.api.recipe.Recipe; import gregtechmod.api.recipe.Recipe;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.recipe.RecipeEntry; import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -42,7 +43,7 @@ public class ScannerRecipeMap extends DummyRecipeMap {
ItemStack output = input.copy(); ItemStack output = input.copy();
output.setTagCompound(data); output.setTagCompound(data);
return new Recipe(0, eut, dur, false, return new Recipe(0, eut, dur, false,
Collections.singleton(RecipeEntry.singleton(input)), Collections.singleton(RecipeEntry.singleton(input, Match.STRICT)),
Collections.singleton(output), Collections.singleton(output),
Collections.emptyList()); Collections.emptyList());
} }

View file

@ -18,7 +18,7 @@ import gregtechmod.api.recipe.RecipeMap;
import gregtechmod.api.util.GT_ModHandler; import gregtechmod.api.util.GT_ModHandler;
import gregtechmod.api.util.GT_Utility; import gregtechmod.api.util.GT_Utility;
import gregtechmod.common.recipe.RecipeEntry; import gregtechmod.common.recipe.RecipeEntry;
import gregtechmod.common.recipe.RecipeEntry.Match;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
@ -66,7 +66,7 @@ public class GT_MetaTileEntity_Microwave extends GT_MetaTileEntity_BasicMachine
ItemStack input1 = input.copy(); ItemStack input1 = input.copy();
input1.stackSize = 1; input1.stackSize = 1;
return new Recipe(0, 4, 25, false, return new Recipe(0, 4, 25, false,
Collections.singleton(RecipeEntry.singleton(input1)), Collections.singleton(RecipeEntry.singleton(input1, Match.STRICT)),
Collections.singleton(output.copy()), Collections.singleton(output.copy()),
Collections.emptyList()); Collections.emptyList());
} }