Skip to content

Instantly share code, notes, and snippets.

@Maxopoly
Created August 30, 2019 16:22
Show Gist options
  • Save Maxopoly/a6b1be7cb55282ea5671bb8b951227c1 to your computer and use it in GitHub Desktop.
Save Maxopoly/a6b1be7cb55282ea5671bb8b951227c1 to your computer and use it in GitHub Desktop.
Generates a csv with nice human readable names for each spigot material
public static void main(String[] args) {
StringBuilder sb = new StringBuilder();
for (Material mat : Material.values()) {
if (mat.toString().contains("LEGACY")) {
continue;
}
sb.append(mat.toString());
sb.append(",");
for (String part : mat.toString().split("_")) {
if (part.length() != 0) {
sb.append(part.substring(0, 1).toUpperCase());
sb.append(part.substring(1).toLowerCase());
}
sb.append(" ");
}
sb.append("\r\n");
}
try (Writer writer = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream("materials.csv"), "utf-8"))) {
writer.write(sb.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment