1919
2020public enum Instrument {
2121
22- HARP (0 , 0 , 0 ),
23- BASS (1 , 4 , 4 ),
24- BASS_DRUM (2 , 1 , 1 ),
25- SNARE (3 , 2 , 2 ),
26- HAT (4 , 3 , 3 ),
27- GUITAR (5 , 7 , 8 ),
28- FLUTE (6 , 5 , 6 ),
29- BELL (7 , 6 , 5 ),
30- CHIME (8 , 8 , 7 ),
31- XYLOPHONE (9 , 9 , 9 ),
32- IRON_XYLOPHONE (10 , 10 , 10 ),
33- COW_BELL (11 , 11 , 11 ),
34- DIDGERIDOO (12 , 12 , 12 ),
35- BIT (13 , 13 , 13 ),
36- BANJO (14 , 14 , 14 ),
37- PLING (15 , 15 , 15 ),
38- ;
22+ HARP (0 , 0 , 0 , "block.note_block.harp" ),
23+ BASS (1 , 4 , 4 , "block.note_block.bass" ),
24+ BASS_DRUM (2 , 1 , 1 , "block.note_block.basedrum" ),
25+ SNARE (3 , 2 , 2 , "block.note_block.snare" ),
26+ HAT (4 , 3 , 3 , "block.note_block.hat" ),
27+ GUITAR (5 , 7 , 8 , "block.note_block.guitar" ),
28+ FLUTE (6 , 5 , 6 , "block.note_block.flute" ),
29+ BELL (7 , 6 , 5 , "block.note_block.bell" ),
30+ CHIME (8 , 8 , 7 , "block.note_block.chime" ),
31+ XYLOPHONE (9 , 9 , 9 , "block.note_block.xylophone" ),
32+ IRON_XYLOPHONE (10 , 10 , 10 , "block.note_block.iron_xylophone" ),
33+ COW_BELL (11 , 11 , 11 , "block.note_block.cow_bell" ),
34+ DIDGERIDOO (12 , 12 , 12 , "block.note_block.didgeridoo" ),
35+ BIT (13 , 13 , 13 , "block.note_block.bit" ),
36+ BANJO (14 , 14 , 14 , "block.note_block.banjo" ),
37+ PLING (15 , 15 , 15 , "block.note_block.pling" );
3938
4039 private final byte nbsId ;
4140 private final byte mcId ;
4241 private final byte mcbeId ;
42+ private final String mcSoundName ;
4343
44- Instrument (final int nbsId , final int mcId , final int mcbeId ) {
44+ Instrument (final int nbsId , final int mcId , final int mcbeId , final String mcSoundName ) {
4545 this .nbsId = (byte ) nbsId ;
4646 this .mcId = (byte ) mcId ;
4747 this .mcbeId = (byte ) mcbeId ;
48+ this .mcSoundName = mcSoundName ;
4849 }
4950
5051 public byte nbsId () {
@@ -59,6 +60,10 @@ public byte mcbeId() {
5960 return this .mcbeId ;
6061 }
6162
63+ public String mcSoundName () {
64+ return this .mcSoundName ;
65+ }
66+
6267 public static Instrument fromNbsId (final byte nbsId ) {
6368 for (final Instrument instrument : Instrument .values ()) {
6469 if (instrument .nbsId == nbsId ) {
@@ -86,4 +91,13 @@ public static Instrument fromMcbeId(final byte mcbeId) {
8691 return null ;
8792 }
8893
94+ public static Instrument fromMcSoundName (final String mcSoundName ) {
95+ for (final Instrument instrument : Instrument .values ()) {
96+ if (instrument .mcSoundName .equals (mcSoundName )) {
97+ return instrument ;
98+ }
99+ }
100+ return null ;
101+ }
102+
89103}
0 commit comments