接口 RegistryAware
- 所有已知子接口:
Art
,Attribute
,Biome
,BlockType
,BlockType.Typed<B>
,Cat.Type
,Chicken.Variant
,Cow.Variant
,DamageType
,Fluid
,Frog.Variant
,ItemType
,ItemType.Typed<M>
,JukeboxSong
,MapCursor.Type
,MenuType
,MenuType.Typed<V,
,B> PatternType
,Pig.Variant
,Sound
,TrimMaterial
,TrimPattern
,Villager.Profession
,Villager.Type
,Wolf.Variant
- 所有已知实现类:
Enchantment
,EnchantmentWrapper
,EntityType
,GameEvent
,Material
,MemoryKey
,MusicInstrument
,Particle
,PotionEffectType
,PotionEffectTypeWrapper
,PotionType
,Structure
,StructureType
public interface RegistryAware
Indicates that instances of a class may be registered to the server and have a key associated with them.
- 另请参阅:
-
方法概要
修饰符和类型方法说明Gets the key of this instance if it is registered otherwise returnsnull
.Gets the key of this instance if it is registered otherwise throws an error.boolean
Returns whether this instance is register in a registry and therefore has a key or not.
-
方法详细资料
-
getKeyOrThrow
Gets the key of this instance if it is registered otherwise throws an error.
This is a convenience method and plugins should always checkisRegistered()
before using this method.- 返回:
- the key with which this instance is registered.
- 抛出:
IllegalStateException
- if this instance is not registered.- 另请参阅:
-
getKeyOrNull
Gets the key of this instance if it is registered otherwise returnsnull
.- 返回:
- the key with which this instance is registered or
null
if not registered. - 另请参阅:
-
isRegistered
boolean isRegistered()Returns whether this instance is register in a registry and therefore has a key or not.- 返回:
- true, if this instance is registered. Otherwise, false.
- 另请参阅:
-