mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Remove InterModComms.
This commit is contained in:
parent
448a050c26
commit
bc663fae4c
5 changed files with 3 additions and 176 deletions
|
@ -1,49 +0,0 @@
|
|||
Adding Custom Recipes (For Modders only!):
|
||||
=====
|
||||
|
||||
Actually Additions adds an InterModCommunications Feature that allows you to add custom Crafting Recipes using Items from your Mods.
|
||||
|
||||
To use these Features, just send an InterModComms Message in your preInit or init like this:
|
||||
FMLInterModComms.sendMessage("ActuallyAdditions", [X], [Y]);
|
||||
This Message has to be sent BEFORE FMLPostInitializationEvent!
|
||||
The two Brackets will have to get replaced with one of the parts of Information below.
|
||||
|
||||
##### Crusher Recipes
|
||||
- Create an NBTTagCompound
|
||||
- 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.
|
||||
|
||||
##### Coffee Machine 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 int with the name "id" that contains the ID of the Effect the Coffee should have (Look up the Effects in Minecraft's Potion Class!)
|
||||
- To the Compound, add an int with the name "duration" that contains the Duration the Effect should have
|
||||
- To the Compound, add an int with the name "amplifier" that contains the Amplifier the Effect should have (Remember: 0 = Level 1!)
|
||||
- To the Compound, add an int with the name "maxAmp" that contains the maximal Amplifier the Effect can have
|
||||
- Send the Message with "registerCoffeeMachineRecipe" as the [X] Argument, the Compound as the [Y] Argument.
|
||||
|
||||
##### Ball of Hair Recipes
|
||||
- Create an NBTTagCompound
|
||||
- To the Compound, add an NBTTagCompound with the name "output" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.writeToNBT)
|
||||
- To the Compound, add an int with the name "chance" that contains the Chance of the Item appearing
|
||||
- Send the Message with "registerBallOfHairRecipe" as the [X] Argument, the Compound as the [Y] Argument.
|
||||
|
||||
##### Treasure Chest Recipes
|
||||
- Create an NBTTagCompound
|
||||
- To the Compound, add an NBTTagCompound with the name "output" that contains the Input ItemStack saved to NBT (To do this, just use ItemStack.writeToNBT)
|
||||
- To the Compound, add an int with the name "chance" that contains the Chance of the Item appearing
|
||||
- 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 (For Recipes without a Lens)
|
||||
- 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
|
||||
- Send the Message with "registerReconstructorRecipe" as the [X] Argument, the Compound as the [Y] Argument.
|
|
@ -16,8 +16,8 @@ import ellpeck.actuallyadditions.blocks.base.BlockStair;
|
|||
import ellpeck.actuallyadditions.blocks.base.BlockWallAA;
|
||||
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||
import ellpeck.actuallyadditions.util.CompatUtil;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.compat.CompatUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
|
|
@ -1,124 +0,0 @@
|
|||
/*
|
||||
* This file ("InterModCommunications.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2015 Ellpeck
|
||||
*/
|
||||
|
||||
package ellpeck.actuallyadditions.communication;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import ellpeck.actuallyadditions.items.ItemCoffee;
|
||||
import ellpeck.actuallyadditions.items.lens.LensNoneRecipeHandler;
|
||||
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
||||
import ellpeck.actuallyadditions.recipe.HairyBallHandler;
|
||||
import ellpeck.actuallyadditions.recipe.TreasureChestHandler;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class InterModCommunications{
|
||||
|
||||
public static void processIMC(List<FMLInterModComms.IMCMessage> messages){
|
||||
for(FMLInterModComms.IMCMessage message : messages){
|
||||
if(message.key.equalsIgnoreCase("registerCrusherRecipe")){
|
||||
NBTTagCompound compound = message.getNBTValue();
|
||||
if(compound != null){
|
||||
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){
|
||||
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();
|
||||
if(compound != null){
|
||||
ItemStack input = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("input"));
|
||||
int potionID = compound.getInteger("id");
|
||||
int duration = compound.getInteger("duration");
|
||||
int amplifier = compound.getInteger("amplifier");
|
||||
int maxAmp = compound.getInteger("maxAmp");
|
||||
|
||||
if(input != null && potionID > 0 && duration > 0 && maxAmp > 0){
|
||||
PotionEffect effect = new PotionEffect(potionID, duration, amplifier);
|
||||
ItemCoffee.registerIngredient(new ItemCoffee.Ingredient(input, new PotionEffect[]{effect}, maxAmp));
|
||||
ModUtil.LOGGER.info("Coffee Machine Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input.toString()+" -> "+effect.toString());
|
||||
}
|
||||
else{
|
||||
ModUtil.LOGGER.error("Coffee Machine Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Input, a Potion ID, a Duration or a max Amplifier!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(message.key.equalsIgnoreCase("registerBallOfHairRecipe")){
|
||||
NBTTagCompound compound = message.getNBTValue();
|
||||
if(compound != null){
|
||||
ItemStack output = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("output"));
|
||||
int chance = compound.getInteger("chance");
|
||||
|
||||
if(output != null && chance > 0){
|
||||
HairyBallHandler.addReturn(output, chance);
|
||||
ModUtil.LOGGER.info("Ball Of Hair Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+output.toString()+", Chance: "+chance);
|
||||
}
|
||||
else{
|
||||
ModUtil.LOGGER.error("Ball Of Hair Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Output or a Chance!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(message.key.equalsIgnoreCase("registerTreasureChestRecipe")){
|
||||
NBTTagCompound compound = message.getNBTValue();
|
||||
if(compound != null){
|
||||
ItemStack output = ItemStack.loadItemStackFromNBT(compound.getCompoundTag("output"));
|
||||
int chance = compound.getInteger("chance");
|
||||
int minAmount = compound.getInteger("minAmount");
|
||||
int maxAmount = compound.getInteger("maxAmount");
|
||||
|
||||
if(output != null && chance > 0 && minAmount > 0 && maxAmount >= minAmount){
|
||||
TreasureChestHandler.addReturn(output, chance, minAmount, maxAmount);
|
||||
ModUtil.LOGGER.info("Treasure Chest Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+output.toString()+", Chance: "+chance+", Min Amount: "+minAmount+", Max Amount: "+maxAmount);
|
||||
}
|
||||
else{
|
||||
ModUtil.LOGGER.error("Treasure Chest Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Output, a Chance or minimum and maximum Amounts!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
if(input != null && output != null){
|
||||
LensNoneRecipeHandler.addRecipe(input, output, energyUse);
|
||||
ModUtil.LOGGER.info("Reconstructor Recipe that was sent from Mod "+message.getSender()+" has been registered successfully: "+input+" -> "+output+" @ "+energyUse+".");
|
||||
}
|
||||
else{
|
||||
ModUtil.LOGGER.error("Reconstructor Recipe that was sent from Mod "+message.getSender()+" could not be registered: It's missing an Input or an Output!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -18,8 +18,8 @@ import ellpeck.actuallyadditions.items.metalists.TheFoods;
|
|||
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
|
||||
import ellpeck.actuallyadditions.material.InitArmorMaterials;
|
||||
import ellpeck.actuallyadditions.material.InitToolMaterials;
|
||||
import ellpeck.actuallyadditions.util.CompatUtil;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import ellpeck.actuallyadditions.util.compat.CompatUtil;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
* © 2015 Ellpeck
|
||||
*/
|
||||
|
||||
package ellpeck.actuallyadditions.util;
|
||||
package ellpeck.actuallyadditions.util.compat;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import ellpeck.actuallyadditions.items.ItemSeed;
|
Loading…
Reference in a new issue