Worked on compost list config

Allows users to add other items to the config list to be turned into
compost
This commit is contained in:
DarkGuardsman 2013-09-02 18:01:17 -04:00
parent 5ce081e456
commit f8b86de04c
2 changed files with 23 additions and 1 deletions

View file

@ -20,7 +20,7 @@ public class DecayMatterList
* @param stack - itemID and meta to check against
* @param output - how many buckets of compost are created. Accepts part buckets
* @param time - time in which to decay the matter */
public void addDecayMatter(ItemStack stack, float output, int time)
public static void addDecayMatter(ItemStack stack, float output, int time)
{
if (stack != null)
{
@ -71,6 +71,7 @@ public class DecayMatterList
//TODO parse the list of blocks and auto add all crop blocks.
}
/** Loads user settings for items that validate for decay matter */
public static void parseConfigString(String string)
{
if (string != null && !string.isEmpty())
@ -85,6 +86,24 @@ public class DecayMatterList
String[] split = str.split(":");
String ID = split[0];
String meta = split[1];
String decayT = split[2];
String decayO = split[3];
try
{
int blockID = Integer.parseInt(ID);
int metaID = Integer.parseInt(meta);
int decayTime = Integer.parseInt(decayT);
int decayV = Integer.parseInt(decayO);
DecayMatterList.addDecayMatter(new ItemStack(blockID, 1, metaID), decayV, decayTime);
}
catch (Exception e)
{
//TODO add a string based system that will allow for full item or block names
//eg tile.stone:0, tile.wood:2,
System.out.println("[FarmTech] Entries for compost list must be Integers");
e.printStackTrace();
}
}
catch (Exception e)
{

View file

@ -105,6 +105,9 @@ public class FarmTech extends ModPrefab
blockFarmSoil = new BlockFarmSoil(this.getNextID());
BlockRegistry.addBlockToRegister(new BlockData(blockFarmSoil, ItemBlockHolder.class, "FTFarmSoil"));
String compostList = CONFIGURATION.get("DecayMatter", "List", "5::8000:1","Items or blocks beyond the built in ones that can be turned into compost. Entries go BlockID:Meta:Time:Amount").getString();
DecayMatterList.parseConfigString(compostList);
CONFIGURATION.save();
return dataList;
}