diff --git a/src/dark/api/farm/DecayMatterList.java b/src/dark/api/farm/DecayMatterList.java new file mode 100644 index 00000000..43043625 --- /dev/null +++ b/src/dark/api/farm/DecayMatterList.java @@ -0,0 +1,47 @@ +package dark.api.farm; + +import java.util.HashMap; + +import net.minecraft.item.ItemStack; +import dark.core.helpers.Pair; + +public class DecayMatterList +{ + //TODO handle special cases of single stack items that have non-meta damage values + public static HashMap, Pair> compostList = new HashMap, Pair>(); + static + { + //TODO add some items here but leave most of the work to some of the sub methods that will ID and upload all crop like blocks + } + + /** Used to flag and itemStack as decayable matter for the compost box and later real time world + * decay + * + * @param stack - itemID and meta to check against + * @param output - how many decayed matter to output + * @param time - time in which to decay the matter */ + public void addDecayMatter(ItemStack stack, int output, int time) + { + if (stack != null) + { + Pair par = new Pair(stack.itemID, stack.getItemDamage()); + Pair par2 = new Pair(output, time); + if (!compostList.containsKey(par)) + { + compostList.put(par, par2); + } + } + } + + public boolean isDecayMatter(ItemStack stack) + { + return stack != null && compostList.containsKey(new Pair(stack.itemID, stack.getItemDamage())); + } + + /** Called after all mods/blocks have loaded to auto sort threw blocks looking for anything that + * might be close to decayable matter */ + public static void triggerPostBlockAddition() + { + //TODO parse the list of blocks and auto add all crop blocks. + } +} diff --git a/src/dark/farmtech/FarmTech.java b/src/dark/farmtech/FarmTech.java index 81299c1a..fdae0496 100644 --- a/src/dark/farmtech/FarmTech.java +++ b/src/dark/farmtech/FarmTech.java @@ -21,6 +21,7 @@ import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import dark.api.farm.DecayMatterList; import dark.core.BlockRegistry; import dark.core.BlockRegistry.BlockData; import dark.core.DarkMain; @@ -79,6 +80,7 @@ public class FarmTech extends ModPrefab { super.postInit(event); proxy.postInit(); + DecayMatterList.triggerPostBlockAddition(); } @Override diff --git a/src/dark/farmtech/machines/BlockFT.java b/src/dark/farmtech/machines/BlockFT.java index e4aeccaa..c45ec10b 100644 --- a/src/dark/farmtech/machines/BlockFT.java +++ b/src/dark/farmtech/machines/BlockFT.java @@ -11,9 +11,13 @@ import dark.core.helpers.Pair; import dark.farmtech.FarmTech; import dark.prefab.BlockMachine; +/** Prefab class for all farm blocks to remove the need for some configuration of the super class + * + * @author Darkguardsman */ public abstract class BlockFT extends BlockMachine implements IExtraObjectInfo { private boolean hasConfigFile = false; + public BlockFT(String name, int blockID, Material material) { super(name, FarmTech.CONFIGURATION, blockID, material); diff --git a/src/dark/farmtech/machines/TileEntityCompBox.java b/src/dark/farmtech/machines/TileEntityCompBox.java index cac6c4b8..fe4b5155 100644 --- a/src/dark/farmtech/machines/TileEntityCompBox.java +++ b/src/dark/farmtech/machines/TileEntityCompBox.java @@ -1,6 +1,20 @@ package dark.farmtech.machines; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.ForgeDirection; + public class TileEntityCompBox extends TileEntityFT { + @Override + public boolean canStore(ItemStack stack, int slot, ForgeDirection side) + { + return false; + } + + @Override + public boolean canRemove(ItemStack stack, int slot, ForgeDirection side) + { + return false; + } } diff --git a/src/dark/farmtech/machines/TileEntityFT.java b/src/dark/farmtech/machines/TileEntityFT.java index 3dc17424..353175d0 100644 --- a/src/dark/farmtech/machines/TileEntityFT.java +++ b/src/dark/farmtech/machines/TileEntityFT.java @@ -3,6 +3,9 @@ package dark.farmtech.machines; import dark.farmtech.FarmTech; import dark.prefab.TileEntityMachine; +/** Prefab class for all farm blocks to remove the need for some configuration of the super class + * + * @author Darkguardsman */ public abstract class TileEntityFT extends TileEntityMachine { @Override