2011-06-17 03:00:49 -04:00
|
|
|
package org.bukkit;
|
|
|
|
|
2012-01-29 11:10:40 +01:00
|
|
|
import com.google.common.collect.Maps;
|
2019-04-23 14:33:57 +10:00
|
|
|
import java.util.Map;
|
2019-03-13 17:42:57 +11:00
|
|
|
import org.jetbrains.annotations.Nullable;
|
2012-01-29 11:10:40 +01:00
|
|
|
|
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
|
2017-05-14 12:00:00 +10:00
|
|
|
* 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
|
|
|
*/
|
2017-05-14 12:00:00 +10:00
|
|
|
BASS_GUITAR(0x4),
|
|
|
|
/**
|
|
|
|
* Flute is normally played when a note block is on top of a clay block.
|
|
|
|
*/
|
|
|
|
FLUTE(0x5),
|
|
|
|
/**
|
|
|
|
* Bell is normally played when a note block is on top of a gold block.
|
|
|
|
*/
|
|
|
|
BELL(0x6),
|
|
|
|
/**
|
|
|
|
* Guitar is normally played when a note block is on top of a woolen block.
|
|
|
|
*/
|
|
|
|
GUITAR(0x7),
|
|
|
|
/**
|
|
|
|
* Chime is normally played when a note block is on top of a packed ice
|
|
|
|
* block.
|
|
|
|
*/
|
|
|
|
CHIME(0x8),
|
|
|
|
/**
|
|
|
|
* Xylophone is normally played when a note block is on top of a bone block.
|
|
|
|
*/
|
2019-04-23 12:00:00 +10:00
|
|
|
XYLOPHONE(0x9),
|
|
|
|
/**
|
|
|
|
* Iron Xylophone is normally played when a note block is on top of a iron block.
|
|
|
|
*/
|
|
|
|
IRON_XYLOPHONE(0xA),
|
|
|
|
/**
|
|
|
|
* Cow Bell is normally played when a note block is on top of a soul sand block.
|
|
|
|
*/
|
|
|
|
COW_BELL(0xB),
|
|
|
|
/**
|
|
|
|
* Didgeridoo is normally played when a note block is on top of a pumpkin block.
|
|
|
|
*/
|
|
|
|
DIDGERIDOO(0xC),
|
|
|
|
/**
|
|
|
|
* Bit is normally played when a note block is on top of a emerald block.
|
|
|
|
*/
|
|
|
|
BIT(0xD),
|
|
|
|
/**
|
|
|
|
* Banjo is normally played when a note block is on top of a hay block.
|
|
|
|
*/
|
|
|
|
BANJO(0xE),
|
|
|
|
/**
|
|
|
|
* Pling is normally played when a note block is on top of a glowstone block.
|
|
|
|
*/
|
|
|
|
PLING(0xF);
|
2011-06-17 03:00:49 -04:00
|
|
|
|
|
|
|
private final byte type;
|
2019-04-23 14:00:20 +10:00
|
|
|
private static final 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
|
2019-03-13 17:42:57 +11:00
|
|
|
@Nullable
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|