
import org.spongepowered.api.Sponge;
import org.spongepowered.api.block.BlockState;
import org.spongepowered.api.block.BlockType;
import org.spongepowered.api.block.BlockTypes;
import org.spongepowered.api.registry.RegistryTypes;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.lang.reflect.Field;


public class MyClass {

    public static void main(String[] args) throws IllegalAccessException{
        String fileName = "blocks_enum.txt";

        System.out.println("Starting generating blocks to " + fileName);
        try (BufferedWriter writer = new BufferedWriter(new FileWriter(fileName))) {
            // Loop to write lines to the file
            int i=0;
            writer.write("enum BlockType {");
            writer.newLine();
            for (Field field : BlockTypes.class.getFields()) {
                String line = "\t"+ field.getName() + " = " + i +";";
                writer.write(line); // Writing the line to the file
                writer.newLine();
                i++;
            }
            writer.write("}");
            writer.newLine();

            System.out.println("Lines written to " + fileName + " successfully.");
        } catch (IOException e) {
            System.err.println("Error writing to file: " + e.getMessage());
        }
        System.out.println("Exiting generation");
    }
}