2011-06-17 03:00:49 -04:00
|
|
|
package org.bukkit;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
2011-06-17 03:00:49 -04:00
|
|
|
public enum Instrument {
|
|
|
|
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Piano is the standard instrument for a note block.
|
|
|
|
*/
|
|
|
|
PIANO(0x0),
|
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* Bass drum is normally played when a note block is on top of a
|
|
|
|
* stone-like block
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
|
|
|
BASS_DRUM(0x1),
|
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* Snare drum is normally played when a note block is on top of a sandy
|
|
|
|
* block.
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
|
|
|
SNARE_DRUM(0x2),
|
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* Sticks are normally played when a note block is on top of a glass
|
|
|
|
* block.
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
|
|
|
STICKS(0x3),
|
|
|
|
/**
|
2013-12-15 01:07:43 -05:00
|
|
|
* Bass guitar is normally played when a note block is on top of a wooden
|
|
|
|
* block.
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
|
|
|
BASS_GUITAR(0x4);
|
2011-06-17 03:00:49 -04:00
|
|
|
|
|
|
|
private final byte type;
|
2012-01-29 11:10:40 +01:00
|
|
|
private final static Map<Byte, Instrument> BY_DATA = Maps.newHashMap();
|
2011-06-17 03:00:49 -04:00
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
private Instrument(final int type) {
|
|
|
|
this.type = (byte) type;
|
2011-06-17 03:00:49 -04:00
|
|
|
}
|
|
|
|
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* @return The type ID of this instrument.
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-06-17 03:00:49 -04:00
|
|
|
public byte getType() {
|
|
|
|
return this.type;
|
|
|
|
}
|
|
|
|
|
2012-02-26 12:13:30 -05:00
|
|
|
/**
|
|
|
|
* Get an instrument by its type ID.
|
2013-08-03 21:46:30 -04:00
|
|
|
*
|
2012-02-26 12:13:30 -05:00
|
|
|
* @param type The type ID
|
|
|
|
* @return The instrument
|
2013-08-19 13:32:18 -05:00
|
|
|
* @deprecated Magic value
|
2012-02-26 12:13:30 -05:00
|
|
|
*/
|
2013-08-19 13:32:18 -05:00
|
|
|
@Deprecated
|
2011-06-17 03:00:49 -04:00
|
|
|
public static Instrument getByType(final byte type) {
|
2012-01-29 11:10:40 +01:00
|
|
|
return BY_DATA.get(type);
|
2011-06-17 03:00:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static {
|
|
|
|
for (Instrument instrument : Instrument.values()) {
|
2012-01-29 11:10:40 +01:00
|
|
|
BY_DATA.put(instrument.getType(), instrument);
|
2011-06-17 03:00:49 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|