diff --git a/src/main/java/land/chipmunk/chipmunkmod/song/Instrument.java b/src/main/java/land/chipmunk/chipmunkmod/song/Instrument.java index 475e5f1..d7c2f6e 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/song/Instrument.java +++ b/src/main/java/land/chipmunk/chipmunkmod/song/Instrument.java @@ -17,7 +17,14 @@ public class Instrument { 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); - private static final Instrument[] VALUES = { HARP, BASEDRUM, SNARE, HAT, BASS, FLUTE, BELL, GUITAR, CHIME, XYLOPHONE, IRON_XYLOPHONE, COW_BELL, DIDGERIDOO, BIT, BANJO, PLING }; + public static final Instrument TRUMPET = new Instrument(15, "trumpet", 54); + public static final Instrument TRUMPET_EXPOSED = new Instrument(16, "trumpet_exposed", 54); + public static final Instrument TRUMPET_WEATHERED = new Instrument(17, "trumpet_weathered", 54); + public static final Instrument TRUMPET_OXIDIZED = new Instrument(18, "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; diff --git a/src/main/java/land/chipmunk/chipmunkmod/song/NBSConverter.java b/src/main/java/land/chipmunk/chipmunkmod/song/NBSConverter.java index 5e3a271..19c2507 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/song/NBSConverter.java +++ b/src/main/java/land/chipmunk/chipmunkmod/song/NBSConverter.java @@ -24,6 +24,10 @@ public class NBSConverter { Instrument.BIT, Instrument.BANJO, Instrument.PLING, + Instrument.TRUMPET, + Instrument.TRUMPET_EXPOSED, + Instrument.TRUMPET_WEATHERED, + Instrument.TRUMPET_OXIDIZED, }; public static Song getSongFromBytes (final byte[] bytes, final String fileName) throws IOException { @@ -32,7 +36,7 @@ public class NBSConverter { short songLength = 0; byte format = 0; - byte vanillaInstrumentCount = 0; + byte vanillaInstrumentCount = 10; // Before v1, we had 10 vanilla instruments songLength = buffer.getShort(); // If it's not 0, then it uses the old format if (songLength == 0) { format = buffer.get(); @@ -134,12 +138,13 @@ public class NBSConverter { for (final NBSNote note : nbsNotes) { final Instrument instrument; double key; - if (note.instrument < instrumentIndex.length) { + if (note.instrument < vanillaInstrumentCount) { + if (note.instrument >= instrumentIndex.length) continue; instrument = instrumentIndex[note.instrument]; key = (double) ((note.key * 100) + note.pitch) / 100; } else { - final int index = note.instrument - instrumentIndex.length; + final int index = note.instrument - vanillaInstrumentCount; if (index >= customInstruments.size()) continue;