Updated Forestry Integration and API

This commit is contained in:
Adubbz 2013-07-28 20:37:31 +10:00
parent 45d437ee43
commit 4f589a79e9
46 changed files with 1317 additions and 1327 deletions

View file

@ -1,6 +1,8 @@
package biomesoplenty.integration;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import biomesoplenty.api.Blocks;
import biomesoplenty.api.Items;
@ -9,6 +11,8 @@ import forestry.api.apiculture.FlowerManager;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
import forestry.api.core.GlobalManager;
import forestry.api.core.ItemInterface;
import forestry.api.recipes.RecipeManagers;
import forestry.api.storage.BackpackManager;
public class ForestryIntegration
@ -248,30 +252,32 @@ public class ForestryIntegration
private static void addFermenterRecipes()
{
//addFermenterRecipeSapling(new ItemStack(Blocks.saplings.get(), 1, OreDictionary.WILDCARD_VALUE));
//addFermenterRecipeSapling(new ItemStack(Blocks.colorizedSaplings.get(), 1, OreDictionary.WILDCARD_VALUE));
addFermenterRecipeSapling(new ItemStack(Blocks.saplings.get(), 1, OreDictionary.WILDCARD_VALUE));
addFermenterRecipeSapling(new ItemStack(Blocks.colorizedSaplings.get(), 1, OreDictionary.WILDCARD_VALUE));
//RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] {new ItemStack(Items.berries.get(), 1)}, new LiquidStack(ItemInterface.getItem("liquidJuice").itemID, 50), ItemInterface.getItem("mulch"), 5);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[] {new ItemStack(Items.food.get(), 0)}, new FluidStack(FluidRegistry.getFluid("juice"), 50), ItemInterface.getItem("mulch"), 5);
}
/*private static void addFermenterRecipeSapling(ItemStack resource) {
private static void addFermenterRecipeSapling(ItemStack resource)
{
RecipeManagers.fermenterManager.addRecipe(resource, 250, 1.0f,
new LiquidStack(ItemInterface.getItem("liquidBiomass").itemID, 1, ItemInterface.getItem("liquidBiomass").getItemDamage()),
new LiquidStack(Block.waterStill, 1));
FluidRegistry.getFluidStack("biomass", 1),
new FluidStack(FluidRegistry.getFluid("water"), 1));
RecipeManagers.fermenterManager.addRecipe(resource, 250, 1.0f,
new LiquidStack(ItemInterface.getItem("liquidBiomass").itemID, 1, ItemInterface.getItem("liquidBiomass").getItemDamage()),
new LiquidStack(ItemInterface.getItem("liquidJuice").itemID, 1, ItemInterface.getItem("liquidJuice").getItemDamage()));
FluidRegistry.getFluidStack("biomass", 1),
FluidRegistry.getFluidStack("juice", 1));
RecipeManagers.fermenterManager.addRecipe(resource, 250, 1.0f,
new LiquidStack(ItemInterface.getItem("liquidBiomass").itemID, 1, ItemInterface.getItem("liquidBiomass").getItemDamage()),
new LiquidStack(ItemInterface.getItem("liquidHoney").itemID, 1, ItemInterface.getItem("liquidHoney").getItemDamage()));
}*/
FluidRegistry.getFluidStack("biomass", 1),
FluidRegistry.getFluidStack("honey", 1));
}
private static void addFlowers()
{
for (int i = 0; i < 10; ++i) {
for (int i = 0; i < 10; ++i)
{
if (i != 2)
FlowerManager.plainFlowers.add(new ItemStack(Blocks.flowers.get(), 1, i));
}

View file

@ -6,11 +6,12 @@ import cpw.mods.fml.common.FMLLog;
public class BlockInterface {
/**
* Get yer blocks here!
* Rather limited function to retrieve block ids.
*
* @param ident
* @return
* @return ItemStack representing the block.
*/
@Deprecated
public static ItemStack getBlock(String ident) {
ItemStack item = null;

View file

@ -2,8 +2,13 @@ package forestry.api.core;
import java.util.ArrayList;
/**
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
*
* This enum concerns humidity.
*/
public enum EnumHumidity {
ARID("Arid", 2), NORMAL("Normal", 1), DAMP("Damp", 4);
ARID("Arid"), NORMAL("Normal"), DAMP("Damp");
/**
* Populated by Forestry with vanilla biomes. Add additional arid biomes here. (ex. desert)
@ -19,21 +24,15 @@ public enum EnumHumidity {
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
public final String name;
public final int iconIndex;
private EnumHumidity(String name, int iconIndex) {
private EnumHumidity(String name) {
this.name = name;
this.iconIndex = iconIndex;
}
public String getName() {
return this.name;
}
public int getIconIndex() {
return this.iconIndex;
}
public static ArrayList<Integer> getBiomeIds(EnumHumidity humidity) {
switch (humidity) {
case ARID:

View file

@ -6,6 +6,11 @@ import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
*
* This enum concerns temperature.
*/
public enum EnumTemperature {
NONE("None", "habitats/ocean"), ICY("Icy", "habitats/snow"), COLD("Cold", "habitats/taiga"),
NORMAL("Normal", "habitats/plains"), WARM("Warm", "habitats/jungle"), HOT("Hot", "habitats/desert"), HELLISH("Hellish", "habitats/nether");

View file

@ -5,11 +5,20 @@ import cpw.mods.fml.relauncher.SideOnly;
public class ForestryAPI {
/**
* The main mod instance for Forestry.
*/
public static Object instance;
/**
* A {@link ITextureManager} needed for some things in the API.
*/
@SideOnly(Side.CLIENT)
public static ITextureManager textureManager;
/**
* The currently active {@link IGameMode}.
*/
public static IGameMode activeMode;
}

View file

@ -0,0 +1,20 @@
package forestry.api.core;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public interface IArmorNaturalist {
/**
* Called when the naturalist's armor acts as spectacles for seeing pollinated tree leaves/flowers.
*
* @param player
* Player doing the viewing
* @param armor
* Armor item
* @param doSee
* Whether or not to actually do the side effects of viewing
* @return true if the armor actually allows the player to see pollination.
*/
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee);
}

View file

@ -11,25 +11,25 @@ public interface IGameMode {
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
* @return Value of the requested setting, false if unknown setting.
*/
boolean getBooleanSetting(String ident);
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
* @return Value of the requested setting, 0 if unknown setting.
*/
int getIntegerSetting(String ident);
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
* @return Value of the requested setting, 0 if unknown setting.
*/
float getFloatSetting(String ident);
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
* @return Value of the requested setting, an itemstack containing an apple if unknown setting.
*/
ItemStack getStackSetting(String ident);

View file

@ -5,14 +5,15 @@ import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Provides icons, needed in some interfaces, most notably for bees and trees.
*/
public interface IIconProvider {
@SideOnly(Side.CLIENT)
Icon getIcon(short texUID);
@SideOnly(Side.CLIENT)
void registerItemIcons(IconRegister itemMap);
@SideOnly(Side.CLIENT)
void registerTerrainIcons(IconRegister terrainMap);
void registerIcons(IconRegister register);
}

View file

@ -1,17 +1,32 @@
package forestry.api.core;
/**
* Plugins get loaded at the beginning of Forestry's ModsLoaded() if isAvailable() returns true.
* Optional way to hook into Forestry.
*
* Plugin classes can reside in any package, their class name however has to start with 'Plugin', i.e. 'PluginMyStuff'.
*
* @author SirSengir
*/
public interface IPlugin {
/**
* @return true if the plugin is to be loaded.
*/
public boolean isAvailable();
/**
* Called during Forestry's @PreInit.
*/
public void preInit();
/**
* Called at the start of Forestry's @PostInit.
*/
public void doInit();
/**
* Called at the end of Forestry's @PostInit.
*/
public void postInit();
}

View file

@ -3,6 +3,9 @@ package forestry.api.core;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
/**
* The basis for multiblock components.
*/
public interface ITileStructure {
/**

View file

@ -7,12 +7,12 @@ import cpw.mods.fml.common.FMLLog;
public class ItemInterface {
/**
* Get yer items here!
* Get items here!
*
* Blocks currently not supported.
*
* @param ident
* @return
* @return ItemStack representing the item, null if not found.
*/
public static ItemStack getItem(String ident) {
ItemStack item = null;
@ -33,85 +33,4 @@ public class ItemInterface {
return item;
}
/*
* public static Item fertilizerBio; public static Item fertilizerCompound; public static Item apatite;
*
* // Ingots public static ItemStack ingotCopper; public static ItemStack ingotTin; public static ItemStack ingotBronze;
*
* public static Item wrench; public static Item bucketBiomass; public static Item vialEmpty; public static Item vialCatalyst; public static Item
* liquidBiomass; public static Item liquidBiofuel; public static Item bucketBiofuel; public static Item liquidMilk;
*
* // Crafting public static Item sturdyMachine; public static Item hardenedMachine; public static Item craftingMaterial;
*
* // Rainmaker public static Item iodineCapsule;
*
* // Gears public static Item gearBronze; public static Item gearCopper; public static Item gearTin;
*
* // Carpenter public static Item oakStick; public static Item woodPulp; public static Item carton; public static Item crate;
*
* // Tools public static Item bronzePickaxe; public static Item brokenBronzePickaxe; public static Item kitPickaxe; public static Item bronzeShovel; public
* static Item brokenBronzeShovel; public static Item kitShovel;
*
* // Do not touch - contagious! public static Item tent;
*
* // Moistener public static Item mouldyWheat; public static Item decayingWheat; public static Item mulch;
*
* // Peat public static Item peat; public static Item bituminousPeat; public static Item ash;
*
* // Bees public static Item beeQueen; public static Item beeDrone; public static Item beePrincess; public static Item beeQueenGE; public static Item
* beeDroneGE; public static Item beePrincessGE;
*
* public static Item beealyzer;
*
* public static Item honeyDrop; public static Item scoop; public static Item beeswax; public static Item pollen; public static Item propolis; public static
* Item honeydew; public static Item royalJelly; public static Item honeyedSlice; public static Item shortMead; public static Item ambrosia; public static
* Item honeyPot; public static Item phosphor; public static Item refractoryWax;
*
* // Apiarist's Armor public static Item apiaristHat; public static Item apiaristChest; public static Item apiaristLegs; public static Item apiaristBoots;
*
* // Combs public static Item beeComb;
*
* public static Item honeyComb; public static Item cocoaComb; public static Item simmeringComb; public static Item stringyComb; public static Item
* frozenComb; public static Item drippingComb;
*
* // Backpacks public static Item apiaristBackpack; public static Item minerBackpack; public static Item diggerBackpack; public static Item
* foresterBackpack; public static Item hunterBackpack; public static Item masonBackpack; // unused/null public static Item dyerBackpack; // unused/null
* public static Item railroaderBackpack; // unused/null public static Item tinkererBackpack; // unused/null public static Item adventurerBackpack; // T2
* public static Item minerBackpackT2; public static Item diggerBackpackT2; public static Item foresterBackpackT2; public static Item hunterBackpackT2;
* public static Item masonBackpackT2; // unused/null public static Item dyerBackpackT2; // unused/null public static Item railroaderBackpackT2; //
* unused/null public static Item tinkererBackpackT2; // unused/null public static Item adventurerBackpackT2;
*
* // Liquids public static Item liquidSeedOil; public static Item liquidJuice; public static Item liquidHoney;
*
* // Capsules public static Item waxCapsule; public static Item waxCapsuleWater; public static Item waxCapsuleBiomass; public static Item
* waxCapsuleBiofuel; public static Item waxCapsuleOil; public static Item waxCapsuleFuel; public static Item waxCapsuleSeedOil; public static Item
* waxCapsuleHoney; public static Item waxCapsuleJuice;
*
* // Refractory Capsules public static Item refractoryEmpty; public static Item refractoryWater; public static Item refractoryBiomass; public static Item
* refractoryBiofuel; public static Item refractoryOil; public static Item refractoryFuel; public static Item refractoryLava; public static Item
* refractorySeedOil; public static Item refractoryHoney; public static Item refractoryJuice;
*
* // Cans public static Item canWater; public static Item canEmpty; public static Item canBiomass; public static Item canBiofuel; public static Item
* canOil; public static Item canFuel; public static Item canLava; public static Item canSeedOil; public static Item canHoney; public static Item canJuice;
*
* // Crating public static ItemGenericCrate cratedWood; public static ItemGenericCrate cratedCobblestone; public static ItemGenericCrate cratedDirt; public
* static ItemGenericCrate cratedStone; public static ItemGenericCrate cratedBrick; public static ItemGenericCrate cratedCacti; public static
* ItemGenericCrate cratedSand; public static ItemGenericCrate cratedObsidian; public static ItemGenericCrate cratedNetherrack; public static
* ItemGenericCrate cratedSoulsand; public static ItemGenericCrate cratedSandstone; public static ItemGenericCrate cratedBogearth; public static
* ItemGenericCrate cratedHumus; public static ItemGenericCrate cratedNetherbrick; public static ItemGenericCrate cratedPeat; public static ItemGenericCrate
* cratedApatite; public static ItemGenericCrate cratedFertilizer; public static ItemGenericCrate cratedTin; public static ItemGenericCrate cratedCopper;
* public static ItemGenericCrate cratedBronze; public static ItemGenericCrate cratedWheat; public static ItemGenericCrate cratedMycelium; public static
* ItemGenericCrate cratedMulch; public static ItemGenericCrate cratedSilver; public static ItemGenericCrate cratedBrass; public static ItemGenericCrate
* cratedNikolite; public static ItemGenericCrate cratedCookies; public static ItemGenericCrate cratedHoneycombs; public static ItemGenericCrate
* cratedBeeswax; public static ItemGenericCrate cratedPollen; public static ItemGenericCrate cratedPropolis; public static ItemGenericCrate cratedHoneydew;
* public static ItemGenericCrate cratedRoyalJelly; public static ItemGenericCrate cratedCocoaComb; public static ItemGenericCrate cratedRedstone; public
* static ItemGenericCrate cratedLapis; public static ItemGenericCrate cratedReeds; public static ItemGenericCrate cratedClay; public static
* ItemGenericCrate cratedGlowstone; public static ItemGenericCrate cratedApples; public static ItemGenericCrate cratedNetherwart; public static
* ItemGenericCrate cratedResin; public static ItemGenericCrate cratedRubber; public static ItemGenericCrate cratedScrap; public static ItemGenericCrate
* cratedUUM; public static ItemGenericCrate cratedSimmeringCombs; public static ItemGenericCrate cratedStringyCombs; public static ItemGenericCrate
* cratedFrozenCombs; public static ItemGenericCrate cratedDrippingCombs; public static ItemGenericCrate cratedRefractoryWax; public static ItemGenericCrate
* cratedPhosphor; public static ItemGenericCrate cratedAsh; public static ItemGenericCrate cratedCharcoal; public static ItemGenericCrate cratedGravel;
* public static ItemGenericCrate cratedCoal; public static ItemGenericCrate cratedSeeds; public static ItemGenericCrate cratedSaplings;
*/
}

View file

@ -4,7 +4,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
* Optional annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
*
* @author SirSengir
*/

View file

@ -2,6 +2,9 @@ package forestry.api.core;
import net.minecraft.creativetab.CreativeTabs;
/**
* References to the specialised tabs added by Forestry to creative inventory.
*/
public class Tabs {
public static CreativeTabs tabApiculture;

View file

@ -1,12 +1,13 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
public class EngineBronzeFuel {
/**
* Item that is valid fuel for a biogas engine.
*/
public final ItemStack liquid;
public final Fluid liquid;
/**
* Power produced by this fuel per work cycle of the engine.
*/
@ -20,7 +21,7 @@ public class EngineBronzeFuel {
*/
public final int dissipationMultiplier;
public EngineBronzeFuel(ItemStack liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
public EngineBronzeFuel(Fluid liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
this.liquid = liquid;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;

View file

@ -3,28 +3,30 @@ package forestry.api.fuels;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
public class FuelManager {
/**
* Add new fuels for the fermenter here (i.e. fertilizer)
* Add new fuels for the fermenter here (i.e. fertilizer). Will accept Items, ItemStacks and Strings (Ore Dictionary)
*/
public static HashMap<ItemStack, FermenterFuel> fermenterFuel = new ItemStackMap<FermenterFuel>();
public static HashMap<Object, FermenterFuel> fermenterFuel;
/**
* Add new resources for the moistener here (i.e. wheat)
*/
public static HashMap<ItemStack, MoistenerFuel> moistenerResource = new ItemStackMap<MoistenerFuel>();
public static HashMap<Object, MoistenerFuel> moistenerResource;
/**
* Add new substrates for the rainmaker here
*/
public static HashMap<ItemStack, RainSubstrate> rainSubstrate = new ItemStackMap<RainSubstrate>();
public static HashMap<Object, RainSubstrate> rainSubstrate;
/**
* Add new fuels for EngineBronze (= biogas engine) here
*/
public static HashMap<ItemStack, EngineBronzeFuel> bronzeEngineFuel = new ItemStackMap<EngineBronzeFuel>();
public static HashMap<Object, EngineBronzeFuel> bronzeEngineFuel;
/**
* Add new fuels for EngineCopper (= peat-fired engine) here
*/
public static HashMap<ItemStack, EngineCopperFuel> copperEngineFuel = new ItemStackMap<EngineCopperFuel>();
public static HashMap<Object, EngineCopperFuel> copperEngineFuel;
// Generator fuel list in GeneratorFuel.class
}

View file

@ -2,27 +2,29 @@ package forestry.api.fuels;
import java.util.HashMap;
import net.minecraftforge.fluids.FluidStack;
public class GeneratorFuel {
public static HashMap<Integer, GeneratorFuel> fuels = new HashMap<Integer, GeneratorFuel>();
public static HashMap<FluidStack, GeneratorFuel> fuels = new HashMap<FluidStack, GeneratorFuel>();
/**
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
*/
//public final LiquidStack fuelConsumed;
public final FluidStack fuelConsumed;
/**
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
*/
//public final int eu;
public final int eu;
/**
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
*/
//public final int rate;
public final int rate;
/*public GeneratorFuel(LiquidStack fuelConsumed, int eu, int rate) {
public GeneratorFuel(FluidStack fuelConsumed, int eu, int rate) {
this.fuelConsumed = fuelConsumed;
this.eu = eu;
this.rate = rate;
}*/
}
}

View file

@ -1,56 +0,0 @@
package forestry.api.fuels;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
public class ItemStackMap<T> extends HashMap<ItemStack, T> {
private static final long serialVersionUID = 5383477742290646466L;
@Override
public boolean containsKey(Object key) {
for (Map.Entry<ItemStack, T> entry : this.entrySet())
if (areItemStacksEqual(entry.getKey(), key))
return true;
return super.containsKey(key);
}
@Override
public T remove(Object key) {
Iterator<Map.Entry<ItemStack, T>> iterator = this.entrySet().iterator();
;
while (iterator.hasNext()) {
Map.Entry<ItemStack, T> entry = iterator.next();
if (areItemStacksEqual(entry.getKey(), key))
iterator.remove();
}
return super.remove(key);
}
@Override
public T get(Object key) {
for (Map.Entry<ItemStack, T> entry : this.entrySet())
if (areItemStacksEqual(entry.getKey(), key))
return entry.getValue();
return super.get(key);
}
private boolean areItemStacksEqual(ItemStack a, Object b) {
if (a == null || b == null)
return false;
if (b instanceof ItemStack)
return ItemStack.areItemStackTagsEqual(a, (ItemStack) b) && a.isItemEqual((ItemStack) b);
//else if (b instanceof LiquidStack)
//return ItemStack.areItemStackTagsEqual(a, ((LiquidStack) b).asItemStack()) && a.isItemEqual(((LiquidStack) b).asItemStack());
else if (b instanceof Integer)
return ((Integer) b).equals(a.itemID);
else if (b instanceof Item)
return ((Item) b).itemID == a.itemID;
return false;
}
}

View file

@ -1,5 +1,7 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the bottler.
@ -7,7 +9,7 @@ package forestry.api.recipes;
* The manager is initialized at the beginning of Forestry's BaseMod.load() cycle. Begin adding recipes in BaseMod.ModsLoaded() and this shouldn't be null even
* if your mod loads before Forestry.
*
* Accessible via {@link RecipeManagers.bottlerManager}
* Accessible via {@link RecipeManagers}
*
* Note that this is untested with anything other than biofuel->fuelcan conversion.
*
@ -21,14 +23,12 @@ public interface IBottlerManager extends ICraftingProvider {
* @param cyclesPerUnit
* Amount of work cycles required to run through the conversion once.
* @param input
* ItemStack representing the input liquid.
* @param inputAmount
* Amount of liquid required for a single conversion.
* LiquidStack representing the input liquid.
* @param can
* ItemStack representing the cans, capsules and/or cells required
* @param bottled
* ItemStack representing the finished product
*/
//@Deprecated
//public void addRecipe(int cyclesPerUnit, LiquidStack input, ItemStack can, ItemStack bottled);
@Deprecated
public void addRecipe(int cyclesPerUnit, FluidStack input, ItemStack can, ItemStack bottled);
}

View file

@ -2,6 +2,7 @@ package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the carpenter.
@ -9,7 +10,7 @@ import net.minecraft.item.crafting.ShapedRecipes;
* The manager is initialized at the beginning of Forestry's BaseMod.load() cycle. Begin adding recipes in BaseMod.ModsLoaded() and this shouldn't be null even
* if your mod loads before Forestry.
*
* Accessible via {@link RecipeManagers.carpenterManager}
* Accessible via {@link RecipeManagers}
*
* Only shaped recipes can be added currently.
*
@ -47,10 +48,8 @@ public interface ICarpenterManager extends ICraftingProvider {
*
* @param packagingTime
* Number of work cycles required to craft the recipe once.
* @param liquidId
* Id of liquid required in tank. Anything other than Block.waterStill.blockId is untested!
* @param liquidAmount
* Amount of liquid required to craft the recipe once. One bucket of water = one unit on the carpenter's tank = 1000.
* @param liquid
* Liquid required in carpenter's tank.
* @param box
* ItemStack of one item representing the required box (carton, crate) for this recipe. May be null.
* @param product
@ -58,7 +57,7 @@ public interface ICarpenterManager extends ICraftingProvider {
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
//public void addRecipe(int packagingTime, LiquidStack liquid, ItemStack box, ItemStack product, Object materials[]);
public void addRecipe(int packagingTime, FluidStack liquid, ItemStack box, ItemStack product, Object materials[]);
public void addCrating(String toCrate, ItemStack unpack, ItemStack crated);

View file

@ -10,7 +10,7 @@ import net.minecraft.item.ItemStack;
* The manager is initialized at the beginning of Forestry's BaseMod.load() cycle. Begin adding recipes in BaseMod.ModsLoaded() and this shouldn't be null even
* if your mod loads before Forestry.
*
* Accessible via {@link RecipeManagers.centrifugeManager}
* Accessible via {@link RecipeManagers}
*
* @author SirSengir
*/
@ -38,7 +38,7 @@ public interface ICentrifugeManager extends ICraftingProvider {
* @param produce
* Array of ItemStacks that can be the result of this recipe.
* @param chances
* Array of integers corresponding and matching to {@link produce} providing the chance (0-100) for the ItemStack at the given index to be
* Array of integers corresponding and matching to produce providing the chance (0-100) for the ItemStack at the given index to be
* produced.
*/
public void addRecipe(int timePerItem, ItemStack resource, ItemStack[] produce, int[] chances);

View file

@ -1,19 +1,12 @@
package forestry.api.recipes;
import java.util.List;
import java.util.Map;
import net.minecraft.item.ItemStack;
public interface ICraftingProvider {
/**
* DOES NOT WORK FOR MANY MACHINES, DON'T USE IT!
*
* Access to the full list of recipes contained in the crafting provider.
*
* @return List of the given format where the first array represents inputs and the second outputs. Input and output liquids are returned as itemstacks as
* well, representing itemID and damage.
* @return List of the given format where the first array represents inputs and the second outputs. Objects can be either ItemStack or LiquidStack.
*/
@Deprecated
public List<Map.Entry<ItemStack[], ItemStack[]>> getRecipes();
public Map<Object[], Object[]> getRecipes();
}

View file

@ -1,10 +1,12 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public interface IFabricatorManager extends ICraftingProvider {
//void addRecipe(ItemStack plan, LiquidStack molten, ItemStack result, Object[] pattern);
void addRecipe(ItemStack plan, FluidStack molten, ItemStack result, Object[] pattern);
//void addSmelting(ItemStack resource, LiquidStack molten, int meltingPoint);
void addSmelting(ItemStack resource, FluidStack molten, int meltingPoint);
}

View file

@ -1,5 +1,7 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the fermenter.
@ -7,7 +9,7 @@ package forestry.api.recipes;
* The manager is initialized at the beginning of Forestry's BaseMod.load() cycle. Begin adding recipes in BaseMod.ModsLoaded() and this shouldn't be null even
* if your mod loads before Forestry.
*
* Accessible via {@link RecipeManagers.fermenterManager}
* Accessible via {@link RecipeManagers}
*
* @author SirSengir
*/
@ -27,7 +29,7 @@ public interface IFermenterManager extends ICraftingProvider {
* @param liquid
* LiquidStack representing resource liquid and amount.
*/
//public void addRecipe(ItemStack resource, int fermentationValue, float modifier, LiquidStack output, LiquidStack liquid);
public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output, FluidStack liquid);
/**
* Add a recipe to the fermenter. Defaults to water as input liquid.
@ -41,6 +43,6 @@ public interface IFermenterManager extends ICraftingProvider {
* @param output
* LiquidStack representing output liquid. Amount is determined by fermentationValue*modifier.
*/
//public void addRecipe(ItemStack resource, int fermentationValue, float modifier, LiquidStack output);
public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output);
}

View file

@ -8,7 +8,7 @@ import net.minecraft.item.ItemStack;
* The manager is initialized at the beginning of Forestry's BaseMod.load() cycle. Begin adding recipes in BaseMod.ModsLoaded() and this shouldn't be null even
* if your mod loads before Forestry.
*
* Accessible via {@link RecipeManagers.moistenerManager}
* Accessible via {@link RecipeManagers}
*
* @author SirSengir
*/

View file

@ -1,5 +1,7 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the suqeezer.
@ -7,7 +9,7 @@ package forestry.api.recipes;
* The manager is initialized at the beginning of Forestry's BaseMod.load() cycle. Begin adding recipes in BaseMod.ModsLoaded() and this shouldn't be null even
* if your mod loads before Forestry.
*
* Accessible via {@link RecipeManagers.squeezerManager}
* Accessible via {@link RecipeManagers}
*
* @author SirSengir
*/
@ -21,13 +23,13 @@ public interface ISqueezerManager extends ICraftingProvider {
* @param resources
* Array of item stacks representing the required resources for one process. Stack size will be taken into account.
* @param liquid
* {@link LiquidStack} representing the output of this recipe.
* {@link FluidStack} representing the output of this recipe.
* @param remnants
* Item stack representing the possible remnants from this recipe.
* @param chance
* Chance remnants will be produced by a single recipe cycle.
*/
//public void addRecipe(int timePerItem, ItemStack[] resources, LiquidStack liquid, ItemStack remnants, int chance);
public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid, ItemStack remnants, int chance);
/**
* Add a recipe to the squeezer.
@ -37,7 +39,7 @@ public interface ISqueezerManager extends ICraftingProvider {
* @param resources
* Array of item stacks representing the required resources for one process. Stack size will be taken into account.
* @param liquid
* {@link LiquidStack} representing the output of this recipe.
* {@link FluidStack} representing the output of this recipe.
*/
//public void addRecipe(int timePerItem, ItemStack[] resources, LiquidStack liquid);
public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid);
}

View file

@ -1,5 +1,6 @@
package forestry.api.recipes;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the still.
@ -7,7 +8,7 @@ package forestry.api.recipes;
* The manager is initialized at the beginning of Forestry's BaseMod.load() cycle. Begin adding recipes in BaseMod.ModsLoaded() and this shouldn't be null even
* if your mod loads before Forestry.
*
* Accessible via {@link RecipeManagers.stillManager}
* Accessible via {@link RecipeManagers}
*
* Note that this is untested with anything other than biomass->biofuel conversion.
*
@ -24,5 +25,5 @@ public interface IStillManager extends ICraftingProvider {
* @param output
* ItemStack representing the output liquid
*/
//public void addRecipe(int cyclesPerUnit, LiquidStack input, LiquidStack output);
public void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output);
}

View file

@ -1,5 +1,7 @@
package forestry.api.recipes;
import java.util.Collection;
/**
* Contains all available recipe managers for Forestry machines and items.
*
@ -7,6 +9,8 @@ package forestry.api.recipes;
*/
public class RecipeManagers {
public static Collection<ICraftingProvider> craftingProviders;
/**
* Allows you to add recipes to the bottler. See {@link IBottlerManager} for details.
*/

View file

@ -0,0 +1,18 @@
package forestry.api.storage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.event.Event;
public abstract class BackpackEvent extends Event {
public final EntityPlayer player;
public final IBackpackDefinition backpackDefinition;
public final IInventory backpackInventory;
public BackpackEvent(EntityPlayer player, IBackpackDefinition backpackDefinition, IInventory backpackInventory) {
this.player = player;
this.backpackDefinition = backpackDefinition;
this.backpackInventory = backpackInventory;
}
}

View file

@ -0,0 +1,18 @@
package forestry.api.storage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraftforge.event.Cancelable;
/**
* Use @ForgeSubscribe on a method taking this event as an argument. Will fire whenever a backpack tries to resupply to a player inventory. Processing will stop
* if the event is canceled.
*/
@Cancelable
public class BackpackResupplyEvent extends BackpackEvent {
public BackpackResupplyEvent(EntityPlayer player, IBackpackDefinition backpackDefinition, IInventory backpackInventory) {
super(player, backpackDefinition, backpackInventory);
}
}

View file

@ -0,0 +1,21 @@
package forestry.api.storage;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.Cancelable;
/**
* Use @ForgeSubscribe on a method taking this event as an argument. Will fire whenever a backpack tries to store an item. Processing will stop if the stacksize
* of stackToStow drops to 0 or less or the event is canceled.
*/
@Cancelable
public class BackpackStowEvent extends BackpackEvent {
public final ItemStack stackToStow;
public BackpackStowEvent(EntityPlayer player, IBackpackDefinition backpackDefinition, IInventory backpackInventory, ItemStack stackToStow) {
super(player, backpackDefinition, backpackInventory);
this.stackToStow = stackToStow;
}
}

View file

@ -38,7 +38,7 @@ public interface IBackpackDefinition {
* Returns an arraylist of all items valid for this backpack type.
*
* @param player
* @return
* @return Collection of itemstack which are valid items for this backpack type. May be empty or null and does not necessarily include all valid items.
*/
Collection<ItemStack> getValidItems(EntityPlayer player);
@ -47,7 +47,7 @@ public interface IBackpackDefinition {
*
* @param player
* @param itemstack
* @return
* @return true if the given itemstack is valid for this backpack, false otherwise.
*/
boolean isValidItem(EntityPlayer player, ItemStack itemstack);