Package net.minecraft.util
Interface StringIdentifiable
- All Known Implementing Classes:
ArmorMaterials
,Attachment
,AxolotlEntity.Variant
,BambooLeaves
,BedPart
,Biome.TemperatureModifier
,BiomeEffects.GrassColorModifier
,BlockHalf
,BlockMirror
,BlockRotation
,BoatEntity.Type
,ChatLogEntry.Type
,ChestType
,ComparatorMode
,CookingRecipeCategory
,CraftingRecipeCategory
,DamageEffects
,DamageScaling
,DeathMessageType
,Decoration.Parameter
,DensityFunctionTypes.BinaryOperationLike.Type
,DensityFunctionTypes.UnaryOperation.Type
,DensityFunctionTypes.WeirdScaledSampler.RarityValueMapper
,DensityFunctionTypes.Wrapping.Type
,Difficulty
,Direction
,Direction.Axis
,DirectionTransformation
,DisplayEntity.BillboardMode
,DisplayEntity.TextDisplayEntity.TextAlignment
,DoorHinge
,DoubleBlockHalf
,DyeColor
,FilterMask.FilterStatus
,FontType
,Formatting
,FoxEntity.Type
,GameMode
,GenerationStep.Carver
,GenerationStep.Feature
,Heightmap.Type
,HorseColor
,Instrument
,JigsawBlockEntity.Joint
,JigsawOrientation
,LlamaEntity.Variant
,MessageTrustStatus
,MineshaftStructure.Type
,ModelTransformationMode
,MooshroomEntity.Type
,OceanRuinStructure.BiomeTemperature
,PandaEntity.Gene
,ParrotEntity.Variant
,PistonType
,QuickPlayLogger.WorldType
,RabbitEntity.RabbitType
,RailShape
,RuinedPortalStructurePiece.VerticalPlacement
,ScoreboardCriterion.RenderType
,SculkSensorPhase
,SlabType
,SpawnGroup
,SpreadType
,StairShape
,StructureBlockMode
,StructurePlacement.FrequencyReductionMethod
,StructurePool.Projection
,StructureSpawns.BoundingBox
,StructureTerrainAdaptation
,TelemetryEventProperty.GameMode
,TelemetryEventProperty.ServerType
,Thickness
,Tilt
,TropicalFishEntity.Variety
,VerticalSurfaceType
,VillageGossipType
,WallMountLocation
,WallShape
,WireConnection
public interface StringIdentifiable
An interface, implemented by enums, that allows the enum to be serialized
by codecs. An instance is identified using a string.
- API Note:
- To make an enum serializable with codecs, implement this on the enum class,
implement
asString()
to return a unique ID, and add astatic final
field that holds the codec for the enum. - Mappings:
Namespace Name official apr
intermediary net/minecraft/class_3542
named net/minecraft/util/StringIdentifiable
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
StringIdentifiable.Codec<E extends Enum<E> & StringIdentifiable>
Deprecated. -
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionasString()
Returns the unique string representation of the enum, used for serialization.static <E extends Enum<E> & StringIdentifiable>
StringIdentifiable.Codec<E>createCodec
(Supplier<E[]> enumValues) Creates a codec that serializes an enum implementing this interface either using its ordinals (when compressed) or using itsasString()
method and a given decode function.static <E extends Enum<E> & StringIdentifiable>
StringIdentifiable.Codec<E>createCodec
(Supplier<E[]> enumValues, Function<String, String> valueNameTransformer) Creates a codec that serializes an enum implementing this interface either using its ordinals (when compressed) or using itsasString()
method and a given decode function.static com.mojang.serialization.Keyable
toKeyable
(StringIdentifiable[] values)
-
Field Details
-
field_38377
static final int field_38377- See Also:
- Mappings:
Namespace Name Mixin selector official W
Lapr;W:I
intermediary field_38377
Lnet/minecraft/class_3542;field_38377:I
named field_38377
Lnet/minecraft/util/StringIdentifiable;field_38377:I
-
-
Method Details
-
asString
String asString()Returns the unique string representation of the enum, used for serialization.- Returns:
- the unique string representation of the enum, used for serialization
- Mappings:
Namespace Name Mixin selector official c
Lapr;c()Ljava/lang/String;
intermediary method_15434
Lnet/minecraft/class_3542;method_15434()Ljava/lang/String;
named asString
Lnet/minecraft/util/StringIdentifiable;asString()Ljava/lang/String;
-
createCodec
static <E extends Enum<E> & StringIdentifiable> StringIdentifiable.Codec<E> createCodec(Supplier<E[]> enumValues) Creates a codec that serializes an enum implementing this interface either using its ordinals (when compressed) or using itsasString()
method and a given decode function.- Mappings:
Namespace Name Mixin selector official a
Lapr;a(Ljava/util/function/Supplier;)Lapr$a;
intermediary method_28140
Lnet/minecraft/class_3542;method_28140(Ljava/util/function/Supplier;)Lnet/minecraft/class_3542$class_7292;
named createCodec
Lnet/minecraft/util/StringIdentifiable;createCodec(Ljava/util/function/Supplier;)Lnet/minecraft/util/StringIdentifiable$Codec;
-
createCodec
static <E extends Enum<E> & StringIdentifiable> StringIdentifiable.Codec<E> createCodec(Supplier<E[]> enumValues, Function<String, String> valueNameTransformer) Creates a codec that serializes an enum implementing this interface either using its ordinals (when compressed) or using itsasString()
method and a given decode function.- Mappings:
Namespace Name Mixin selector official a
Lapr;a(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lapr$a;
intermediary method_49454
Lnet/minecraft/class_3542;method_49454(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lnet/minecraft/class_3542$class_7292;
named createCodec
Lnet/minecraft/util/StringIdentifiable;createCodec(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lnet/minecraft/util/StringIdentifiable$Codec;
-
toKeyable
- Mappings:
Namespace Name Mixin selector official a
Lapr;a([Lapr;)Lcom/mojang/serialization/Keyable;
intermediary method_28142
Lnet/minecraft/class_3542;method_28142([Lnet/minecraft/class_3542;)Lcom/mojang/serialization/Keyable;
named toKeyable
Lnet/minecraft/util/StringIdentifiable;toKeyable([Lnet/minecraft/util/StringIdentifiable;)Lcom/mojang/serialization/Keyable;
-