IMC-based recipe removal. Wiki is updated as well :)
This commit is contained in:
parent
a1eb8306ee
commit
a2fb334833
|
@ -20,7 +20,14 @@ public class IMCHandler
|
|||
{
|
||||
try {
|
||||
boolean found = false;
|
||||
|
||||
boolean delete = false;
|
||||
|
||||
if(msg.key.startsWith("Delete"))
|
||||
{
|
||||
msg.key.replace("Delete", "");
|
||||
delete = true;
|
||||
}
|
||||
|
||||
for(Recipe type : Recipe.values())
|
||||
{
|
||||
if(msg.key.equalsIgnoreCase(type.getRecipeName() + "Recipe"))
|
||||
|
@ -33,15 +40,22 @@ public class IMCHandler
|
|||
|
||||
if(recipe != null && recipe.recipeOutput != null)
|
||||
{
|
||||
RecipeHandler.addRecipe(type, recipe);
|
||||
Mekanism.logger.info("[Mekanism] " + msg.getSender() + " added recipe of type " + type.getRecipeName() + " to the recipe list.");
|
||||
if(delete)
|
||||
{
|
||||
RecipeHandler.removeRecipe(type, recipe);
|
||||
Mekanism.logger.info("[Mekanism] " + msg.getSender() + " removed recipe of type " + type.getRecipeName() + " from the recipe list.");
|
||||
}
|
||||
else {
|
||||
RecipeHandler.addRecipe(type, recipe);
|
||||
Mekanism.logger.info("[Mekanism] " + msg.getSender() + " added recipe of type " + type.getRecipeName() + " to the recipe list.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Mekanism.logger.error("[Mekanism] " + msg.getSender() + " attempted to add recipe of type " + type.getRecipeName() + " with an invalid output.");
|
||||
Mekanism.logger.error("[Mekanism] " + msg.getSender() + " attempted to " + (delete ? "remove" : "add") + "recipe of type " + type.getRecipeName() + " with an invalid output.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
Mekanism.logger.error("[Mekanism] " + msg.getSender() + " attempted to add recipe of type " + type.getRecipeName() + " with an invalid input.");
|
||||
Mekanism.logger.error("[Mekanism] " + msg.getSender() + " attempted to " + (delete ? "remove" : "add") + "recipe of type " + type.getRecipeName() + " with an invalid input.");
|
||||
}
|
||||
|
||||
found = true;
|
||||
|
|
|
@ -65,6 +65,11 @@ public final class RecipeHandler
|
|||
recipeMap.put(recipe);
|
||||
}
|
||||
|
||||
public static void removeRecipe(Recipe recipeMap, MachineRecipe recipe)
|
||||
{
|
||||
recipeMap.remove(recipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an Enrichment Chamber recipe.
|
||||
* @param input - input ItemStack
|
||||
|
@ -575,6 +580,11 @@ public final class RecipeHandler
|
|||
{
|
||||
recipes.put(recipe.getInput(), recipe);
|
||||
}
|
||||
|
||||
public <RECIPE extends MachineRecipe<?, ?, RECIPE>> void remove(RECIPE recipe)
|
||||
{
|
||||
recipes.remove(recipe.getInput());
|
||||
}
|
||||
|
||||
public String getRecipeName()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue