From 88d6c18708ef3c087fdafb281f1f8282e0cc5588 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 23 Nov 2015 19:30:21 +0100 Subject: [PATCH] Reconstructor IMC --- InterModCommsInfo.md | 8 ++++++++ .../communication/InterModCommunications.java | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/InterModCommsInfo.md b/InterModCommsInfo.md index 97ac5cd17..35c343bf1 100644 --- a/InterModCommsInfo.md +++ b/InterModCommsInfo.md @@ -40,3 +40,11 @@ The two Brackets will have to get replaced with one of the parts of Information - To the Compound, add an int with the name "minAmount" that contains the minimum size of the ItemStack - To the Compound, add an int with the name "maxAmount" that contains the maximum size of the ItemStack - Send the Message with "registerTreasureChestRecipe" as the [X] Argument, the Compound as the [Y] Argument. + +##### Reconstructor Recipes +- Create an NBTTagCompound +- To the Compound, add a String with the name "input" that is the Input's OreDictionary Name +- To the Compound, add a String with the name "output" that is the Output's OreDictionary Name +- To the Compound, add an int with the name "energyUse" that is the amount of RF used +- To the Compound, add an int with the name "lensType" that contains the LensType's ID (found in LensType in ReconstructorRecipeHandler, the ID is the ordinal) +- Send the Message with "registerReconstructorRecipe" as the [X] Argument, the Compound as the [Y] Argument. diff --git a/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java b/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java index af4ecc7c7..102cb1625 100644 --- a/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java +++ b/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java @@ -14,6 +14,7 @@ import cpw.mods.fml.common.event.FMLInterModComms; import ellpeck.actuallyadditions.items.ItemCoffee; import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry; import ellpeck.actuallyadditions.recipe.HairyBallHandler; +import ellpeck.actuallyadditions.recipe.ReconstructorRecipeHandler; import ellpeck.actuallyadditions.recipe.TreasureChestHandler; import ellpeck.actuallyadditions.util.ModUtil; import net.minecraft.item.ItemStack; @@ -100,6 +101,24 @@ public class InterModCommunications{ } } } + + if(message.key.equalsIgnoreCase("registerReconstructorRecipe")){ + NBTTagCompound compound = message.getNBTValue(); + if(compound != null){ + String input = compound.getString("input"); + String output = compound.getString("output"); + int energyUse = compound.getInteger("energyUse"); + int lensType = compound.getInteger("lensType"); + + if(ReconstructorRecipeHandler.LensType.values().length > lensType && input != null && output != null){ + ReconstructorRecipeHandler.addRecipe(input, output, energyUse, ReconstructorRecipeHandler.LensType.values()[lensType]); + ModUtil.LOGGER.info("Reconstructor Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input+" -> "+output+" @ "+energyUse+" with LensType "+lensType); + } + else{ + ModUtil.LOGGER.error("Reconstructor Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Output, an Input or a LensType!"); + } + } + } } }