AgriCraft

AgriCraft

30M Downloads

Descriptions can't contain commas

Tarig0 opened this issue ยท 5 comments

commented

This is displayed in Agrarian Skies 2 with the baconweed. If there is a comma in the description the crop will be skipped.

If this could be added to the information tooltip or handled by the parser that would be great.

the best I can think of is to make the description have another seperator instead of a comma so the format becomes

name,fruit,soi,baseblock,tier,rendermethod,shearable drop (optional);information

then do the following

String[] rawCropData = cropsRawData[i].split(';',2)); //Split the data from the description allows for semicolon to be used in description

String[] cropData = rawCropData[0].split(','); //This does the same job as IOHelper.getData
String cropDescription = rawCropData[1];
//Create crop based of of data
commented

I see what you mean, but I'm not going to change it because a lot of people are actually already using this and they would all have to change their configs. Is it really that necessary that you need a comma in your description?
(I like your solution btw, quite elegant)

commented

nah just a nice to have, I already have an issue open on the modpack to let jaded fix the current config.

(just because I like solving issues)
You could have an if statement that check for the presence of a semicolon and if present use the new format if not use the old. This wouldn't work with descriptions that use a semicolon but who does that?

commented

actually I think I have a way to fix without changing the format

String[] cropData = cropsRawData.split(",",7) //index 0-5 is the non optional data
String descriptionSheared = cropsRawData.last();
String[] descriptionShearedList = descriptionSheared.split(",");

if (descriptionShearedList.size() > 1 && descriptionShearedList.last() is block)
{
   description = descriptionSheared.substring(0,descriptionSheared.lastIndexOf(","))
   shearedBlock = descriptionShearedList.last().toBlock()
}else{
   description = descriptionSheared
}
commented

I wasn't aware of the method string.split(), that would've made my life so much easyer. Anyway I'm too lazy to change the code, so I just added a line that will make it so that commas followed by spaces will be ignored.
This complies with my wish not to change the format and with yours to have commas in descriptions.

commented

That'll work, I'll let jaded know that this will be fixed in the next release of your mod

http://minecraft.curseforge.com/modpacks/225550-agrarian-skies-2/issues/1053