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:
@@ -114,6 +114,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||||||
public int colorapplicator_battery = 20000;
|
public int colorapplicator_battery = 20000;
|
||||||
public int staff_battery = 8000;
|
public int staff_battery = 8000;
|
||||||
|
|
||||||
|
public boolean disableColoredCableRecipesInNEI = true;
|
||||||
|
|
||||||
public boolean updateable = false;
|
public boolean updateable = false;
|
||||||
final private File myPath;
|
final private File myPath;
|
||||||
|
|
||||||
@@ -128,6 +130,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||||||
|
|
||||||
private void clientSync()
|
private void clientSync()
|
||||||
{
|
{
|
||||||
|
disableColoredCableRecipesInNEI = get( "Client", "disableColoredCableRecipesInNEI", true ).getBoolean( true );
|
||||||
enableEffects = get( "Client", "enableEffects", true ).getBoolean( true );
|
enableEffects = get( "Client", "enableEffects", true ).getBoolean( true );
|
||||||
useLargeFonts = get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
|
useLargeFonts = get( "Client", "useTerminalUseLargeFont", false ).getBoolean( false );
|
||||||
|
|
||||||
@@ -152,6 +155,11 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean disableColoredCableRecipesInNEI()
|
||||||
|
{
|
||||||
|
return disableColoredCableRecipesInNEI;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFilePath()
|
public String getFilePath()
|
||||||
{
|
{
|
||||||
return myPath.toString();
|
return myPath.toString();
|
||||||
|
|||||||
+4
-21
@@ -140,7 +140,6 @@ import appeng.parts.PartPlacement;
|
|||||||
import appeng.recipes.AEItemResolver;
|
import appeng.recipes.AEItemResolver;
|
||||||
import appeng.recipes.RecipeHandler;
|
import appeng.recipes.RecipeHandler;
|
||||||
import appeng.recipes.game.FacadeRecipe;
|
import appeng.recipes.game.FacadeRecipe;
|
||||||
import appeng.recipes.game.IRecipeBakeable;
|
|
||||||
import appeng.recipes.game.ShapedRecipe;
|
import appeng.recipes.game.ShapedRecipe;
|
||||||
import appeng.recipes.game.ShapelessRecipe;
|
import appeng.recipes.game.ShapelessRecipe;
|
||||||
import appeng.recipes.handlers.Crusher;
|
import appeng.recipes.handlers.Crusher;
|
||||||
@@ -195,7 +194,6 @@ public class Registration
|
|||||||
IRecipeHandlerRegistry recipeRegistery = AEApi.instance().registries().recipes();
|
IRecipeHandlerRegistry recipeRegistery = AEApi.instance().registries().recipes();
|
||||||
recipeRegistery.addNewSubItemResolver( new AEItemResolver() );
|
recipeRegistery.addNewSubItemResolver( new AEItemResolver() );
|
||||||
|
|
||||||
|
|
||||||
recipeRegistery.addNewCraftHandler( "hccrusher", HCCrusher.class );
|
recipeRegistery.addNewCraftHandler( "hccrusher", HCCrusher.class );
|
||||||
recipeRegistery.addNewCraftHandler( "mekcrusher", MekCrusher.class );
|
recipeRegistery.addNewCraftHandler( "mekcrusher", MekCrusher.class );
|
||||||
recipeRegistery.addNewCraftHandler( "mekechamber", MekEnrichment.class );
|
recipeRegistery.addNewCraftHandler( "mekechamber", MekEnrichment.class );
|
||||||
@@ -694,25 +692,10 @@ public class Registration
|
|||||||
*/
|
*/
|
||||||
mr.whiteListTileEntity( AEBaseTile.class );
|
mr.whiteListTileEntity( AEBaseTile.class );
|
||||||
|
|
||||||
bakeRecipes();
|
/**
|
||||||
}
|
* initial recipe bake, if ore dictionary changes after this it re-bakes.
|
||||||
|
*/
|
||||||
private void bakeRecipes()
|
OreDictionaryHandler.instance.bakeRecipes();
|
||||||
{
|
|
||||||
for ( Object o : CraftingManager.getInstance().getRecipeList() )
|
|
||||||
{
|
|
||||||
if ( o instanceof IRecipeBakeable )
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
( (IRecipeBakeable) o ).bake();
|
|
||||||
}
|
|
||||||
catch (Throwable e)
|
|
||||||
{
|
|
||||||
AELog.error( e );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerSpatial(boolean force)
|
private void registerSpatial(boolean force)
|
||||||
|
|||||||
@@ -10,7 +10,12 @@ import net.minecraft.inventory.Container;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
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.recipes.game.ShapedRecipe;
|
||||||
|
import appeng.util.Platform;
|
||||||
import codechicken.nei.NEIClientUtils;
|
import codechicken.nei.NEIClientUtils;
|
||||||
import codechicken.nei.NEIServerUtils;
|
import codechicken.nei.NEIServerUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
import codechicken.nei.PositionedStack;
|
||||||
@@ -165,15 +170,31 @@ public class NEIAEShapedRecipeHandler extends TemplateRecipeHandler
|
|||||||
|
|
||||||
public void setIngredients(int width, int height, Object[] items)
|
public void setIngredients(int width, int height, Object[] items)
|
||||||
{
|
{
|
||||||
|
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||||
for (int x = 0; x < width; x++)
|
for (int x = 0; x < width; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < height; y++)
|
for (int y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
if ( items[(y * width + x)] != null )
|
if ( items[(y * width + x)] != null )
|
||||||
{
|
{
|
||||||
PositionedStack stack = new PositionedStack( items[(y * width + x)], 25 + x * 18, 6 + y * 18, false );
|
IIngredient ing = (IIngredient) items[(y * width + x)];
|
||||||
stack.setMaxSize( 1 );
|
|
||||||
this.ingredients.add( stack );
|
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)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,12 @@ import net.minecraft.inventory.Container;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.CraftingManager;
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
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.ShapelessRecipe;
|
import appeng.recipes.game.ShapelessRecipe;
|
||||||
|
import appeng.util.Platform;
|
||||||
import codechicken.nei.NEIClientUtils;
|
import codechicken.nei.NEIClientUtils;
|
||||||
import codechicken.nei.NEIServerUtils;
|
import codechicken.nei.NEIServerUtils;
|
||||||
import codechicken.nei.PositionedStack;
|
import codechicken.nei.PositionedStack;
|
||||||
@@ -165,15 +170,32 @@ public class NEIAEShapelessRecipeHandler extends TemplateRecipeHandler
|
|||||||
|
|
||||||
public void setIngredients(Object[] items)
|
public void setIngredients(Object[] items)
|
||||||
{
|
{
|
||||||
|
boolean useSingleItems = AEConfig.instance.disableColoredCableRecipesInNEI();
|
||||||
for (int x = 0; x < 3; x++)
|
for (int x = 0; x < 3; x++)
|
||||||
{
|
{
|
||||||
for (int y = 0; y < 3; y++)
|
for (int y = 0; y < 3; y++)
|
||||||
{
|
{
|
||||||
if ( items.length > (y * 3 + x) )
|
if ( items.length > (y * 3 + x) )
|
||||||
{
|
{
|
||||||
PositionedStack stack = new PositionedStack( items[(y * 3 + x)], 25 + x * 18, 6 + y * 18, false );
|
IIngredient ing = (IIngredient) items[(y * 3 + x)];
|
||||||
stack.setMaxSize( 1 );
|
|
||||||
this.ingredients.add( stack );
|
try
|
||||||
|
{
|
||||||
|
ItemStack[] is = ing.getItemStackSet();
|
||||||
|
PositionedStack stack = new PositionedStack( useSingleItems ? Platform.findPrefered( is ) : ing.getItemStackSet(), 25 + x * 18,
|
||||||
|
6 + y * 18, false );
|
||||||
|
stack.setMaxSize( 1 );
|
||||||
|
this.ingredients.add( stack );
|
||||||
|
}
|
||||||
|
catch (RegistrationError e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (MissingIngredientError e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ public class GroupIngredient implements IIngredient
|
|||||||
@Override
|
@Override
|
||||||
public void bake() throws RegistrationError, MissingIngredientError
|
public void bake() throws RegistrationError, MissingIngredientError
|
||||||
{
|
{
|
||||||
|
baked = null;
|
||||||
baked = getItemStackSet();
|
baked = getItemStackSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ public class Ingredient implements IIngredient
|
|||||||
@Override
|
@Override
|
||||||
public void bake() throws RegistrationError, MissingIngredientError
|
public void bake() throws RegistrationError, MissingIngredientError
|
||||||
{
|
{
|
||||||
|
baked = null;
|
||||||
baked = getItemStackSet();
|
baked = getItemStackSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ public class IngredientSet implements IIngredient
|
|||||||
@Override
|
@Override
|
||||||
public void bake() throws RegistrationError, MissingIngredientError
|
public void bake() throws RegistrationError, MissingIngredientError
|
||||||
{
|
{
|
||||||
|
baked = null;
|
||||||
baked = getItemStackSet();
|
baked = getItemStackSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.CraftingManager;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
import appeng.recipes.game.IRecipeBakeable;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
public class OreDictionaryHandler
|
public class OreDictionaryHandler
|
||||||
@@ -14,6 +17,8 @@ public class OreDictionaryHandler
|
|||||||
|
|
||||||
private List<IOreListener> ol = new ArrayList<IOreListener>();
|
private List<IOreListener> ol = new ArrayList<IOreListener>();
|
||||||
|
|
||||||
|
private boolean enableRebaking = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Just limit what items are sent to the final listeners, I got sick of strange items showing up...
|
* Just limit what items are sent to the final listeners, I got sick of strange items showing up...
|
||||||
*
|
*
|
||||||
@@ -33,6 +38,9 @@ public class OreDictionaryHandler
|
|||||||
for (IOreListener v : ol)
|
for (IOreListener v : ol)
|
||||||
v.oreRegistered( event.Name, event.Ore );
|
v.oreRegistered( event.Name, event.Ore );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( enableRebaking )
|
||||||
|
bakeRecipes();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,4 +66,24 @@ public class OreDictionaryHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void bakeRecipes()
|
||||||
|
{
|
||||||
|
enableRebaking = true;
|
||||||
|
|
||||||
|
for (Object o : CraftingManager.getInstance().getRecipeList())
|
||||||
|
{
|
||||||
|
if ( o instanceof IRecipeBakeable )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
((IRecipeBakeable) o).bake();
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
AELog.error( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-1
@@ -80,6 +80,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IAETagCompound;
|
import appeng.api.storage.data.IAETagCompound;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.AEItemDefinition;
|
import appeng.api.util.AEItemDefinition;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -1412,7 +1413,7 @@ public class Platform
|
|||||||
|
|
||||||
if ( myFluids != null )
|
if ( myFluids != null )
|
||||||
{
|
{
|
||||||
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() ) )
|
for (IAEFluidStack is : myFluids.getAvailableItems( AEApi.instance().storage().createFluidList() ))
|
||||||
{
|
{
|
||||||
gs.postAlterationOfStoredItems( StorageChannel.FLUIDS, is, src );
|
gs.postAlterationOfStoredItems( StorageChannel.FLUIDS, is, src );
|
||||||
}
|
}
|
||||||
@@ -1692,4 +1693,23 @@ public class Platform
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object findPrefered(ItemStack[] is)
|
||||||
|
{
|
||||||
|
for (ItemStack stack : is)
|
||||||
|
{
|
||||||
|
if ( AEApi.instance().parts().partCableGlass.sameAs( AEColor.Transparent, stack ) )
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
if ( AEApi.instance().parts().partCableCovered.sameAs( AEColor.Transparent, stack ) )
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
if ( AEApi.instance().parts().partCableSmart.sameAs( AEColor.Transparent, stack ) )
|
||||||
|
return stack;
|
||||||
|
|
||||||
|
if ( AEApi.instance().parts().partCableDense.sameAs( AEColor.Transparent, stack ) )
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
|
||||||
|
return is;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user