mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 06:24:24 +00:00
Added ability to add EIO recipes via Forge IMC.
This commit is contained in:
1 parent
4404bc8624
commit
26ce6c3452
9 files changed
+87
-3
No files matched your search
@@ -25,6 +25,22 @@ iron=0.7
|
||||
food=0.35
|
||||
sand/cobble/wood=0.1
|
||||
|
||||
|
||||
Recipes can also be added using forge IMC messages. For example, in the init method of a mod:
|
||||
|
||||
String recipe =
|
||||
"<recipeGroup name=\"cheaty\">" +
|
||||
"<recipe name=\"foo\" energyCost=\"2400\">" +
|
||||
"<input>" +
|
||||
"<itemStack modID=\"minecraft\" itemName=\"dirt\"/>" +
|
||||
"</input>" +
|
||||
"<output>" +
|
||||
"<itemStack modID=\"minecraft\" itemName=\"diamond\"/>" +
|
||||
"</output>" +
|
||||
"</recipe>" +
|
||||
"</recipeGroup>";
|
||||
FMLInterModComms.sendMessage("EnderIO", "recipe:alloysmelter", recipe);
|
||||
|
||||
-->
|
||||
|
||||
<AlloySmelterRecipes>
|
||||
|
||||
@@ -69,6 +69,21 @@
|
||||
<itemStack oreDictionary="dustNickel" number="1" chance="0.1" />
|
||||
<itemStack modID="BiomesOPlenty" itemName="bop.bones" itemMeta="0" number="4" chance="0.1"/>
|
||||
|
||||
Recipes can also be added using forge IMC messages. For example, in the init method of a mod:
|
||||
|
||||
String recipe =
|
||||
"<recipeGroup name=\"cheaty\">" +
|
||||
"<recipe name=\"foo\" energyCost=\"2400\">" +
|
||||
"<input>" +
|
||||
"<itemStack modID=\"minecraft\" itemName=\"dirt\"/>" +
|
||||
"</input>" +
|
||||
"<output>" +
|
||||
"<itemStack modID=\"minecraft\" itemName=\"diamond\"/>" +
|
||||
"</output>" +
|
||||
"</recipe>" +
|
||||
"</recipeGroup>";
|
||||
FMLInterModComms.sendMessage("EnderIO", "recipe:sagmill", recipe);
|
||||
|
||||
-->
|
||||
|
||||
<SAGMillRecipes>
|
||||
|
||||
@@ -11,6 +11,22 @@ Produce:
|
||||
output fluid volume (mb) = IM * inputFluid.multiplier * 1000.
|
||||
|
||||
The vat always uses 1 MJ per tick, so energy cost also equates to duration.
|
||||
|
||||
Recipes can also be added using forge IMC messages. For example, in the init method of a mod:
|
||||
String recipe =
|
||||
"<recipeGroup name=\"cheaty\">" +
|
||||
"<recipe name=\"foo\" energyCost=\"2400\">" +
|
||||
"<input>" +
|
||||
"<itemStack modID=\"minecraft\" itemName=\"dirt\" slot=\"0\"/>" +
|
||||
"<fluidStack name=\"water\" multiplier=\"1\"/>" +
|
||||
"</input>" +
|
||||
"<output>" +
|
||||
"<fluidStack name=\"lava\"/>" +
|
||||
"</output>" +
|
||||
"</recipe>" +
|
||||
"</recipeGroup>";
|
||||
FMLInterModComms.sendMessage("EnderIO", "recipe:vat", recipe);
|
||||
|
||||
-->
|
||||
<VatRecipes>
|
||||
|
||||
|
||||
@@ -3,6 +3,9 @@ package crazypants.enderio;
|
||||
import static crazypants.enderio.EnderIO.MODID;
|
||||
import static crazypants.enderio.EnderIO.MOD_NAME;
|
||||
import static crazypants.enderio.EnderIO.VERSION;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -20,10 +23,12 @@ import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -120,6 +125,7 @@ import crazypants.enderio.material.ItemMachinePart;
|
||||
import crazypants.enderio.material.ItemMaterial;
|
||||
import crazypants.enderio.material.ItemPowderIngot;
|
||||
import crazypants.enderio.material.MaterialRecipes;
|
||||
import crazypants.enderio.nei.SagMillRecipeHandler;
|
||||
import crazypants.enderio.network.MessageTileNBT;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.enderio.teleport.BlockTravelAnchor;
|
||||
@@ -518,6 +524,24 @@ public class EnderIO {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onImc(IMCEvent evt) {
|
||||
ImmutableList<IMCMessage> messages = evt.getMessages();
|
||||
for(IMCMessage msg : messages) {
|
||||
if(msg.isStringMessage()) {
|
||||
String key = msg.key;
|
||||
String value = msg.getStringValue();
|
||||
if(VatRecipeManager.IMC_KEY.equals(key)) {
|
||||
VatRecipeManager.getInstance().addCustumRecipes(value);
|
||||
} else if(CrusherRecipeManager.IMC_KEY.equals(key)) {
|
||||
CrusherRecipeManager.getInstance().addCustomRecipes(value);
|
||||
} else if(AlloyRecipeManager.IMC_KEY.equals(key)) {
|
||||
AlloyRecipeManager.getInstance().addCustumRecipes(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarted(FMLServerStartedEvent event) {
|
||||
|
||||
@@ -28,6 +28,8 @@ import crazypants.util.Util;
|
||||
|
||||
public class AlloyRecipeManager extends ManyToOneRecipeManager {
|
||||
|
||||
public static final String IMC_KEY = "recipe:alloysmelter";
|
||||
|
||||
private static final String CORE_FILE_NAME = "AlloySmelterRecipes_Core.xml";
|
||||
private static final String CUSTOM_FILE_NAME = "AlloySmelterRecipes_User.xml";
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ import crazypants.util.Util;
|
||||
|
||||
public class CrusherRecipeManager {
|
||||
|
||||
public static final String IMC_KEY = "recipe:sagmill";
|
||||
|
||||
public static final int ORE_ENERGY_COST = 400;
|
||||
|
||||
public static final int INGOT_ENERGY_COST = 240;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class VatMachineRecipe extends AbstractMachineRecipe {
|
||||
result.add(new MachineRecipeInput(0, inputFluidStack));
|
||||
|
||||
for (MachineRecipeInput ri : inputs) {
|
||||
if(!ri.isFluid()) {
|
||||
if(!ri.isFluid() && ri.item != null) {
|
||||
ItemStack st = ri.item.copy();
|
||||
st.stackSize = rec.getNumConsumed(ri.item);
|
||||
result.add(new MachineRecipeInput(ri.slotNumber, st));
|
||||
|
||||
@@ -20,6 +20,7 @@ public class VatRecipe implements IRecipe {
|
||||
protected final RecipeInput[] inputs;
|
||||
protected final RecipeOutput[] output;
|
||||
protected final int energyRequired;
|
||||
private int requiredItems;
|
||||
|
||||
public VatRecipe(IRecipe recipe) {
|
||||
List<FluidStack> fluids = recipe.getInputFluidStacks();
|
||||
@@ -43,6 +44,13 @@ public class VatRecipe implements IRecipe {
|
||||
|
||||
output = new RecipeOutput[] { new RecipeOutput(outputFluidStack) };
|
||||
energyRequired = recipe.getEnergyRequired();
|
||||
|
||||
requiredItems = 1;
|
||||
for (RecipeInput ri : inputs) {
|
||||
if(!ri.isFluid() && ri.getSlotNumber() == 1) {
|
||||
requiredItems = 2;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -118,8 +126,7 @@ public class VatRecipe implements IRecipe {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found == 3;
|
||||
return found == requiredItems + 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@ import crazypants.enderio.machine.recipe.RecipeOutput;
|
||||
|
||||
public class VatRecipeManager {
|
||||
|
||||
public static final String IMC_KEY = "recipe:vat";
|
||||
|
||||
private static final String CORE_FILE_NAME = "VatRecipes_Core.xml";
|
||||
private static final String CUSTOM_FILE_NAME = "VatRecipes_User.xml";
|
||||
|
||||
|
||||
Reference in new issue
Block a user