Added IMC support for Enchanter and Slice'N'Splice recipes

This commit is contained in:
CrazyPants committed 2014-11-25 19:18:16 +08:00
1 parent 1292de6765
commit e1c60acc6a
4 files changed
+31 -5

No files matched your search

@@ -622,6 +622,10 @@ public class EnderIO {
TravelController.instance.addBlockToBlinkBlackList(value);
} else if(IMC.SOUL_VIAL_BLACKLIST.equals(key) && itemSoulVessel != null) {
itemSoulVessel.addEntityToBlackList(value);
} else if(IMC.ENCHANTER_RECIPE.equals(key)) {
EnchanterRecipeManager.getInstance().addCustomRecipes(value);
} else if(IMC.SLINE_N_SPLICE_RECIPE.equals(key)) {
SliceAndSpliceRecipeManager.getInstance().addCustumRecipes(key);
}
} else if(msg.isNBTMessage()) {
if(IMC.SOUL_BINDER_RECIPE.equals(key)) {
@@ -4,7 +4,9 @@ import crazypants.enderio.fluid.FluidFuelRegister;
import crazypants.enderio.item.ItemSoulVessel;
import crazypants.enderio.machine.alloy.AlloyRecipeManager;
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
import crazypants.enderio.machine.enchanter.EnchanterRecipeManager;
import crazypants.enderio.machine.painter.PaintSourceValidator;
import crazypants.enderio.machine.slicensplice.SliceAndSpliceRecipeManager;
import crazypants.enderio.machine.soul.SoulBinderRecipeManager;
import crazypants.enderio.machine.spawner.PoweredSpawnerConfig;
import crazypants.enderio.machine.still.VatRecipeManager;
@@ -38,6 +40,21 @@ public final class IMC {
*/
public static final String ALLOY_RECIPE = "recipe:alloysmelter";
/**
* Key for a string message to add Enchanter recipes. Calls
* {@link EnchanterRecipeManager#addCustomRecipes(String)} with the string
* value of the message. The supplied xml is treated as if it was loaded from
* EnchanterRecipes_User.xm.
*/
public static final String ENCHANTER_RECIPE = "recipe:enchanter";
/**
* Key for a string message to add Slice'N'Splice recipes. Calls
* {@link SliceAndSpliceRecipeManager#addCustumRecipes(String)} with the
* string value of the message.
*/
public static final String SLINE_N_SPLICE_RECIPE = "recipe:slicensplice";
/**
* Key for an NBT message to add Soul Binder recipes. Calls
* {@link SoulBinderRecipeManager#addRecipeFromNBT(net.minecraft.nbt.NBTTagCompound)}
@@ -3,11 +3,8 @@ package crazypants.enderio.machine.enchanter;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemStack;
import crazypants.enderio.Log;
import crazypants.enderio.machine.alloy.AlloyRecipeManager;
public class EnchanterRecipeManager {
@@ -39,9 +36,17 @@ public class EnchanterRecipeManager {
return null;
}
public void addCustomRecipes(String xml) {
try {
List<EnchanterRecipe> newRec = EnchanterRecipeParser.parse(xml);
EnchanterRecipeParser.merge(recipes, newRec);
} catch (Exception e) {
Log.error("EnchanterRecipeManager: Error processing custom Enchanter recipes: " + e);
}
}
public List<EnchanterRecipe> getRecipes() {
return recipes;
}
}
@@ -79,7 +79,7 @@ public class EnchanterRecipeParser extends DefaultHandler {
return result;
}
private static void merge(List<EnchanterRecipe> core, List<EnchanterRecipe> userConfig) {
public static void merge(List<EnchanterRecipe> core, List<EnchanterRecipe> userConfig) {
for (EnchanterRecipe rec : userConfig) {
removeFromList(rec.getEnchantment(), core);
}