package land.chipmunk.chipmunkmod.song;

public class Instrument {
    public static final Instrument HARP = new Instrument(0, "harp", 54);
    public static final Instrument BASEDRUM = new Instrument(1, "basedrum", 0);
    public static final Instrument SNARE = new Instrument(2, "snare", 0);
    public static final Instrument HAT = new Instrument(3, "hat", 0);
    public static final Instrument BASS = new Instrument(4, "bass", 30);
    public static final Instrument FLUTE = new Instrument(5, "flute", 66);
    public static final Instrument BELL = new Instrument(6, "bell", 78);
    public static final Instrument GUITAR = new Instrument(7, "guitar", 42);
    public static final Instrument CHIME = new Instrument(8, "chime", 78);
    public static final Instrument XYLOPHONE = new Instrument(9, "xylophone", 78);
    public static final Instrument IRON_XYLOPHONE = new Instrument(10, "iron_xylophone", 54);
    public static final Instrument COW_BELL = new Instrument(11, "cow_bell", 66);
    public static final Instrument DIDGERIDOO = new Instrument(12, "didgeridoo", 30);
    public static final Instrument BIT = new Instrument(13, "bit", 54);
    public static final Instrument BANJO = new Instrument(14, "banjo", 54);
    public static final Instrument PLING = new Instrument(15, "pling", 54);
    public static final Instrument TRUMPET = new Instrument(16, "trumpet", 54);
    public static final Instrument TRUMPET_EXPOSED = new Instrument(17, "trumpet_exposed", 54);
    public static final Instrument TRUMPET_WEATHERED = new Instrument(18, "trumpet_weathered", 54);
    public static final Instrument TRUMPET_OXIDIZED = new Instrument(19, "trumpet_oxidized", 54);
    private static final Instrument[] VALUES = {
        HARP, BASEDRUM, SNARE, HAT, BASS, FLUTE, BELL, GUITAR, CHIME, XYLOPHONE, IRON_XYLOPHONE, COW_BELL, DIDGERIDOO,
        BIT, BANJO, PLING, TRUMPET, TRUMPET_EXPOSED, TRUMPET_WEATHERED, TRUMPET_OXIDIZED
    };
    public final int id;
    public final String name;
    public final int offset;
    public final String sound;

    protected Instrument (final int id, final String name, final int offset, final String sound) {
        this.id = id;
        this.name = name;
        this.offset = offset;
        this.sound = sound;
    }

    protected Instrument (final int id, final String name, final int offset) {
        this.id = id;
        this.name = name;
        this.offset = offset;
        this.sound = "block.note_block." + name;
    }

    public static Instrument fromId (final int id) {
        return VALUES[id];
    }
}
