Improve forestry recipe JEI behavior. Moistener still broken.
This commit is contained in:
parent
88911ecf77
commit
9a182197b3
10 changed files with 113 additions and 26 deletions
|
@ -4,6 +4,7 @@ import com.blamejared.mtlib.helpers.LogHelper;
|
|||
import com.blamejared.mtlib.utils.BaseListAddition;
|
||||
import forestry.api.recipes.IForestryRecipe;
|
||||
import forestry.api.recipes.ICraftingProvider;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -25,6 +26,10 @@ public abstract class ForestryListAddition<T extends IForestryRecipe> extends Ba
|
|||
if (recipe != null) {
|
||||
if (manager.addRecipe(recipe)){
|
||||
successful.add(recipe);
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(wrapped);
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error adding %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
|
@ -41,11 +46,16 @@ public abstract class ForestryListAddition<T extends IForestryRecipe> extends Ba
|
|||
if (!manager.removeRecipe(recipe)) {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, this.getRecipeInfo(recipe)));
|
||||
}else{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe);
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(wrapped);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract IRecipeWrapper wrapRecipe(T recipe);
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import forestry.api.recipes.ICraftingProvider;
|
|||
import forestry.api.recipes.IForestryRecipe;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseListRemoval;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -26,7 +27,10 @@ public abstract class ForestryListRemoval<T extends IForestryRecipe, C extends I
|
|||
if (recipe != null) {
|
||||
if (craftingProvider.removeRecipe(recipe)) {
|
||||
successful.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(recipe);
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(wrapped);
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error removing %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}
|
||||
|
@ -43,11 +47,16 @@ public abstract class ForestryListRemoval<T extends IForestryRecipe, C extends I
|
|||
if (!craftingProvider.addRecipe(recipe)) {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe for %s", name, getRecipeInfo(recipe)));
|
||||
}else{
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(recipe);
|
||||
IRecipeWrapper wrapped = wrapRecipe(recipe);
|
||||
if (wrapped != null){
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(wrapped);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
LogHelper.logError(String.format("Error restoring %s Recipe: null object", name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public abstract IRecipeWrapper wrapRecipe(T recipe);
|
||||
}
|
||||
|
|
Binary file not shown.
|
@ -5,6 +5,7 @@ import forestry.api.recipes.*;
|
|||
import forestry.core.recipes.ShapedRecipeCustom;
|
||||
import forestry.factory.recipes.CarpenterRecipeManager;
|
||||
import forestry.factory.recipes.jei.carpenter.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
|
@ -57,7 +58,6 @@ public class Carpenter {
|
|||
public Add(ICarpenterRecipe recipe) {
|
||||
super(Carpenter.name, RecipeManagers.carpenterManager);
|
||||
recipes.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new CarpenterRecipeWrapper(recipe));
|
||||
}
|
||||
|
||||
// @Override
|
||||
|
@ -85,6 +85,11 @@ public class Carpenter {
|
|||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICarpenterRecipe recipe){
|
||||
return new CarpenterRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,9 +141,6 @@ public class Carpenter {
|
|||
|
||||
public Remove(List<ICarpenterRecipe> recipes) {
|
||||
super(Carpenter.name, RecipeManagers.carpenterManager, recipes);
|
||||
// for(ICarpenterRecipe recipe: recipes){
|
||||
// MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new CarpenterRecipeWrapper(recipe));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -156,5 +158,10 @@ public class Carpenter {
|
|||
protected String getRecipeInfo(ICarpenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getCraftingGridRecipe().getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICarpenterRecipe recipe){
|
||||
return new CarpenterRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package modtweaker.mods.forestry.handlers;
|
|||
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import forestry.api.recipes.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import modtweaker.mods.forestry.*;
|
||||
|
@ -44,13 +45,17 @@ public class Centrifuge {
|
|||
public Add(ICentrifugeRecipe recipe) {
|
||||
super(Centrifuge.name, RecipeManagers.centrifugeManager);
|
||||
recipes.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new CentrifugeRecipeWrapper(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICentrifugeRecipe recipe){
|
||||
return new CentrifugeRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -81,14 +86,16 @@ public class Centrifuge {
|
|||
|
||||
public Remove(List<ICentrifugeRecipe> recipes) {
|
||||
super(Centrifuge.name, RecipeManagers.centrifugeManager, recipes);
|
||||
// for(ICentrifugeRecipe recipe: recipes){
|
||||
// MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new CentrifugeRecipeWrapper(recipe));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(ICentrifugeRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getInput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ICentrifugeRecipe recipe){
|
||||
return new CentrifugeRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import forestry.api.recipes.IFermenterManager;
|
|||
import forestry.api.recipes.IFermenterRecipe;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.factory.recipes.jei.fermenter.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.item.IItemStack;
|
||||
|
@ -56,13 +57,17 @@ public class Fermenter {
|
|||
public Add(IFermenterRecipe recipe) {
|
||||
super(Fermenter.name, RecipeManagers.fermenterManager);
|
||||
recipes.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new FermenterRecipeWrapper(recipe, recipe.getResource()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFermenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFermenterRecipe recipe){
|
||||
return new FermenterRecipeWrapper(recipe, recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -99,15 +104,17 @@ public class Fermenter {
|
|||
|
||||
public Remove(List<IFermenterRecipe> recipes) {
|
||||
super(Fermenter.name, RecipeManagers.fermenterManager, recipes);
|
||||
// for(IFermenterRecipe recipe: recipes){
|
||||
// MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new FermenterRecipeWrapper(recipe, recipe.getResource()));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo(IFermenterRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFermenterRecipe recipe){
|
||||
return new FermenterRecipeWrapper(recipe, recipe.getResource());
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.blamejared.mtlib.helpers.LogHelper;
|
|||
import com.blamejared.mtlib.utils.*;
|
||||
import forestry.api.fuels.*;
|
||||
import forestry.api.recipes.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import modtweaker.mods.forestry.*;
|
||||
|
@ -47,6 +48,12 @@ public class Moistener {
|
|||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
|
||||
//It's not clear to me how the moistener recipes should be wrapped
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IMoistenerRecipe recipe){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -81,6 +88,12 @@ public class Moistener {
|
|||
public String getRecipeInfo(IMoistenerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getProduct());
|
||||
}
|
||||
|
||||
//It's not clear to me how the moistener recipes should be wrapped
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IMoistenerRecipe recipe){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -3,6 +3,7 @@ package modtweaker.mods.forestry.handlers;
|
|||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import forestry.api.recipes.*;
|
||||
import forestry.factory.recipes.jei.squeezer.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
|
@ -54,6 +55,11 @@ public class Squeezer {
|
|||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ISqueezerRecipe recipe){
|
||||
return new SqueezerRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -102,14 +108,16 @@ public class Squeezer {
|
|||
|
||||
public Remove(List<ISqueezerRecipe> recipes) {
|
||||
super(Squeezer.name, RecipeManagers.squeezerManager, recipes);
|
||||
// for(ISqueezerRecipe recipe: recipes){
|
||||
// MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new SqueezerRecipeWrapper(recipe));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(ISqueezerRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getFluidOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(ISqueezerRecipe recipe){
|
||||
return new SqueezerRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package modtweaker.mods.forestry.handlers;
|
|||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import forestry.api.recipes.*;
|
||||
import forestry.factory.recipes.jei.still.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.IIngredient;
|
||||
import minetweaker.api.liquid.ILiquidStack;
|
||||
|
@ -43,13 +44,17 @@ public class Still {
|
|||
public Add(IStillRecipe recipe) {
|
||||
super("Forestry Still", RecipeManagers.stillManager);
|
||||
recipes.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new StillRecipeWrapper(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IStillRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IStillRecipe recipe){
|
||||
return new StillRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -86,14 +91,16 @@ public class Still {
|
|||
|
||||
public Remove(List<IStillRecipe> recipes) {
|
||||
super(Still.name, RecipeManagers.stillManager, recipes);
|
||||
// for(IStillRecipe recipe: recipes){
|
||||
// MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new StillRecipeWrapper(recipe));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IStillRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IStillRecipe recipe){
|
||||
return new StillRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package modtweaker.mods.forestry.handlers;
|
|||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import forestry.api.recipes.*;
|
||||
import forestry.factory.recipes.jei.fabricator.*;
|
||||
import mezz.jei.api.recipe.*;
|
||||
import minetweaker.MineTweakerAPI;
|
||||
import minetweaker.api.item.*;
|
||||
import modtweaker.mods.forestry.*;
|
||||
|
@ -72,6 +73,12 @@ public class ThermionicFabricator {
|
|||
public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
|
||||
//It's not clear to me how the smelting recipes should be wrapped
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFabricatorSmeltingRecipe recipe){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class AddCast extends ForestryListAddition<IFabricatorRecipe> {
|
||||
|
@ -79,13 +86,17 @@ public class ThermionicFabricator {
|
|||
public AddCast(IFabricatorRecipe recipe) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager);
|
||||
recipes.add(recipe);
|
||||
MineTweakerAPI.getIjeiRecipeRegistry().addRecipe(new FabricatorRecipeWrapper(recipe));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFabricatorRecipe recipe){
|
||||
return new FabricatorRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -144,20 +155,28 @@ public class ThermionicFabricator {
|
|||
public String getRecipeInfo(IFabricatorSmeltingRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getResource());
|
||||
}
|
||||
|
||||
//It's not clear to me how the smelting recipes should be wrapped
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFabricatorSmeltingRecipe recipe){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RemoveCasts extends ForestryListRemoval<IFabricatorRecipe, IFabricatorManager> {
|
||||
|
||||
public RemoveCasts(List<IFabricatorRecipe> recipes) {
|
||||
super(ThermionicFabricator.nameCasting, RecipeManagers.fabricatorManager, recipes);
|
||||
// for(IFabricatorRecipe recipe: recipes){
|
||||
// MineTweakerAPI.getIjeiRecipeRegistry().removeRecipe(new FabricatorRecipeWrapper(recipe));
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeInfo(IFabricatorRecipe recipe) {
|
||||
return LogHelper.getStackDescription(recipe.getRecipeOutput());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRecipeWrapper wrapRecipe(IFabricatorRecipe recipe){
|
||||
return new FabricatorRecipeWrapper(recipe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue