From 0d9ab3bc0f5ad3bd0a2129e022b600de06df3de5 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 3 Oct 2015 22:19:04 +0200 Subject: [PATCH] Fixed intermodcomms --- InterModCommsInfo.md | 8 +++++--- .../communication/InterModCommunications.java | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/InterModCommsInfo.md b/InterModCommsInfo.md index 8b63610e8..97ac5cd17 100644 --- a/InterModCommsInfo.md +++ b/InterModCommsInfo.md @@ -10,9 +10,11 @@ The two Brackets will have to get replaced with one of the parts of Information ##### Crusher Recipes - Create an NBTTagCompound -- To the Compound, add an NBTTagCompound with the name "input" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.writeToNBT) -- To the Compound, add an NBTTagCompound with the name "outputOne" that contains the first Output saved to NBT -- To the Compound, add an NBTTagCompound with the name "outputTwo" that contains the second Output saved to NBT +- To the Compound, add a String with the name "input" that contains the Input Oredict Name +- To the Compound, add a String with the name "outputOne" that contains the first Output Oredict Name +- To the Compound, add an int with the name "outputOneAmount" the contains the first Output's amount +- To the Compound, add a String with the name "outputTwo" that contains the second Output Oredict Name +- To the Compound, add an int with the name "outputTwoAmount" the contains the second Output's amount - To the Compound, add an int with the name "secondChance" that contains the Chance for the second Output to appear - Send the Message with "registerCrusherRecipe" 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 6f16803b2..db8484443 100644 --- a/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java +++ b/src/main/java/ellpeck/actuallyadditions/communication/InterModCommunications.java @@ -12,6 +12,7 @@ package ellpeck.actuallyadditions.communication; 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.TreasureChestHandler; import ellpeck.actuallyadditions.util.ModUtil; @@ -26,24 +27,25 @@ public class InterModCommunications{ public static void processIMC(List messages){ for(FMLInterModComms.IMCMessage message : messages){ - //TODO This - /*if(message.key.equalsIgnoreCase("registerCrusherRecipe")){ + if(message.key.equalsIgnoreCase("registerCrusherRecipe")){ NBTTagCompound compound = message.getNBTValue(); if(compound != null){ - ItemStack input = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("input")); - ItemStack outputOne = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("outputOne")); - ItemStack outputTwo = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("outputTwo")); + String input = compound.getString("input"); + String outputOne = compound.getString("outputOne"); + int outputOneAmount = compound.getInteger("outputOneAmount"); + String outputTwo = compound.getString("outputTwo"); + int outputTwoAmount = compound.getInteger("outputTwoAmount"); int secondChance = compound.getInteger("secondChance"); if(input != null && outputOne != null){ - CrusherRecipeManualRegistry.registerRecipe(input, outputOne, outputTwo, secondChance); - ModUtil.LOGGER.info("Crusher Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input.toString()+" -> "+outputOne.toString()+(outputTwo != null ? " + "+outputTwo.toString()+", Second Chance: "+secondChance : "")); + CrusherRecipeRegistry.addRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, secondChance); + ModUtil.LOGGER.info("Crusher Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input+" -> "+outputOne+(outputTwo != null && !outputTwo.isEmpty() ? " + "+outputTwo+", Second Chance: "+secondChance : "")); } else{ ModUtil.LOGGER.error("Crusher Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Input or an Output!"); } } - }*/ + } if(message.key.equalsIgnoreCase("registerCoffeeMachineRecipe")){ NBTTagCompound compound = message.getNBTValue();