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

@ -1,12 +1,12 @@
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
public class FlowerManager {
/**
* ItemStacks representing simple flower blocks. Meta-sensitive, processed by the basic {@link IFlowerProvider}.
*/
public static ArrayList<ItemStack> plainFlowers = new ArrayList<ItemStack>();
}
package forestry.api.apiculture;
import java.util.ArrayList;
import net.minecraft.item.ItemStack;
public class FlowerManager {
/**
* ItemStacks representing simple flower blocks. Meta-sensitive, processed by the basic {@link IFlowerProvider}.
*/
public static ArrayList<ItemStack> plainFlowers = new ArrayList<ItemStack>();
}

View File

@ -1,33 +1,34 @@
package forestry.api.core;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class BlockInterface {
/**
* Get yer blocks here!
*
* @param ident
* @return
*/
public static ItemStack getBlock(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryBlock";
Object obj = Class.forName(itemClass).getField(ident).get(null);
if (obj instanceof Block)
item = new ItemStack((Block) obj);
else if (obj instanceof ItemStack)
item = (ItemStack) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry block identified by: " + ident);
}
return item;
}
}
package forestry.api.core;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class BlockInterface {
/**
* Rather limited function to retrieve block ids.
*
* @param ident
* @return ItemStack representing the block.
*/
@Deprecated
public static ItemStack getBlock(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryBlock";
Object obj = Class.forName(itemClass).getField(ident).get(null);
if (obj instanceof Block)
item = new ItemStack((Block) obj);
else if (obj instanceof ItemStack)
item = (ItemStack) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry block identified by: " + ident);
}
return item;
}
}

View File

@ -1,48 +1,47 @@
package forestry.api.core;
import java.util.ArrayList;
public enum EnumHumidity {
ARID("Arid", 2), NORMAL("Normal", 1), DAMP("Damp", 4);
/**
* Populated by Forestry with vanilla biomes. Add additional arid biomes here. (ex. desert)
*/
public static ArrayList<Integer> aridBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional damp biomes here. (ex. jungle)
*/
public static ArrayList<Integer> dampBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here.
*/
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
public final String name;
public final int iconIndex;
private EnumHumidity(String name, int iconIndex) {
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:
return aridBiomeIds;
case DAMP:
return dampBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
}
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"), NORMAL("Normal"), DAMP("Damp");
/**
* Populated by Forestry with vanilla biomes. Add additional arid biomes here. (ex. desert)
*/
public static ArrayList<Integer> aridBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional damp biomes here. (ex. jungle)
*/
public static ArrayList<Integer> dampBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here.
*/
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
public final String name;
private EnumHumidity(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public static ArrayList<Integer> getBiomeIds(EnumHumidity humidity) {
switch (humidity) {
case ARID:
return aridBiomeIds;
case DAMP:
return dampBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
}

View File

@ -1,74 +1,79 @@
package forestry.api.core;
import java.util.ArrayList;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
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");
/**
* Populated by Forestry with vanilla biomes. Add additional icy/snow biomes here. (ex. snow plains)
*/
public static ArrayList<Integer> icyBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional cold biomes here. (ex. taiga)
*/
public static ArrayList<Integer> coldBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here. (ex. forest, plains)
*/
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional warm biomes here. (ex. jungle)
*/
public static ArrayList<Integer> warmBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hot biomes here. (ex. desert)
*/
public static ArrayList<Integer> hotBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hellish biomes here. (ex. nether)
*/
public static ArrayList<Integer> hellishBiomeIds = new ArrayList<Integer>();
public final String name;
public final String iconIndex;
private EnumTemperature(String name, String iconIndex) {
this.name = name;
this.iconIndex = iconIndex;
}
public String getName() {
return this.name;
}
@SideOnly(Side.CLIENT)
public Icon getIcon() {
return ForestryAPI.textureManager.getDefault(iconIndex);
}
public static ArrayList<Integer> getBiomeIds(EnumTemperature temperature) {
switch (temperature) {
case ICY:
return icyBiomeIds;
case COLD:
return coldBiomeIds;
case WARM:
return warmBiomeIds;
case HOT:
return hotBiomeIds;
case HELLISH:
return hellishBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
}
package forestry.api.core;
import java.util.ArrayList;
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");
/**
* Populated by Forestry with vanilla biomes. Add additional icy/snow biomes here. (ex. snow plains)
*/
public static ArrayList<Integer> icyBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional cold biomes here. (ex. taiga)
*/
public static ArrayList<Integer> coldBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional normal biomes here. (ex. forest, plains)
*/
public static ArrayList<Integer> normalBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional warm biomes here. (ex. jungle)
*/
public static ArrayList<Integer> warmBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hot biomes here. (ex. desert)
*/
public static ArrayList<Integer> hotBiomeIds = new ArrayList<Integer>();
/**
* Populated by Forestry with vanilla biomes. Add additional hellish biomes here. (ex. nether)
*/
public static ArrayList<Integer> hellishBiomeIds = new ArrayList<Integer>();
public final String name;
public final String iconIndex;
private EnumTemperature(String name, String iconIndex) {
this.name = name;
this.iconIndex = iconIndex;
}
public String getName() {
return this.name;
}
@SideOnly(Side.CLIENT)
public Icon getIcon() {
return ForestryAPI.textureManager.getDefault(iconIndex);
}
public static ArrayList<Integer> getBiomeIds(EnumTemperature temperature) {
switch (temperature) {
case ICY:
return icyBiomeIds;
case COLD:
return coldBiomeIds;
case WARM:
return warmBiomeIds;
case HOT:
return hotBiomeIds;
case HELLISH:
return hellishBiomeIds;
case NORMAL:
default:
return normalBiomeIds;
}
}
}

View File

@ -1,15 +1,24 @@
package forestry.api.core;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ForestryAPI {
public static Object instance;
@SideOnly(Side.CLIENT)
public static ITextureManager textureManager;
public static IGameMode activeMode;
}
package forestry.api.core;
import cpw.mods.fml.relauncher.Side;
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

@ -1,12 +1,12 @@
package forestry.api.core;
import java.util.ArrayList;
public class GlobalManager {
public static ArrayList<Integer> dirtBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> sandBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> leafBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> snowBlockIds = new ArrayList<Integer>();
}
package forestry.api.core;
import java.util.ArrayList;
public class GlobalManager {
public static ArrayList<Integer> dirtBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> sandBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> leafBlockIds = new ArrayList<Integer>();
public static ArrayList<Integer> snowBlockIds = new ArrayList<Integer>();
}

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

@ -1,36 +1,36 @@
package forestry.api.core;
import net.minecraft.item.ItemStack;
public interface IGameMode {
/**
* @return Human-readable identifier for the game mode. (i.e. 'EASY', 'NORMAL', 'HARD')
*/
String getIdentifier();
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
*/
boolean getBooleanSetting(String ident);
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
*/
int getIntegerSetting(String ident);
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
*/
float getFloatSetting(String ident);
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @return
*/
ItemStack getStackSetting(String ident);
}
package forestry.api.core;
import net.minecraft.item.ItemStack;
public interface IGameMode {
/**
* @return Human-readable identifier for the game mode. (i.e. 'EASY', 'NORMAL', 'HARD')
*/
String getIdentifier();
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @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 Value of the requested setting, 0 if unknown setting.
*/
int getIntegerSetting(String ident);
/**
* @param ident Identifier for the setting. (See the gamemode config.)
* @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 Value of the requested setting, an itemstack containing an apple if unknown setting.
*/
ItemStack getStackSetting(String ident);
}

View File

@ -1,18 +1,19 @@
package forestry.api.core;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public interface IIconProvider {
@SideOnly(Side.CLIENT)
Icon getIcon(short texUID);
@SideOnly(Side.CLIENT)
void registerItemIcons(IconRegister itemMap);
@SideOnly(Side.CLIENT)
void registerTerrainIcons(IconRegister terrainMap);
}
package forestry.api.core;
import net.minecraft.client.renderer.texture.IconRegister;
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 registerIcons(IconRegister register);
}

View File

@ -1,9 +1,9 @@
package forestry.api.core;
import net.minecraft.nbt.NBTTagCompound;
public interface INBTTagable {
void readFromNBT(NBTTagCompound nbttagcompound);
void writeToNBT(NBTTagCompound nbttagcompound);
}
package forestry.api.core;
import net.minecraft.nbt.NBTTagCompound;
public interface INBTTagable {
void readFromNBT(NBTTagCompound nbttagcompound);
void writeToNBT(NBTTagCompound nbttagcompound);
}

View File

@ -1,17 +1,32 @@
package forestry.api.core;
/**
* Plugins get loaded at the beginning of Forestry's ModsLoaded() if isAvailable() returns true.
*
* @author SirSengir
*/
public interface IPlugin {
public boolean isAvailable();
public void preInit();
public void doInit();
public void postInit();
}
package forestry.api.core;
/**
* 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

@ -1,15 +1,15 @@
package forestry.api.core;
public interface IStructureLogic extends INBTTagable {
/**
* @return String unique to the type of structure controlled by this structure logic.
*/
String getTypeUID();
/**
* Called by {@link ITileStructure}'s validateStructure().
*/
void validateStructure();
}
package forestry.api.core;
public interface IStructureLogic extends INBTTagable {
/**
* @return String unique to the type of structure controlled by this structure logic.
*/
String getTypeUID();
/**
* Called by {@link ITileStructure}'s validateStructure().
*/
void validateStructure();
}

View File

@ -1,15 +1,15 @@
package forestry.api.core;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface ITextureManager {
void registerIconProvider(IIconProvider provider);
Icon getIcon(short texUID);
Icon getDefault(String ident);
}
package forestry.api.core;
import net.minecraft.util.Icon;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public interface ITextureManager {
void registerIconProvider(IIconProvider provider);
Icon getIcon(short texUID);
Icon getDefault(String ident);
}

View File

@ -1,55 +1,58 @@
package forestry.api.core;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
public interface ITileStructure {
/**
* @return String unique to the type of structure controlled by this structure logic. Should map to {@link IStructureLogic}
*/
String getTypeUID();
/**
* Should map to {@link IStructureLogic}
*/
void validateStructure();
/**
* Called when the structure resets.
*/
void onStructureReset();
/**
* @return TileEntity that is the master in this structure, null if no structure exists.
*/
ITileStructure getCentralTE();
/**
* Called to set the master TileEntity. Implementing TileEntity should keep track of the master's coordinates, not refer to the TE object itself.
*
* @param tile
*/
void setCentralTE(TileEntity tile);
/**
* @return IInventory representing the TE's inventory.
*/
IInventory getInventory();
/**
* Only called on Forestry's own blocks.
*/
void makeMaster();
/**
* @return true if this TE is the master in a structure, false otherwise.
*/
boolean isMaster();
/**
* @return true if the TE is master or has a master.
*/
boolean isIntegratedIntoStructure();
}
package forestry.api.core;
import net.minecraft.inventory.IInventory;
import net.minecraft.tileentity.TileEntity;
/**
* The basis for multiblock components.
*/
public interface ITileStructure {
/**
* @return String unique to the type of structure controlled by this structure logic. Should map to {@link IStructureLogic}
*/
String getTypeUID();
/**
* Should map to {@link IStructureLogic}
*/
void validateStructure();
/**
* Called when the structure resets.
*/
void onStructureReset();
/**
* @return TileEntity that is the master in this structure, null if no structure exists.
*/
ITileStructure getCentralTE();
/**
* Called to set the master TileEntity. Implementing TileEntity should keep track of the master's coordinates, not refer to the TE object itself.
*
* @param tile
*/
void setCentralTE(TileEntity tile);
/**
* @return IInventory representing the TE's inventory.
*/
IInventory getInventory();
/**
* Only called on Forestry's own blocks.
*/
void makeMaster();
/**
* @return true if this TE is the master in a structure, false otherwise.
*/
boolean isMaster();
/**
* @return true if the TE is master or has a master.
*/
boolean isIntegratedIntoStructure();
}

View File

@ -1,8 +1,8 @@
package forestry.api.core;
/**
* Marks a tool as a scoop.
*/
public interface IToolScoop {
}
package forestry.api.core;
/**
* Marks a tool as a scoop.
*/
public interface IToolScoop {
}

View File

@ -1,117 +1,36 @@
package forestry.api.core;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class ItemInterface {
/**
* Get yer items here!
*
* Blocks currently not supported.
*
* @param ident
* @return
*/
public static ItemStack getItem(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryItem";
Object obj = Class.forName(itemClass).getField(ident).get(null);
if (obj instanceof Item)
item = new ItemStack((Item) obj);
else if (obj instanceof ItemStack)
item = (ItemStack) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry item identified by: " + ident);
}
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;
*/
}
package forestry.api.core;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLLog;
public class ItemInterface {
/**
* Get items here!
*
* Blocks currently not supported.
*
* @param ident
* @return ItemStack representing the item, null if not found.
*/
public static ItemStack getItem(String ident) {
ItemStack item = null;
try {
String pack = ItemInterface.class.getPackage().getName();
pack = pack.substring(0, pack.lastIndexOf('.'));
String itemClass = pack.substring(0, pack.lastIndexOf('.')) + ".core.config.ForestryItem";
Object obj = Class.forName(itemClass).getField(ident).get(null);
if (obj instanceof Item)
item = new ItemStack((Item) obj);
else if (obj instanceof ItemStack)
item = (ItemStack) obj;
} catch (Exception ex) {
FMLLog.warning("Could not retrieve Forestry item identified by: " + ident);
}
return item;
}
}

View File

@ -1,49 +1,49 @@
package forestry.api.core;
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.
*
* @author SirSengir
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface PluginInfo {
/**
* @return Unique identifier for the plugin, no spaces!
*/
String pluginID();
/**
* @return Nice and readable plugin name.
*/
String name();
/**
* @return Plugin author's name.
*/
String author() default "";
/**
* @return URL of plugin homepage.
*/
String url() default "";
/**
* @return Version of the plugin, if any.
*/
String version() default "";
/**
* @return Short description what the plugin does.
*/
String description() default "";
/**
* @return Not used (yet?).
*/
String help() default "";
}
package forestry.api.core;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Optional annotation to provide additional information on IPlugins. This information will be available via the "/forestry plugin info $pluginID" command ingame.
*
* @author SirSengir
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface PluginInfo {
/**
* @return Unique identifier for the plugin, no spaces!
*/
String pluginID();
/**
* @return Nice and readable plugin name.
*/
String name();
/**
* @return Plugin author's name.
*/
String author() default "";
/**
* @return URL of plugin homepage.
*/
String url() default "";
/**
* @return Version of the plugin, if any.
*/
String version() default "";
/**
* @return Short description what the plugin does.
*/
String description() default "";
/**
* @return Not used (yet?).
*/
String help() default "";
}

View File

@ -1,11 +1,14 @@
package forestry.api.core;
import net.minecraft.creativetab.CreativeTabs;
public class Tabs {
public static CreativeTabs tabApiculture;
public static CreativeTabs tabArboriculture;
public static CreativeTabs tabLepidopterology;
}
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;
public static CreativeTabs tabArboriculture;
public static CreativeTabs tabLepidopterology;
}

View File

@ -1,29 +1,30 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class EngineBronzeFuel {
/**
* Item that is valid fuel for a biogas engine.
*/
public final ItemStack liquid;
/**
* Power produced by this fuel per work cycle of the engine.
*/
public final int powerPerCycle;
/**
* How many work cycles a single "stack" of this type lasts.
*/
public final int burnDuration;
/**
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
*/
public final int dissipationMultiplier;
public EngineBronzeFuel(ItemStack liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
this.liquid = liquid;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
this.dissipationMultiplier = dissipationMultiplier;
}
}
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 Fluid liquid;
/**
* Power produced by this fuel per work cycle of the engine.
*/
public final int powerPerCycle;
/**
* How many work cycles a single "stack" of this type lasts.
*/
public final int burnDuration;
/**
* By how much the normal heat dissipation rate of 1 is multiplied when using this fuel type.
*/
public final int dissipationMultiplier;
public EngineBronzeFuel(Fluid liquid, int powerPerCycle, int burnDuration, int dissipationMultiplier) {
this.liquid = liquid;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
this.dissipationMultiplier = dissipationMultiplier;
}
}

View File

@ -1,26 +1,26 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class EngineCopperFuel {
/**
* Item that is valid fuel for a peat-fired engine.
*/
public final ItemStack fuel;
/**
* Power produced by this fuel per work cycle.
*/
public final int powerPerCycle;
/**
* Amount of work cycles this item lasts before being consumed.
*/
public final int burnDuration;
public EngineCopperFuel(ItemStack fuel, int powerPerCycle, int burnDuration) {
this.fuel = fuel;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
}
}
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class EngineCopperFuel {
/**
* Item that is valid fuel for a peat-fired engine.
*/
public final ItemStack fuel;
/**
* Power produced by this fuel per work cycle.
*/
public final int powerPerCycle;
/**
* Amount of work cycles this item lasts before being consumed.
*/
public final int burnDuration;
public EngineCopperFuel(ItemStack fuel, int powerPerCycle, int burnDuration) {
this.fuel = fuel;
this.powerPerCycle = powerPerCycle;
this.burnDuration = burnDuration;
}
}

View File

@ -1,24 +1,24 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class FermenterFuel {
/**
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
*/
public final ItemStack item;
/**
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
*/
public final int fermentPerCycle;
/**
* Amount of work cycles a single item of this fuel lasts before expiring.
*/
public final int burnDuration;
public FermenterFuel(ItemStack item, int fermentPerCycle, int burnDuration) {
this.item = item;
this.fermentPerCycle = fermentPerCycle;
this.burnDuration = burnDuration;
}
}
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class FermenterFuel {
/**
* Item that is a valid fuel for the fermenter (i.e. fertilizer).
*/
public final ItemStack item;
/**
* How much is fermeted per work cycle, i.e. how much biomass is produced per cycle.
*/
public final int fermentPerCycle;
/**
* Amount of work cycles a single item of this fuel lasts before expiring.
*/
public final int burnDuration;
public FermenterFuel(ItemStack item, int fermentPerCycle, int burnDuration) {
this.item = item;
this.fermentPerCycle = fermentPerCycle;
this.burnDuration = burnDuration;
}
}

View File

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

View File

@ -1,28 +1,30 @@
package forestry.api.fuels;
import java.util.HashMap;
public class GeneratorFuel {
public static HashMap<Integer, GeneratorFuel> fuels = new HashMap<Integer, GeneratorFuel>();
/**
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
*/
//public final LiquidStack fuelConsumed;
/**
* EU emitted per tick while this fuel is being consumed in the generator (i.e. biofuel = 32, biomass = 8).
*/
//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 GeneratorFuel(LiquidStack fuelConsumed, int eu, int rate) {
this.fuelConsumed = fuelConsumed;
this.eu = eu;
this.rate = rate;
}*/
}
package forestry.api.fuels;
import java.util.HashMap;
import net.minecraftforge.fluids.FluidStack;
public class GeneratorFuel {
public static HashMap<FluidStack, GeneratorFuel> fuels = new HashMap<FluidStack, GeneratorFuel>();
/**
* LiquidStack representing the fuel type and amount consumed per triggered cycle.
*/
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;
/**
* Rate at which the fuel is consumed. 1 - Every tick 2 - Every second tick 3 - Every third tick etc.
*/
public final 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,29 +1,29 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class MoistenerFuel {
/**
* The item to use
*/
public final ItemStack item;
/**
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
*/
public final ItemStack product;
/**
* How much this item contributes to the final product of the moistener (i.e. mycelium)
*/
public final int moistenerValue;
/**
* What stage this product represents. Resources with lower stage value will be consumed first.
*/
public final int stage;
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
this.item = item;
this.product = product;
this.stage = stage;
this.moistenerValue = moistenerValue;
}
}
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class MoistenerFuel {
/**
* The item to use
*/
public final ItemStack item;
/**
* The item that leaves the moistener's working slot (i.e. mouldy wheat, decayed wheat, mulch)
*/
public final ItemStack product;
/**
* How much this item contributes to the final product of the moistener (i.e. mycelium)
*/
public final int moistenerValue;
/**
* What stage this product represents. Resources with lower stage value will be consumed first.
*/
public final int stage;
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
this.item = item;
this.product = product;
this.stage = stage;
this.moistenerValue = moistenerValue;
}
}

View File

@ -1,35 +1,35 @@
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class RainSubstrate {
/**
* Rain substrate capable of activating the rainmaker.
*/
public ItemStack item;
/**
* Duration of the rain shower triggered by this substrate in Minecraft ticks.
*/
public int duration;
/**
* Speed of activation sequence triggered.
*/
public float speed;
public boolean reverse;
public RainSubstrate(ItemStack item, int duration, float speed) {
this(item, duration, speed, false);
}
public RainSubstrate(ItemStack item, float speed) {
this(item, 0, speed, true);
}
public RainSubstrate(ItemStack item, int duration, float speed, boolean reverse) {
this.item = item;
this.duration = duration;
this.speed = speed;
this.reverse = reverse;
}
}
package forestry.api.fuels;
import net.minecraft.item.ItemStack;
public class RainSubstrate {
/**
* Rain substrate capable of activating the rainmaker.
*/
public ItemStack item;
/**
* Duration of the rain shower triggered by this substrate in Minecraft ticks.
*/
public int duration;
/**
* Speed of activation sequence triggered.
*/
public float speed;
public boolean reverse;
public RainSubstrate(ItemStack item, int duration, float speed) {
this(item, duration, speed, false);
}
public RainSubstrate(ItemStack item, float speed) {
this(item, 0, speed, true);
}
public RainSubstrate(ItemStack item, int duration, float speed, boolean reverse) {
this.item = item;
this.duration = duration;
this.speed = speed;
this.reverse = reverse;
}
}

View File

@ -1,34 +1,34 @@
package forestry.api.recipes;
/**
* Provides an interface to the recipe manager of the bottler.
*
* 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}
*
* Note that this is untested with anything other than biofuel->fuelcan conversion.
*
* @author SirSengir
*/
public interface IBottlerManager extends ICraftingProvider {
/**
* Add a recipe to the bottler.
* The bottler will populate its recipe list dynamically from the LiquidContainerRegistry. Recipes added explicitely will take precedence.
*
* @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.
* @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);
}
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the bottler.
*
* 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}
*
* Note that this is untested with anything other than biofuel->fuelcan conversion.
*
* @author SirSengir
*/
public interface IBottlerManager extends ICraftingProvider {
/**
* Add a recipe to the bottler.
* The bottler will populate its recipe list dynamically from the LiquidContainerRegistry. Recipes added explicitely will take precedence.
*
* @param cyclesPerUnit
* Amount of work cycles required to run through the conversion once.
* @param input
* 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, FluidStack input, ItemStack can, ItemStack bottled);
}

View File

@ -1,66 +1,65 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapedRecipes;
/**
* Provides an interface to the recipe manager of the carpenter.
*
* 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}
*
* Only shaped recipes can be added currently.
*
* @author SirSengir
*/
public interface ICarpenterManager extends ICraftingProvider {
/**
* Add a shaped recipe to the carpenter.
*
* @param box
* ItemStack of one item representing the required box (carton, crate) for this recipe. May be null.
* @param product
* Crafting result.
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(ItemStack box, ItemStack product, Object materials[]);
/**
* Add a shaped recipe to the carpenter.
*
* @param packagingTime
* Number of work cycles required to craft the recipe once.
* @param box
* ItemStack of one item representing the required box (carton, crate) for this recipe. May be null.
* @param product
* Crafting result.
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(int packagingTime, ItemStack box, ItemStack product, Object materials[]);
/**
* Add a shaped recipe to the carpenter.
*
* @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 box
* ItemStack of one item representing the required box (carton, crate) for this recipe. May be null.
* @param product
* Crafting result.
* @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 addCrating(String toCrate, ItemStack unpack, ItemStack crated);
public void addCrating(ItemStack itemStack);
}
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.
*
* 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}
*
* Only shaped recipes can be added currently.
*
* @author SirSengir
*/
public interface ICarpenterManager extends ICraftingProvider {
/**
* Add a shaped recipe to the carpenter.
*
* @param box
* ItemStack of one item representing the required box (carton, crate) for this recipe. May be null.
* @param product
* Crafting result.
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(ItemStack box, ItemStack product, Object materials[]);
/**
* Add a shaped recipe to the carpenter.
*
* @param packagingTime
* Number of work cycles required to craft the recipe once.
* @param box
* ItemStack of one item representing the required box (carton, crate) for this recipe. May be null.
* @param product
* Crafting result.
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(int packagingTime, ItemStack box, ItemStack product, Object materials[]);
/**
* Add a shaped recipe to the carpenter.
*
* @param packagingTime
* Number of work cycles required to craft the recipe once.
* @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
* Crafting result.
* @param materials
* Materials needed in the crafting matrix. This gets passed directly to {@link ShapedRecipes}. Notation is the same.
*/
public void addRecipe(int packagingTime, FluidStack liquid, ItemStack box, ItemStack product, Object materials[]);
public void addCrating(String toCrate, ItemStack unpack, ItemStack crated);
public void addCrating(ItemStack itemStack);
}

View File

@ -1,74 +1,74 @@
package forestry.api.recipes;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
/**
* Provides an interface to the recipe manager of the centrifuge.
*
* 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}
*
* @author SirSengir
*/
public interface ICentrifugeManager extends ICraftingProvider {
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @param products
* HashMap<ItemStack, Integer> specifying the possible products and the chances of them resulting from centrifugation.
*/
public void addRecipe(int timePerItem, ItemStack resource, HashMap<ItemStack, Integer> products);
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @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
* produced.
*/
public void addRecipe(int timePerItem, ItemStack resource, ItemStack[] produce, int[] chances);
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @param primary
* Primary product produced by centrifugating one item. Yield 100 %.
* @param secondary
* Secondary product that may be produced when centrifugating the given item. May be null.
* @param chance
* Chance (1 - 100) for centrifugation to yield the secondary product.
*/
public void addRecipe(int timePerItem, ItemStack resource, ItemStack primary, ItemStack secondary, int chance);
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @param primary
* Primary product produced by centrifugating one item. Yield 100 %.
*/
public void addRecipe(int timePerItem, ItemStack resource, ItemStack primary);
}
package forestry.api.recipes;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
/**
* Provides an interface to the recipe manager of the centrifuge.
*
* 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}
*
* @author SirSengir
*/
public interface ICentrifugeManager extends ICraftingProvider {
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @param products
* HashMap<ItemStack, Integer> specifying the possible products and the chances of them resulting from centrifugation.
*/
public void addRecipe(int timePerItem, ItemStack resource, HashMap<ItemStack, Integer> products);
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @param produce
* Array of ItemStacks that can be the result of this recipe.
* @param chances
* 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);
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @param primary
* Primary product produced by centrifugating one item. Yield 100 %.
* @param secondary
* Secondary product that may be produced when centrifugating the given item. May be null.
* @param chance
* Chance (1 - 100) for centrifugation to yield the secondary product.
*/
public void addRecipe(int timePerItem, ItemStack resource, ItemStack primary, ItemStack secondary, int chance);
/**
* Add a recipe to the centrifuge
*
* @param timePerItem
* Time to centrifugate one item of the given type
* @param resource
* ItemStack containing information on item id and damage. Stack size will be ignored.
* @param primary
* Primary product produced by centrifugating one item. Yield 100 %.
*/
public void addRecipe(int timePerItem, ItemStack resource, ItemStack primary);
}

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.
*/
@Deprecated
public List<Map.Entry<ItemStack[], ItemStack[]>> getRecipes();
}
package forestry.api.recipes;
import java.util.Map;
public interface ICraftingProvider {
/**
* 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. Objects can be either ItemStack or LiquidStack.
*/
public Map<Object[], Object[]> getRecipes();
}

View File

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

View File

@ -1,46 +1,48 @@
package forestry.api.recipes;
/**
* Provides an interface to the recipe manager of the fermenter.
*
* 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}
*
* @author SirSengir
*/
public interface IFermenterManager extends ICraftingProvider {
/**
* Add a recipe to the fermenter
*
* @param resource
* ItemStack representing the resource.
* @param fermentationValue
* Value of the given resource, i.e. how much needs to be fermented for the output to be deposited into the product tank.
* @param modifier
* Modifies the amount of liquid output per work cycle. (water = 1.0f, honey = 1.5f)
* @param output
* LiquidStack representing output liquid. Amount is determined by fermentationValue*modifier.
* @param liquid
* LiquidStack representing resource liquid and amount.
*/
//public void addRecipe(ItemStack resource, int fermentationValue, float modifier, LiquidStack output, LiquidStack liquid);
/**
* Add a recipe to the fermenter. Defaults to water as input liquid.
*
* @param resource
* ItemStack representing the resource.
* @param modifier
* Modifies the amount of liquid output per work cycle. (water = 1.0f, honey = 1.5f)
* @param fermentationValue
* Value of the given resource, i.e. how much needs to be fermented for the output to be deposited into the product tank.
* @param output
* LiquidStack representing output liquid. Amount is determined by fermentationValue*modifier.
*/
//public void addRecipe(ItemStack resource, int fermentationValue, float modifier, LiquidStack output);
}
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the fermenter.
*
* 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}
*
* @author SirSengir
*/
public interface IFermenterManager extends ICraftingProvider {
/**
* Add a recipe to the fermenter
*
* @param resource
* ItemStack representing the resource.
* @param fermentationValue
* Value of the given resource, i.e. how much needs to be fermented for the output to be deposited into the product tank.
* @param modifier
* Modifies the amount of liquid output per work cycle. (water = 1.0f, honey = 1.5f)
* @param output
* LiquidStack representing output liquid. Amount is determined by fermentationValue*modifier.
* @param liquid
* LiquidStack representing resource liquid and amount.
*/
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.
*
* @param resource
* ItemStack representing the resource.
* @param modifier
* Modifies the amount of liquid output per work cycle. (water = 1.0f, honey = 1.5f)
* @param fermentationValue
* Value of the given resource, i.e. how much needs to be fermented for the output to be deposited into the product tank.
* @param output
* LiquidStack representing output liquid. Amount is determined by fermentationValue*modifier.
*/
public void addRecipe(ItemStack resource, int fermentationValue, float modifier, FluidStack output);
}

View File

@ -1,11 +1,11 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
public interface IGenericCrate {
void setContained(ItemStack crate, ItemStack contained);
ItemStack getContained(ItemStack crate);
}
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
public interface IGenericCrate {
void setContained(ItemStack crate, ItemStack contained);
ItemStack getContained(ItemStack crate);
}

View File

@ -1,28 +1,28 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
/**
* Provides an interface to the recipe manager of the moistener.
*
* 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}
*
* @author SirSengir
*/
public interface IMoistenerManager extends ICraftingProvider {
/**
* Add a recipe to the moistener
*
* @param resource
* Item required in resource stack. Will be reduced by one per produced item.
* @param product
* Item to produce per resource processed.
* @param timePerItem
* Moistener runs at 1 - 4 time ticks per ingame tick depending on light level. For mycelium this value is currently 5000.
*/
public void addRecipe(ItemStack resource, ItemStack product, int timePerItem);
}
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
/**
* Provides an interface to the recipe manager of the moistener.
*
* 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}
*
* @author SirSengir
*/
public interface IMoistenerManager extends ICraftingProvider {
/**
* Add a recipe to the moistener
*
* @param resource
* Item required in resource stack. Will be reduced by one per produced item.
* @param product
* Item to produce per resource processed.
* @param timePerItem
* Moistener runs at 1 - 4 time ticks per ingame tick depending on light level. For mycelium this value is currently 5000.
*/
public void addRecipe(ItemStack resource, ItemStack product, int timePerItem);
}

View File

@ -1,43 +1,45 @@
package forestry.api.recipes;
/**
* Provides an interface to the recipe manager of the suqeezer.
*
* 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}
*
* @author SirSengir
*/
public interface ISqueezerManager extends ICraftingProvider {
/**
* Add a recipe to the squeezer.
*
* @param timePerItem
* Number of work cycles required to squeeze one set of resources.
* @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.
* @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);
/**
* Add a recipe to the squeezer.
*
* @param timePerItem
* Number of work cycles required to squeeze one set of resources.
* @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.
*/
//public void addRecipe(int timePerItem, ItemStack[] resources, LiquidStack liquid);
}
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the suqeezer.
*
* 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}
*
* @author SirSengir
*/
public interface ISqueezerManager extends ICraftingProvider {
/**
* Add a recipe to the squeezer.
*
* @param timePerItem
* Number of work cycles required to squeeze one set of resources.
* @param resources
* Array of item stacks representing the required resources for one process. Stack size will be taken into account.
* @param liquid
* {@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, FluidStack liquid, ItemStack remnants, int chance);
/**
* Add a recipe to the squeezer.
*
* @param timePerItem
* Number of work cycles required to squeeze one set of resources.
* @param resources
* Array of item stacks representing the required resources for one process. Stack size will be taken into account.
* @param liquid
* {@link FluidStack} representing the output of this recipe.
*/
public void addRecipe(int timePerItem, ItemStack[] resources, FluidStack liquid);
}

View File

@ -1,28 +1,29 @@
package forestry.api.recipes;
/**
* Provides an interface to the recipe manager of the still.
*
* 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}
*
* Note that this is untested with anything other than biomass->biofuel conversion.
*
* @author SirSengir
*/
public interface IStillManager extends ICraftingProvider {
/**
* Add a recipe to the still
*
* @param cyclesPerUnit
* Amount of work cycles required to run through the conversion once.
* @param input
* ItemStack representing the input liquid.
* @param output
* ItemStack representing the output liquid
*/
//public void addRecipe(int cyclesPerUnit, LiquidStack input, LiquidStack output);
}
package forestry.api.recipes;
import net.minecraftforge.fluids.FluidStack;
/**
* Provides an interface to the recipe manager of the still.
*
* 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}
*
* Note that this is untested with anything other than biomass->biofuel conversion.
*
* @author SirSengir
*/
public interface IStillManager extends ICraftingProvider {
/**
* Add a recipe to the still
*
* @param cyclesPerUnit
* Amount of work cycles required to run through the conversion once.
* @param input
* ItemStack representing the input liquid.
* @param output
* ItemStack representing the output liquid
*/
public void addRecipe(int cyclesPerUnit, FluidStack input, FluidStack output);
}

View File

@ -1,16 +1,16 @@
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
/**
* Fermenter checks any valid fermentation item for an implementation of this interface.
* This does not supersede adding a proper recipe to the fermenter!
*/
public interface IVariableFermentable {
/**
* @param itemstack
* @return Float representing the modification to be applied to the matching recipe's biomass output.
*/
float getFermentationModifier(ItemStack itemstack);
}
package forestry.api.recipes;
import net.minecraft.item.ItemStack;
/**
* Fermenter checks any valid fermentation item for an implementation of this interface.
* This does not supersede adding a proper recipe to the fermenter!
*/
public interface IVariableFermentable {
/**
* @param itemstack
* @return Float representing the modification to be applied to the matching recipe's biomass output.
*/
float getFermentationModifier(ItemStack itemstack);
}

View File

@ -1,40 +1,44 @@
package forestry.api.recipes;
/**
* Contains all available recipe managers for Forestry machines and items.
*
* @author SirSengir
*/
public class RecipeManagers {
/**
* Allows you to add recipes to the bottler. See {@link IBottlerManager} for details.
*/
public static IBottlerManager bottlerManager;
/**
* Allows you to add recipes to the carpenter. See {@link ICarpenterManager} for details.
*/
public static ICarpenterManager carpenterManager;
/**
* Allows you to add recipes to the centrifuge. See {@link ICentrifugeManager} for details.
*/
public static ICentrifugeManager centrifugeManager;
/**
* Allows you to add recipes to the fermenter. See {@link IFermenterManager} for details.
*/
public static IFermenterManager fermenterManager;
/**
* Allows you to add recipes to the moistener. See {@link IMoistenerManager} for details.
*/
public static IMoistenerManager moistenerManager;
/**
* Allows you to add recipes to the squeezer. See {@link ISqueezerManager} for details.
*/
public static ISqueezerManager squeezerManager;
/**
* Allows you to add recipes to the still. See {@link IStillManager} for details.
*/
public static IStillManager stillManager;
public static IFabricatorManager fabricatorManager;
}
package forestry.api.recipes;
import java.util.Collection;
/**
* Contains all available recipe managers for Forestry machines and items.
*
* @author SirSengir
*/
public class RecipeManagers {
public static Collection<ICraftingProvider> craftingProviders;
/**
* Allows you to add recipes to the bottler. See {@link IBottlerManager} for details.
*/
public static IBottlerManager bottlerManager;
/**
* Allows you to add recipes to the carpenter. See {@link ICarpenterManager} for details.
*/
public static ICarpenterManager carpenterManager;
/**
* Allows you to add recipes to the centrifuge. See {@link ICentrifugeManager} for details.
*/
public static ICentrifugeManager centrifugeManager;
/**
* Allows you to add recipes to the fermenter. See {@link IFermenterManager} for details.
*/
public static IFermenterManager fermenterManager;
/**
* Allows you to add recipes to the moistener. See {@link IMoistenerManager} for details.
*/
public static IMoistenerManager moistenerManager;
/**
* Allows you to add recipes to the squeezer. See {@link ISqueezerManager} for details.
*/
public static ISqueezerManager squeezerManager;
/**
* Allows you to add recipes to the still. See {@link IStillManager} for details.
*/
public static IStillManager stillManager;
public static IFabricatorManager fabricatorManager;
}

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

@ -1,22 +1,22 @@
package forestry.api.storage;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
public class BackpackManager {
/**
* 0 - Miner's Backpack 1 - Digger's Backpack 2 - Forester's Backpack 3 - Hunter's Backpack 4 - Adventurer's Backpack
*
* Use IMC messages to achieve the same effect!
*/
public static ArrayList<ItemStack>[] backpackItems;
public static IBackpackInterface backpackInterface;
/**
* Only use this if you know what you are doing. Prefer backpackInterface.
*/
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<String, IBackpackDefinition>();
}
package forestry.api.storage;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.item.ItemStack;
public class BackpackManager {
/**
* 0 - Miner's Backpack 1 - Digger's Backpack 2 - Forester's Backpack 3 - Hunter's Backpack 4 - Adventurer's Backpack
*
* Use IMC messages to achieve the same effect!
*/
public static ArrayList<ItemStack>[] backpackItems;
public static IBackpackInterface backpackInterface;
/**
* Only use this if you know what you are doing. Prefer backpackInterface.
*/
public static HashMap<String, IBackpackDefinition> definitions = new HashMap<String, IBackpackDefinition>();
}

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

@ -1,5 +1,5 @@
package forestry.api.storage;
public enum EnumBackpackType {
T1, T2
}
package forestry.api.storage;
public enum EnumBackpackType {
T1, T2
}

View File

@ -1,54 +1,54 @@
package forestry.api.storage;
import java.util.Collection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public interface IBackpackDefinition {
/**
* @return A unique string identifier
*/
String getKey();
/**
* @return Human-readable name of the backpack.
*/
String getName();
/**
* @return Primary colour for the backpack icon.
*/
int getPrimaryColour();
/**
* @return Secondary colour for backpack icon.
*/
int getSecondaryColour();
/**
* Adds an item as valid for this backpack.
*
* @param validItem
*/
void addValidItem(ItemStack validItem);
/**
* Returns an arraylist of all items valid for this backpack type.
*
* @param player
* @return
*/
Collection<ItemStack> getValidItems(EntityPlayer player);
/**
* Returns true if the itemstack is a valid item for this backpack type.
*
* @param player
* @param itemstack
* @return
*/
boolean isValidItem(EntityPlayer player, ItemStack itemstack);
package forestry.api.storage;
import java.util.Collection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public interface IBackpackDefinition {
/**
* @return A unique string identifier
*/
String getKey();
/**
* @return Human-readable name of the backpack.
*/
String getName();
/**
* @return Primary colour for the backpack icon.
*/
int getPrimaryColour();
/**
* @return Secondary colour for backpack icon.
*/
int getSecondaryColour();
/**
* Adds an item as valid for this backpack.
*
* @param validItem
*/
void addValidItem(ItemStack validItem);
/**
* Returns an arraylist of all items valid for this backpack type.
*
* @param player
* @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);
/**
* Returns true if the itemstack is a valid item for this backpack type.
*
* @param player
* @param itemstack
* @return true if the given itemstack is valid for this backpack, false otherwise.
*/
boolean isValidItem(EntityPlayer player, ItemStack itemstack);
}

View File

@ -1,19 +1,19 @@
package forestry.api.storage;
import net.minecraft.item.Item;
public interface IBackpackInterface {
/**
* Adds a backpack with the given id, definition and type, returning the item.
*
* @param itemID
* Item id to use.
* @param definition
* Definition of backpack behaviour.
* @param type
* Type of backpack. (T1 or T2 (= Woven)
* @return Created backpack item.
*/
Item addBackpack(int itemID, IBackpackDefinition definition, EnumBackpackType type);
}
package forestry.api.storage;
import net.minecraft.item.Item;
public interface IBackpackInterface {
/**
* Adds a backpack with the given id, definition and type, returning the item.
*
* @param itemID
* Item id to use.
* @param definition
* Definition of backpack behaviour.
* @param type
* Type of backpack. (T1 or T2 (= Woven)
* @return Created backpack item.
*/
Item addBackpack(int itemID, IBackpackDefinition definition, EnumBackpackType type);
}