Fix NEI Plugin to work with new Recipe Setup.
Added Config option to not show colored cables in recipes. Fortify Recipe System vs OreDicionary Late entries.
This commit is contained in:
@@ -10,7 +10,12 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.NEIClientUtils;
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
@@ -87,7 +92,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
if ( (irecipe instanceof ShapedRecipe) )
|
||||
{
|
||||
CachedShapedRecipe recipe = new CachedShapedRecipe( (ShapedRecipe) irecipe );
|
||||
|
||||
|
||||
if ( recipe.contains( recipe.ingredients, ingredient.getItem() ) )
|
||||
{
|
||||
recipe.computeVisuals();
|
||||
@@ -123,11 +128,11 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
IRecipeOverlayRenderer renderer = super.getOverlayRenderer( gui, recipe );
|
||||
if ( renderer != null )
|
||||
return renderer;
|
||||
|
||||
|
||||
IStackPositioner positioner = RecipeInfo.getStackPositioner( gui, "crafting2x2" );
|
||||
if ( positioner == null )
|
||||
return null;
|
||||
|
||||
|
||||
return new DefaultOverlayRenderer( getIngredientStacks( recipe ), positioner );
|
||||
}
|
||||
|
||||
@@ -137,7 +142,7 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
IOverlayHandler handler = super.getOverlayHandler( gui, recipe );
|
||||
if ( handler != null )
|
||||
return handler;
|
||||
|
||||
|
||||
return RecipeInfo.getOverlayHandler( gui, "crafting2x2" );
|
||||
}
|
||||
|
||||
@@ -165,15 +170,31 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
||||
|
||||
public void setIngredients(int width, int height, Object[] items)
|
||||
{
|
||||
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
for (int y = 0; y < height; y++)
|
||||
{
|
||||
if ( items[(y * width + x)] != null )
|
||||
{
|
||||
PositionedStack stack = new PositionedStack( items[(y * width + x)], 25 + x * 18, 6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
IIngredient ing = (IIngredient) items[(y * width + x)];
|
||||
|
||||
try
|
||||
{
|
||||
ItemStack[] is = ing.getItemStackSet();
|
||||
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPrefered( is ) : is, 25 + x * 18, 6 + y * 18, false );
|
||||
stack.setMaxSize( 1 );
|
||||
this.ingredients.add( stack );
|
||||
}
|
||||
catch (RegistrationError e)
|
||||
{
|
||||
|
||||
}
|
||||
catch (MissingIngredientError e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user