Update to new RebornCore. Added a config setting to disable railcrafts Iron Nugget to Steel Nugget recipe.
This commit is contained in:
parent
5588bda10b
commit
2c60034a88
9 changed files with 118 additions and 33 deletions
|
@ -25,7 +25,6 @@ import reborncore.common.util.LogHelper;
|
|||
import reborncore.common.util.VersionChecker;
|
||||
import techreborn.achievement.TRAchievements;
|
||||
import techreborn.api.TechRebornAPI;
|
||||
import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
|
||||
import techreborn.client.GuiHandler;
|
||||
import techreborn.command.TechRebornDevCommand;
|
||||
import techreborn.compat.CompatManager;
|
||||
|
@ -103,8 +102,6 @@ public class Core {
|
|||
|
||||
proxy.preInit(event);
|
||||
|
||||
RecipeConfigManager.load(event.getModConfigurationDirectory());
|
||||
|
||||
versionChecker = new VersionChecker("TechReborn", new ModInfo());
|
||||
versionChecker.checkVersionThreaded();
|
||||
logHelper.info("PreInitialization Complete");
|
||||
|
@ -174,6 +171,7 @@ public class Core {
|
|||
compatModule.postInit(event);
|
||||
}
|
||||
proxy.postInit(event);
|
||||
ModRecipes.postInit();
|
||||
logHelper.info(RecipeHandler.recipeList.size() + " recipes loaded");
|
||||
|
||||
// RecipeHandler.scanForDupeRecipes();
|
||||
|
|
|
@ -3,7 +3,9 @@ package techreborn.api.recipe;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import reborncore.api.recipe.IBaseRecipeType;
|
||||
import reborncore.common.recipes.RecipeTranslator;
|
||||
|
||||
import java.security.InvalidParameterException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,11 +14,12 @@ import java.util.List;
|
|||
*/
|
||||
public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
|
||||
|
||||
public ArrayList<ItemStack> inputs;
|
||||
public String name;
|
||||
public int tickTime;
|
||||
public int euPerTick;
|
||||
public ArrayList<Object> inputs;
|
||||
private ArrayList<ItemStack> outputs;
|
||||
private boolean oreDict = true;
|
||||
|
||||
public BaseRecipe(String name, int tickTime, int euPerTick) {
|
||||
inputs = new ArrayList<>();
|
||||
|
@ -38,11 +41,14 @@ public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
|
|||
}
|
||||
|
||||
public void addOutput(ItemStack stack) {
|
||||
if (stack == null || stack.getItem() == null) {
|
||||
throw new InvalidParameterException("Output stack is null or empty");
|
||||
}
|
||||
outputs.add(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getInputs() {
|
||||
public List<Object> getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
|
||||
|
@ -82,13 +88,32 @@ public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
|
|||
return super.clone();
|
||||
}
|
||||
|
||||
public void setOreDict(boolean oreDict) {
|
||||
this.oreDict = oreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useOreDic() {
|
||||
return true;
|
||||
return oreDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return outputs;
|
||||
}
|
||||
|
||||
public void addInput(Object inuput) {
|
||||
if (inuput == null) {
|
||||
throw new InvalidParameterException("input is invalid!");
|
||||
}
|
||||
if(inuput instanceof ItemStack){
|
||||
if(((ItemStack) inuput).getItem() == null){
|
||||
throw new InvalidParameterException("input is invalid!");
|
||||
}
|
||||
}
|
||||
if(RecipeTranslator.getStackFromObject(inuput) == null){
|
||||
throw new InvalidParameterException("Could not determin recipe input for " + inuput);
|
||||
}
|
||||
inputs.add(inuput);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@ import reborncore.api.recipe.RecipeHandler;
|
|||
import reborncore.client.gui.BaseSlot;
|
||||
import reborncore.client.gui.SlotOutput;
|
||||
import reborncore.common.container.RebornContainer;
|
||||
import reborncore.common.recipes.RecipeTranslator;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import techreborn.api.recipe.machines.AlloySmelterRecipe;
|
||||
import techreborn.api.recipe.recipeConfig.RecipeConfigManager;
|
||||
import techreborn.tiles.TileAlloyFurnace;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
@ -66,7 +66,7 @@ public class ContainerAlloyFurnace extends RebornContainer {
|
|||
ItemStack stack) {
|
||||
for(IBaseRecipeType recipe : RecipeHandler.recipeList){
|
||||
if(recipe instanceof AlloySmelterRecipe){
|
||||
if(ItemUtils.isItemEqual(recipe.getInputs().get(recipeSlot), stack, true, true, true)){
|
||||
if(ItemUtils.isInputEqual(recipe.getInputs().get(recipeSlot), stack, true, true, true)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package techreborn.compat.jei;
|
|||
import mezz.jei.api.ingredients.IIngredients;
|
||||
import mezz.jei.api.recipe.BlankRecipeWrapper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import techreborn.api.recipe.BaseRecipe;
|
||||
|
||||
|
@ -13,17 +14,33 @@ public abstract class BaseRecipeWrapper<T extends BaseRecipe> extends BlankRecip
|
|||
protected final T baseRecipe;
|
||||
@Nonnull
|
||||
private final List<List<ItemStack>> inputs;
|
||||
@Nonnull
|
||||
private final List<List<ItemStack>> outputs;
|
||||
|
||||
public BaseRecipeWrapper(T baseRecipe) {
|
||||
this.baseRecipe = baseRecipe;
|
||||
|
||||
inputs = new ArrayList<>();
|
||||
for (ItemStack input : baseRecipe.getInputs()) {
|
||||
outputs = new ArrayList<>();
|
||||
for (Object input : baseRecipe.getInputs()) {
|
||||
if(input instanceof ItemStack){
|
||||
ItemStack stack = (ItemStack) input;
|
||||
if (baseRecipe.useOreDic()) {
|
||||
List<ItemStack> oreDictInputs = expandOreDict(stack);
|
||||
inputs.add(oreDictInputs);
|
||||
} else {
|
||||
inputs.add(Collections.singletonList(stack));
|
||||
}
|
||||
} else if (input instanceof String){
|
||||
inputs.add(OreDictionary.getOres((String) input));
|
||||
}
|
||||
}
|
||||
for (ItemStack input : baseRecipe.getOutputs()) {
|
||||
if (baseRecipe.useOreDic()) {
|
||||
List<ItemStack> oreDictInputs = expandOreDict(input);
|
||||
inputs.add(oreDictInputs);
|
||||
outputs.add(oreDictInputs);
|
||||
} else {
|
||||
inputs.add(Collections.singletonList(input));
|
||||
outputs.add(Collections.singletonList(input));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,9 +82,16 @@ public abstract class BaseRecipeWrapper<T extends BaseRecipe> extends BlankRecip
|
|||
return inputs;
|
||||
}
|
||||
|
||||
public List<FluidStack> getFluidInputs() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<ItemStack> getOutputs() {
|
||||
return baseRecipe.getOutputs();
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
for (List<ItemStack> stackList : outputs) {
|
||||
stacks.addAll(stackList);
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,12 +133,13 @@ public class MTGeneric {
|
|||
@Override
|
||||
public void apply() {
|
||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(name)) {
|
||||
for (ItemStack stack : recipeType.getInputs()) {
|
||||
if (output.matches(MineTweakerMC.getIItemStack(stack))) {
|
||||
removedRecipes.add((BaseRecipe) recipeType);
|
||||
RecipeHandler.recipeList.remove(recipeType);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipeType);
|
||||
break;
|
||||
for (Object stack : recipeType.getInputs()) {
|
||||
if(stack instanceof ItemStack){
|
||||
if (output.matches(MineTweakerMC.getIItemStack((ItemStack) stack))) {
|
||||
removedRecipes.add((BaseRecipe) recipeType);
|
||||
RecipeHandler.recipeList.remove(recipeType);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ public class ConfigTechReborn {
|
|||
public static boolean UninsulatedElectocutionParticle;
|
||||
public static boolean UninsulatedElectocutionDamage;
|
||||
public static boolean ScrapboxDispenser;
|
||||
public static boolean disableRailcraftSteelNuggetRecipe;
|
||||
// Power
|
||||
public static int LightningRodChance;
|
||||
public static int ThermalGeneratorOutput;
|
||||
|
@ -412,6 +413,11 @@ public class ConfigTechReborn {
|
|||
removeDuplices = config
|
||||
.get(CATEGORY_CRAFTING, "Remove Duplicates when IC2 is installed", false, "This atempts to fully intergrate TR with ic2 recipes (Beta)")
|
||||
.getBoolean(false);
|
||||
|
||||
disableRailcraftSteelNuggetRecipe = config
|
||||
.get(CATEGORY_CRAFTING, "Disable Railcraft's Steel nugget recipe", false, "When true TechReborn will remove Railcrafts Iron Nugget to steel nuggert recipe.")
|
||||
.getBoolean(false);
|
||||
|
||||
// Uu
|
||||
HideUuRecipes = config.get(CATEGORY_UU, "Hide UU Recipes", true, "Hide UU Recipes from JEI/NEI")
|
||||
.getBoolean(true);
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
@ -17,6 +18,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
|||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.common.util.CraftingHelper;
|
||||
import reborncore.common.util.ItemUtils;
|
||||
import reborncore.common.util.OreUtil;
|
||||
import reborncore.common.util.StringUtils;
|
||||
import techreborn.Core;
|
||||
|
@ -36,10 +38,8 @@ import techreborn.parts.powerCables.ItemStandaloneCables;
|
|||
import techreborn.utils.RecipeUtils;
|
||||
import techreborn.utils.StackWIPHandler;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import static techreborn.utils.OreDictUtils.getDictData;
|
||||
import static techreborn.utils.OreDictUtils.getDictOreOrNull;
|
||||
|
@ -104,6 +104,25 @@ public class ModRecipes {
|
|||
addScrapBoxloot();
|
||||
}
|
||||
|
||||
public static void postInit(){
|
||||
if(ConfigTechReborn.disableRailcraftSteelNuggetRecipe){
|
||||
Iterator iterator = FurnaceRecipes.instance().getSmeltingList().entrySet().iterator();
|
||||
Map.Entry entry;
|
||||
while (iterator.hasNext()) {
|
||||
entry = (Map.Entry) iterator.next();
|
||||
if (entry.getValue() instanceof ItemStack && entry.getKey() instanceof ItemStack) {
|
||||
ItemStack input = (ItemStack) entry.getKey();
|
||||
ItemStack output = (ItemStack) entry.getValue();
|
||||
System.out.println("====");
|
||||
if(ItemUtils.isInputEqual("nuggetSteel", output, true , true, false) && ItemUtils.isInputEqual("nuggetIron", input, true , true, false)){
|
||||
Core.logHelper.info("Removing a steelnugget smelting recipe");
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void addScrapBoxloot() {
|
||||
ScrapboxList.addItemStackToList(new ItemStack(Items.DIAMOND));
|
||||
ScrapboxList.addItemStackToList(new ItemStack(Items.STICK));
|
||||
|
|
|
@ -6,7 +6,7 @@ public class ModInfo implements IModInfo {
|
|||
public static final String MOD_NAME = "TechReborn";
|
||||
public static final String MOD_ID = "techreborn";
|
||||
public static final String MOD_VERSION = "@MODVERSION@";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:Forge@[11.15.0.1609,);required-after:reborncore;after:JEI@[3.13,);after:IC2";
|
||||
public static final String MOD_DEPENDENCIES = "required-after:Forge@[11.15.0.1609,);required-after:reborncore;after:JEI@[3.13,);after:IC2;after:railcraft";
|
||||
public static final String SERVER_PROXY_CLASS = "techreborn.proxies.CommonProxy";
|
||||
public static final String CLIENT_PROXY_CLASS = "techreborn.proxies.ClientProxy";
|
||||
public static final String GUI_FACTORY_CLASS = "techreborn.config.TechRebornGUIFactory";
|
||||
|
|
|
@ -12,6 +12,7 @@ import reborncore.api.recipe.IBaseRecipeType;
|
|||
import reborncore.api.recipe.RecipeHandler;
|
||||
import reborncore.api.tile.IInventoryProvider;
|
||||
import reborncore.common.IWrenchable;
|
||||
import reborncore.common.recipes.RecipeTranslator;
|
||||
import reborncore.common.tile.TileLegacyMachineBase;
|
||||
import reborncore.common.tile.TileMachineBase;
|
||||
import reborncore.common.util.Inventory;
|
||||
|
@ -125,14 +126,20 @@ public class TileAlloyFurnace extends TileLegacyMachineBase implements IWrenchab
|
|||
if (recipeType == null) {
|
||||
return false;
|
||||
}
|
||||
for (ItemStack input : recipeType.getInputs()) {
|
||||
Boolean hasItem = false;
|
||||
for (Object input : recipeType.getInputs()) {
|
||||
boolean hasItem = false;
|
||||
boolean useOreDict = input instanceof String || recipeType.useOreDic();
|
||||
boolean checkSize = input instanceof ItemStack;
|
||||
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true,
|
||||
recipeType.useOreDic()) && inventory.getStackInSlot(inputslot).stackSize >= input.stackSize) {
|
||||
hasItem = true;
|
||||
if (ItemUtils.isInputEqual(input, inventory.getStackInSlot(inputslot), true, true,
|
||||
useOreDict)) {
|
||||
ItemStack stack = RecipeTranslator.getStackFromObject(input);
|
||||
if(!checkSize || inventory.getStackInSlot(inputslot).stackSize >= stack.stackSize){
|
||||
hasItem = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasItem)
|
||||
return false;
|
||||
}
|
||||
|
@ -200,11 +207,16 @@ public class TileAlloyFurnace extends TileLegacyMachineBase implements IWrenchab
|
|||
hasAllRecipes = false;
|
||||
}
|
||||
if (hasAllRecipes) {
|
||||
for (ItemStack input : recipeType.getInputs()) {
|
||||
for (Object input : recipeType.getInputs()) {
|
||||
boolean useOreDict = input instanceof String || recipeType.useOreDic();
|
||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
||||
recipeType.useOreDic())) {
|
||||
inventory.decrStackSize(inputSlot, input.stackSize);
|
||||
if (ItemUtils.isInputEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
||||
useOreDict)) {
|
||||
int count = 1;
|
||||
if(input instanceof ItemStack){
|
||||
count = RecipeTranslator.getStackFromObject(input).stackSize;
|
||||
}
|
||||
inventory.decrStackSize(inputSlot, count);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue