diff --git a/src/minecraft/biomesoplenty/integration/ForestryIntegration.java b/src/minecraft/biomesoplenty/integration/ForestryIntegration.java index ca502330c..6e85c4638 100644 --- a/src/minecraft/biomesoplenty/integration/ForestryIntegration.java +++ b/src/minecraft/biomesoplenty/integration/ForestryIntegration.java @@ -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)); } diff --git a/src/minecraft/forestry/api/apiculture/FlowerManager.java b/src/minecraft/forestry/api/apiculture/FlowerManager.java index 3f2f40693..5531976b2 100644 --- a/src/minecraft/forestry/api/apiculture/FlowerManager.java +++ b/src/minecraft/forestry/api/apiculture/FlowerManager.java @@ -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 plainFlowers = new ArrayList(); -} +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 plainFlowers = new ArrayList(); +} diff --git a/src/minecraft/forestry/api/core/BlockInterface.java b/src/minecraft/forestry/api/core/BlockInterface.java index 4bec3cdc8..771d22631 100644 --- a/src/minecraft/forestry/api/core/BlockInterface.java +++ b/src/minecraft/forestry/api/core/BlockInterface.java @@ -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; + } + +} diff --git a/src/minecraft/forestry/api/core/EnumHumidity.java b/src/minecraft/forestry/api/core/EnumHumidity.java index 50cf3d668..b1dea4246 100644 --- a/src/minecraft/forestry/api/core/EnumHumidity.java +++ b/src/minecraft/forestry/api/core/EnumHumidity.java @@ -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 aridBiomeIds = new ArrayList(); - /** - * Populated by Forestry with vanilla biomes. Add additional damp biomes here. (ex. jungle) - */ - public static ArrayList dampBiomeIds = new ArrayList(); - /** - * Populated by Forestry with vanilla biomes. Add additional normal biomes here. - */ - public static ArrayList normalBiomeIds = new ArrayList(); - - 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 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 aridBiomeIds = new ArrayList(); + /** + * Populated by Forestry with vanilla biomes. Add additional damp biomes here. (ex. jungle) + */ + public static ArrayList dampBiomeIds = new ArrayList(); + /** + * Populated by Forestry with vanilla biomes. Add additional normal biomes here. + */ + public static ArrayList normalBiomeIds = new ArrayList(); + + public final String name; + + private EnumHumidity(String name) { + this.name = name; + } + + public String getName() { + return this.name; + } + + public static ArrayList getBiomeIds(EnumHumidity humidity) { + switch (humidity) { + case ARID: + return aridBiomeIds; + case DAMP: + return dampBiomeIds; + case NORMAL: + default: + return normalBiomeIds; + } + } +} diff --git a/src/minecraft/forestry/api/core/EnumTemperature.java b/src/minecraft/forestry/api/core/EnumTemperature.java index f4ae2c7ad..28f235ff6 100644 --- a/src/minecraft/forestry/api/core/EnumTemperature.java +++ b/src/minecraft/forestry/api/core/EnumTemperature.java @@ -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 icyBiomeIds = new ArrayList(); - /** - * Populated by Forestry with vanilla biomes. Add additional cold biomes here. (ex. taiga) - */ - public static ArrayList coldBiomeIds = new ArrayList(); - /** - * Populated by Forestry with vanilla biomes. Add additional normal biomes here. (ex. forest, plains) - */ - public static ArrayList normalBiomeIds = new ArrayList(); - /** - * Populated by Forestry with vanilla biomes. Add additional warm biomes here. (ex. jungle) - */ - public static ArrayList warmBiomeIds = new ArrayList(); - /** - * Populated by Forestry with vanilla biomes. Add additional hot biomes here. (ex. desert) - */ - public static ArrayList hotBiomeIds = new ArrayList(); - /** - * Populated by Forestry with vanilla biomes. Add additional hellish biomes here. (ex. nether) - */ - public static ArrayList hellishBiomeIds = new ArrayList(); - - 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 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 icyBiomeIds = new ArrayList(); + /** + * Populated by Forestry with vanilla biomes. Add additional cold biomes here. (ex. taiga) + */ + public static ArrayList coldBiomeIds = new ArrayList(); + /** + * Populated by Forestry with vanilla biomes. Add additional normal biomes here. (ex. forest, plains) + */ + public static ArrayList normalBiomeIds = new ArrayList(); + /** + * Populated by Forestry with vanilla biomes. Add additional warm biomes here. (ex. jungle) + */ + public static ArrayList warmBiomeIds = new ArrayList(); + /** + * Populated by Forestry with vanilla biomes. Add additional hot biomes here. (ex. desert) + */ + public static ArrayList hotBiomeIds = new ArrayList(); + /** + * Populated by Forestry with vanilla biomes. Add additional hellish biomes here. (ex. nether) + */ + public static ArrayList hellishBiomeIds = new ArrayList(); + + 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 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; + } + + } +} diff --git a/src/minecraft/forestry/api/core/ForestryAPI.java b/src/minecraft/forestry/api/core/ForestryAPI.java index 5ac43180e..b7b4c878d 100644 --- a/src/minecraft/forestry/api/core/ForestryAPI.java +++ b/src/minecraft/forestry/api/core/ForestryAPI.java @@ -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; + +} diff --git a/src/minecraft/forestry/api/core/GlobalManager.java b/src/minecraft/forestry/api/core/GlobalManager.java index 71e2b0f75..40a372a54 100644 --- a/src/minecraft/forestry/api/core/GlobalManager.java +++ b/src/minecraft/forestry/api/core/GlobalManager.java @@ -1,12 +1,12 @@ -package forestry.api.core; - -import java.util.ArrayList; - -public class GlobalManager { - - public static ArrayList dirtBlockIds = new ArrayList(); - public static ArrayList sandBlockIds = new ArrayList(); - public static ArrayList leafBlockIds = new ArrayList(); - public static ArrayList snowBlockIds = new ArrayList(); - -} +package forestry.api.core; + +import java.util.ArrayList; + +public class GlobalManager { + + public static ArrayList dirtBlockIds = new ArrayList(); + public static ArrayList sandBlockIds = new ArrayList(); + public static ArrayList leafBlockIds = new ArrayList(); + public static ArrayList snowBlockIds = new ArrayList(); + +} diff --git a/src/minecraft/forestry/api/core/IArmorNaturalist.java b/src/minecraft/forestry/api/core/IArmorNaturalist.java new file mode 100644 index 000000000..cecd9fb40 --- /dev/null +++ b/src/minecraft/forestry/api/core/IArmorNaturalist.java @@ -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); +} diff --git a/src/minecraft/forestry/api/core/IGameMode.java b/src/minecraft/forestry/api/core/IGameMode.java index 80833a8f4..0ee2d7f50 100644 --- a/src/minecraft/forestry/api/core/IGameMode.java +++ b/src/minecraft/forestry/api/core/IGameMode.java @@ -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); + +} diff --git a/src/minecraft/forestry/api/core/IIconProvider.java b/src/minecraft/forestry/api/core/IIconProvider.java index 297c8281e..17c16bc9a 100644 --- a/src/minecraft/forestry/api/core/IIconProvider.java +++ b/src/minecraft/forestry/api/core/IIconProvider.java @@ -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); + +} diff --git a/src/minecraft/forestry/api/core/INBTTagable.java b/src/minecraft/forestry/api/core/INBTTagable.java index c2e71ec5e..54bd75fa0 100644 --- a/src/minecraft/forestry/api/core/INBTTagable.java +++ b/src/minecraft/forestry/api/core/INBTTagable.java @@ -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); +} diff --git a/src/minecraft/forestry/api/core/IPlugin.java b/src/minecraft/forestry/api/core/IPlugin.java index af659849a..cbb44ded9 100644 --- a/src/minecraft/forestry/api/core/IPlugin.java +++ b/src/minecraft/forestry/api/core/IPlugin.java @@ -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(); + +} diff --git a/src/minecraft/forestry/api/core/IStructureLogic.java b/src/minecraft/forestry/api/core/IStructureLogic.java index 500613a9b..4d867bc84 100644 --- a/src/minecraft/forestry/api/core/IStructureLogic.java +++ b/src/minecraft/forestry/api/core/IStructureLogic.java @@ -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(); + +} diff --git a/src/minecraft/forestry/api/core/ITextureManager.java b/src/minecraft/forestry/api/core/ITextureManager.java index 93347b359..ae394b23e 100644 --- a/src/minecraft/forestry/api/core/ITextureManager.java +++ b/src/minecraft/forestry/api/core/ITextureManager.java @@ -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); +} diff --git a/src/minecraft/forestry/api/core/ITileStructure.java b/src/minecraft/forestry/api/core/ITileStructure.java index 69c149fe2..f510e4afd 100644 --- a/src/minecraft/forestry/api/core/ITileStructure.java +++ b/src/minecraft/forestry/api/core/ITileStructure.java @@ -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(); + +} diff --git a/src/minecraft/forestry/api/core/IToolScoop.java b/src/minecraft/forestry/api/core/IToolScoop.java index 574a6edfc..00e0c3da7 100644 --- a/src/minecraft/forestry/api/core/IToolScoop.java +++ b/src/minecraft/forestry/api/core/IToolScoop.java @@ -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 { + +} diff --git a/src/minecraft/forestry/api/core/ItemInterface.java b/src/minecraft/forestry/api/core/ItemInterface.java index fd17e1252..d8e5bfc4d 100644 --- a/src/minecraft/forestry/api/core/ItemInterface.java +++ b/src/minecraft/forestry/api/core/ItemInterface.java @@ -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; + } + +} diff --git a/src/minecraft/forestry/api/core/PluginInfo.java b/src/minecraft/forestry/api/core/PluginInfo.java index 627d55472..cafee7450 100644 --- a/src/minecraft/forestry/api/core/PluginInfo.java +++ b/src/minecraft/forestry/api/core/PluginInfo.java @@ -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 ""; + +} diff --git a/src/minecraft/forestry/api/core/Tabs.java b/src/minecraft/forestry/api/core/Tabs.java index 633b1d543..e14a558f1 100644 --- a/src/minecraft/forestry/api/core/Tabs.java +++ b/src/minecraft/forestry/api/core/Tabs.java @@ -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; + +} diff --git a/src/minecraft/forestry/api/fuels/EngineBronzeFuel.java b/src/minecraft/forestry/api/fuels/EngineBronzeFuel.java index b65857776..937db5687 100644 --- a/src/minecraft/forestry/api/fuels/EngineBronzeFuel.java +++ b/src/minecraft/forestry/api/fuels/EngineBronzeFuel.java @@ -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; + } +} diff --git a/src/minecraft/forestry/api/fuels/EngineCopperFuel.java b/src/minecraft/forestry/api/fuels/EngineCopperFuel.java index bb2d817b1..c30274f0c 100644 --- a/src/minecraft/forestry/api/fuels/EngineCopperFuel.java +++ b/src/minecraft/forestry/api/fuels/EngineCopperFuel.java @@ -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; + } + +} diff --git a/src/minecraft/forestry/api/fuels/FermenterFuel.java b/src/minecraft/forestry/api/fuels/FermenterFuel.java index 6d7cf379b..f726a80e5 100644 --- a/src/minecraft/forestry/api/fuels/FermenterFuel.java +++ b/src/minecraft/forestry/api/fuels/FermenterFuel.java @@ -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; + } +} diff --git a/src/minecraft/forestry/api/fuels/FuelManager.java b/src/minecraft/forestry/api/fuels/FuelManager.java index c1125e5f5..ada19f8ee 100644 --- a/src/minecraft/forestry/api/fuels/FuelManager.java +++ b/src/minecraft/forestry/api/fuels/FuelManager.java @@ -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 fermenterFuel = new ItemStackMap(); - /** - * Add new resources for the moistener here (i.e. wheat) - */ - public static HashMap moistenerResource = new ItemStackMap(); - /** - * Add new substrates for the rainmaker here - */ - public static HashMap rainSubstrate = new ItemStackMap(); - /** - * Add new fuels for EngineBronze (= biogas engine) here - */ - public static HashMap bronzeEngineFuel = new ItemStackMap(); - /** - * Add new fuels for EngineCopper (= peat-fired engine) here - */ - public static HashMap copperEngineFuel = new ItemStackMap(); - - // 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 fermenterFuel; + /** + * Add new resources for the moistener here (i.e. wheat) + */ + public static HashMap moistenerResource; + /** + * Add new substrates for the rainmaker here + */ + public static HashMap rainSubstrate; + /** + * Add new fuels for EngineBronze (= biogas engine) here + */ + public static HashMap bronzeEngineFuel; + /** + * Add new fuels for EngineCopper (= peat-fired engine) here + */ + public static HashMap copperEngineFuel; + + // Generator fuel list in GeneratorFuel.class +} diff --git a/src/minecraft/forestry/api/fuels/GeneratorFuel.java b/src/minecraft/forestry/api/fuels/GeneratorFuel.java index 4ef8adb59..32aa42c21 100644 --- a/src/minecraft/forestry/api/fuels/GeneratorFuel.java +++ b/src/minecraft/forestry/api/fuels/GeneratorFuel.java @@ -1,28 +1,30 @@ -package forestry.api.fuels; - -import java.util.HashMap; - -public class GeneratorFuel { - - public static HashMap fuels = new HashMap(); - - /** - * 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 fuels = new HashMap(); + + /** + * 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; + } + +} diff --git a/src/minecraft/forestry/api/fuels/ItemStackMap.java b/src/minecraft/forestry/api/fuels/ItemStackMap.java deleted file mode 100644 index 0aaaa79ae..000000000 --- a/src/minecraft/forestry/api/fuels/ItemStackMap.java +++ /dev/null @@ -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 extends HashMap { - - private static final long serialVersionUID = 5383477742290646466L; - - @Override - public boolean containsKey(Object key) { - for (Map.Entry entry : this.entrySet()) - if (areItemStacksEqual(entry.getKey(), key)) - return true; - return super.containsKey(key); - } - - @Override - public T remove(Object key) { - Iterator> iterator = this.entrySet().iterator(); - ; - while (iterator.hasNext()) { - Map.Entry entry = iterator.next(); - if (areItemStacksEqual(entry.getKey(), key)) - iterator.remove(); - } - return super.remove(key); - } - - @Override - public T get(Object key) { - for (Map.Entry 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; - } - -} diff --git a/src/minecraft/forestry/api/fuels/MoistenerFuel.java b/src/minecraft/forestry/api/fuels/MoistenerFuel.java index 15bbb1b88..1a5454f9f 100644 --- a/src/minecraft/forestry/api/fuels/MoistenerFuel.java +++ b/src/minecraft/forestry/api/fuels/MoistenerFuel.java @@ -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; + } +} diff --git a/src/minecraft/forestry/api/fuels/RainSubstrate.java b/src/minecraft/forestry/api/fuels/RainSubstrate.java index 7aac5bce7..22790986b 100644 --- a/src/minecraft/forestry/api/fuels/RainSubstrate.java +++ b/src/minecraft/forestry/api/fuels/RainSubstrate.java @@ -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; + } +} diff --git a/src/minecraft/forestry/api/recipes/IBottlerManager.java b/src/minecraft/forestry/api/recipes/IBottlerManager.java index 910024f6a..c01f322c3 100644 --- a/src/minecraft/forestry/api/recipes/IBottlerManager.java +++ b/src/minecraft/forestry/api/recipes/IBottlerManager.java @@ -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); +} diff --git a/src/minecraft/forestry/api/recipes/ICarpenterManager.java b/src/minecraft/forestry/api/recipes/ICarpenterManager.java index a95822f91..2f3f25034 100644 --- a/src/minecraft/forestry/api/recipes/ICarpenterManager.java +++ b/src/minecraft/forestry/api/recipes/ICarpenterManager.java @@ -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); +} diff --git a/src/minecraft/forestry/api/recipes/ICentrifugeManager.java b/src/minecraft/forestry/api/recipes/ICentrifugeManager.java index 76a3948f5..880ede945 100644 --- a/src/minecraft/forestry/api/recipes/ICentrifugeManager.java +++ b/src/minecraft/forestry/api/recipes/ICentrifugeManager.java @@ -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 specifying the possible products and the chances of them resulting from centrifugation. - */ - public void addRecipe(int timePerItem, ItemStack resource, HashMap 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 specifying the possible products and the chances of them resulting from centrifugation. + */ + public void addRecipe(int timePerItem, ItemStack resource, HashMap 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); + +} diff --git a/src/minecraft/forestry/api/recipes/ICraftingProvider.java b/src/minecraft/forestry/api/recipes/ICraftingProvider.java index e80ef69af..1b6ba8c84 100644 --- a/src/minecraft/forestry/api/recipes/ICraftingProvider.java +++ b/src/minecraft/forestry/api/recipes/ICraftingProvider.java @@ -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> 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 getRecipes(); +} diff --git a/src/minecraft/forestry/api/recipes/IFabricatorManager.java b/src/minecraft/forestry/api/recipes/IFabricatorManager.java index de2997e2c..cc4ae4472 100644 --- a/src/minecraft/forestry/api/recipes/IFabricatorManager.java +++ b/src/minecraft/forestry/api/recipes/IFabricatorManager.java @@ -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); + +} diff --git a/src/minecraft/forestry/api/recipes/IFermenterManager.java b/src/minecraft/forestry/api/recipes/IFermenterManager.java index 13e3509e7..ab986e81e 100644 --- a/src/minecraft/forestry/api/recipes/IFermenterManager.java +++ b/src/minecraft/forestry/api/recipes/IFermenterManager.java @@ -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); + +} diff --git a/src/minecraft/forestry/api/recipes/IGenericCrate.java b/src/minecraft/forestry/api/recipes/IGenericCrate.java index 814cb83aa..9cc1b6bc0 100644 --- a/src/minecraft/forestry/api/recipes/IGenericCrate.java +++ b/src/minecraft/forestry/api/recipes/IGenericCrate.java @@ -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); + +} diff --git a/src/minecraft/forestry/api/recipes/IMoistenerManager.java b/src/minecraft/forestry/api/recipes/IMoistenerManager.java index fe991f2e0..1d375924f 100644 --- a/src/minecraft/forestry/api/recipes/IMoistenerManager.java +++ b/src/minecraft/forestry/api/recipes/IMoistenerManager.java @@ -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); +} diff --git a/src/minecraft/forestry/api/recipes/ISqueezerManager.java b/src/minecraft/forestry/api/recipes/ISqueezerManager.java index 7fbfb7516..4abf0eb7d 100644 --- a/src/minecraft/forestry/api/recipes/ISqueezerManager.java +++ b/src/minecraft/forestry/api/recipes/ISqueezerManager.java @@ -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); +} diff --git a/src/minecraft/forestry/api/recipes/IStillManager.java b/src/minecraft/forestry/api/recipes/IStillManager.java index 7ab3bed7f..55d274d4f 100644 --- a/src/minecraft/forestry/api/recipes/IStillManager.java +++ b/src/minecraft/forestry/api/recipes/IStillManager.java @@ -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); +} diff --git a/src/minecraft/forestry/api/recipes/IVariableFermentable.java b/src/minecraft/forestry/api/recipes/IVariableFermentable.java index ce51b1f6c..f3c66d787 100644 --- a/src/minecraft/forestry/api/recipes/IVariableFermentable.java +++ b/src/minecraft/forestry/api/recipes/IVariableFermentable.java @@ -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); +} diff --git a/src/minecraft/forestry/api/recipes/RecipeManagers.java b/src/minecraft/forestry/api/recipes/RecipeManagers.java index 5f5cbda62..527b9d85d 100644 --- a/src/minecraft/forestry/api/recipes/RecipeManagers.java +++ b/src/minecraft/forestry/api/recipes/RecipeManagers.java @@ -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 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; +} diff --git a/src/minecraft/forestry/api/storage/BackpackEvent.java b/src/minecraft/forestry/api/storage/BackpackEvent.java new file mode 100644 index 000000000..8e3c6e5e7 --- /dev/null +++ b/src/minecraft/forestry/api/storage/BackpackEvent.java @@ -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; + } +} diff --git a/src/minecraft/forestry/api/storage/BackpackManager.java b/src/minecraft/forestry/api/storage/BackpackManager.java index 64af8cd01..12286cae5 100644 --- a/src/minecraft/forestry/api/storage/BackpackManager.java +++ b/src/minecraft/forestry/api/storage/BackpackManager.java @@ -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[] backpackItems; - - public static IBackpackInterface backpackInterface; - - /** - * Only use this if you know what you are doing. Prefer backpackInterface. - */ - public static HashMap definitions = new HashMap(); -} +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[] backpackItems; + + public static IBackpackInterface backpackInterface; + + /** + * Only use this if you know what you are doing. Prefer backpackInterface. + */ + public static HashMap definitions = new HashMap(); +} diff --git a/src/minecraft/forestry/api/storage/BackpackResupplyEvent.java b/src/minecraft/forestry/api/storage/BackpackResupplyEvent.java new file mode 100644 index 000000000..88d783c27 --- /dev/null +++ b/src/minecraft/forestry/api/storage/BackpackResupplyEvent.java @@ -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); + } + +} diff --git a/src/minecraft/forestry/api/storage/BackpackStowEvent.java b/src/minecraft/forestry/api/storage/BackpackStowEvent.java new file mode 100644 index 000000000..5d35f9e3e --- /dev/null +++ b/src/minecraft/forestry/api/storage/BackpackStowEvent.java @@ -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; + } +} diff --git a/src/minecraft/forestry/api/storage/EnumBackpackType.java b/src/minecraft/forestry/api/storage/EnumBackpackType.java index 13faf87b6..24232dd81 100644 --- a/src/minecraft/forestry/api/storage/EnumBackpackType.java +++ b/src/minecraft/forestry/api/storage/EnumBackpackType.java @@ -1,5 +1,5 @@ -package forestry.api.storage; - -public enum EnumBackpackType { - T1, T2 -} +package forestry.api.storage; + +public enum EnumBackpackType { + T1, T2 +} diff --git a/src/minecraft/forestry/api/storage/IBackpackDefinition.java b/src/minecraft/forestry/api/storage/IBackpackDefinition.java index 002bc0209..f1b0438ce 100644 --- a/src/minecraft/forestry/api/storage/IBackpackDefinition.java +++ b/src/minecraft/forestry/api/storage/IBackpackDefinition.java @@ -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 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 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); + } \ No newline at end of file diff --git a/src/minecraft/forestry/api/storage/IBackpackInterface.java b/src/minecraft/forestry/api/storage/IBackpackInterface.java index 0012fab11..a6472c32b 100644 --- a/src/minecraft/forestry/api/storage/IBackpackInterface.java +++ b/src/minecraft/forestry/api/storage/IBackpackInterface.java @@ -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); +}