Package net.minecraft.util
Interface StringIdentifiable
- All Known Implementing Classes:
Arm
,ArmorMaterials
,Attachment
,AxolotlEntity.Variant
,BambooLeaves
,BedPart
,Biome.TemperatureModifier
,BiomeEffects.GrassColorModifier
,BlockFace
,BlockHalf
,BlockMirror
,BlockRotation
,BoatEntity.Type
,ChatLogEntry.Type
,ChestType
,CloudRenderMode
,ComparatorMode
,CookingRecipeCategory
,CopyNameLootFunction.Source
,CopyNbtLootFunction.Operator
,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
,EntityAttributeModifier.Operation
,EquipmentSlot
,FilterMask.FilterStatus
,FontType
,Formatting
,FoxEntity.Type
,GameMode
,GenerationStep.Carver
,GenerationStep.Feature
,Heightmap.Type
,HorseColor
,Instrument
,JigsawBlockEntity.Joint
,JigsawOrientation
,LlamaEntity.Variant
,LootContext.EntityTarget
,MapIcon.Type
,MessageTrustStatus
,MineshaftStructure.Type
,ModelTransformationMode
,MooshroomEntity.Type
,OceanRuinStructure.BiomeTemperature
,PandaEntity.Gene
,ParrotEntity.Variant
,PistonType
,QuickPlayLogger.WorldType
,RabbitEntity.RabbitType
,RailShape
,RuinedPortalStructurePiece.VerticalPlacement
,Scaling.Type
,ScoreboardCriterion.RenderType
,ScoreboardDisplaySlot
,SculkSensorPhase
,SlabType
,SpawnGroup
,SpreadType
,StairShape
,StructureBlockMode
,StructurePlacement.FrequencyReductionMethod
,StructurePool.Projection
,StructureSpawns.BoundingBox
,StructureTerrainAdaptation
,TelemetryEventProperty.GameMode
,TelemetryEventProperty.ServerType
,Thickness
,Tilt
,TropicalFishEntity.Variety
,VerticalSurfaceType
,VillageGossipType
,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 asp
intermediary net/minecraft/class_3542
named net/minecraft/util/StringIdentifiable
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
StringIdentifiable.EnumCodec<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.EnumCodec<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.EnumCodec<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
-
CACHED_MAP_THRESHOLD
static final int CACHED_MAP_THRESHOLD- See Also:
- Mappings:
Namespace Name Mixin selector official W
Lasp;W:I
intermediary field_38377
Lnet/minecraft/class_3542;field_38377:I
named CACHED_MAP_THRESHOLD
Lnet/minecraft/util/StringIdentifiable;CACHED_MAP_THRESHOLD: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
Lasp;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.EnumCodec<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
Lasp;a(Ljava/util/function/Supplier;)Lasp$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$EnumCodec;
-
createCodec
static <E extends Enum<E> & StringIdentifiable> StringIdentifiable.EnumCodec<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
Lasp;a(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lasp$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$EnumCodec;
-
toKeyable
- Mappings:
Namespace Name Mixin selector official a
Lasp;a([Lasp;)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;
-