Package net.minecraft.util
Interface StringIdentifiable
- All Known Subinterfaces:
SkullBlock.SkullType
,SlotRange
- All Known Implementing Classes:
AdvancementFrame
,Arm
,ArmadilloEntity.State
,ArmorItem.Type
,Attachment
,AttributeModifierSlot
,AxolotlEntity.Variant
,BambooLeaves
,BedPart
,Biome.Precipitation
,Biome.TemperatureModifier
,BiomeEffects.GrassColorModifier
,BlockFace
,BlockHalf
,BlockMirror
,BlockRotation
,BoatEntity.Type
,ChatLogEntry.Type
,ChestType
,ClickEvent.Action
,CloudRenderMode
,ComparatorMode
,CookingRecipeCategory
,CopyComponentsLootFunction.Source
,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
,EnchantmentEffectTarget
,EntityAttributeModifier.Operation
,EquipmentSlot
,FilterMask.FilterStatus
,FireworkExplosionComponent.Type
,FontFilterType
,FontType
,Formatting
,FoxEntity.Type
,GameMode
,GenerationStep.Carver
,GenerationStep.Feature
,Heightmap.Type
,HorseColor
,HoverEvent.Action
,JigsawBlockEntity.Joint
,ListOperation.Mode
,LlamaEntity.Variant
,LootContext.EntityTarget
,MessageTrustStatus
,MineshaftStructure.Type
,ModelTransformationMode
,MooshroomEntity.Type
,NbtDataSource.Type
,NoteBlockInstrument
,OceanRuinStructure.BiomeTemperature
,Orientation
,Oxidizable.OxidationLevel
,PandaEntity.Gene
,ParrotEntity.Variant
,PistonType
,QuickPlayLogger.WorldType
,RabbitEntity.RabbitType
,RailShape
,Rarity
,RuinedPortalStructurePiece.VerticalPlacement
,Scaling.Type
,ScoreboardCriterion.RenderType
,ScoreboardDisplaySlot
,SculkSensorPhase
,SetNameLootFunction.Target
,SkullBlock.Type
,SlabType
,SpawnGroup
,SpawnParticlesEnchantmentEffectType.PositionSourceType
,SpreadType
,StairShape
,StructureBlockMode
,StructurePlacement.FrequencyReductionMethod
,StructurePool.Projection
,StructureSpawns.BoundingBox
,StructureTerrainAdaptation
,TelemetryEventProperty.GameMode
,TelemetryEventProperty.ServerType
,TextContent.Type
,Thickness
,Tilt
,TrialSpawnerState
,TropicalFishEntity.Variety
,VaultState
,VerticalSurfaceType
,VillageGossipType
,WallShape
,WireConnection
,World.ExplosionSourceType
public interface StringIdentifiable
An interface, usually implemented by enums, that allows the object 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 named net/minecraft/util/StringIdentifiable
intermediary net/minecraft/class_3542
official azj
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
static 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 <T extends StringIdentifiable>
com.mojang.serialization.Codec<T> createBasicCodec
(Supplier<T[]> values) 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 <T extends StringIdentifiable>
Function<String, T> createMapper
(T[] values, Function<String, String> valueNameTransformer) 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 named CACHED_MAP_THRESHOLD
Lnet/minecraft/util/StringIdentifiable;CACHED_MAP_THRESHOLD:I
intermediary field_38377
Lnet/minecraft/class_3542;field_38377:I
official W
Lazj;W: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 named asString
Lnet/minecraft/util/StringIdentifiable;asString()Ljava/lang/String;
intermediary method_15434
Lnet/minecraft/class_3542;method_15434()Ljava/lang/String;
official c
Lazj;c()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 named createCodec
Lnet/minecraft/util/StringIdentifiable;createCodec(Ljava/util/function/Supplier;)Lnet/minecraft/util/StringIdentifiable$EnumCodec;
intermediary method_28140
Lnet/minecraft/class_3542;method_28140(Ljava/util/function/Supplier;)Lnet/minecraft/class_3542$class_7292;
official a
Lazj;a(Ljava/util/function/Supplier;)Lazj$a;
-
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 named createCodec
Lnet/minecraft/util/StringIdentifiable;createCodec(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lnet/minecraft/util/StringIdentifiable$EnumCodec;
intermediary method_49454
Lnet/minecraft/class_3542;method_49454(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lnet/minecraft/class_3542$class_7292;
official a
Lazj;a(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lazj$a;
-
createBasicCodec
static <T extends StringIdentifiable> com.mojang.serialization.Codec<T> createBasicCodec(Supplier<T[]> values) - Mappings:
Namespace Name Mixin selector named createBasicCodec
Lnet/minecraft/util/StringIdentifiable;createBasicCodec(Ljava/util/function/Supplier;)Lcom/mojang/serialization/Codec;
intermediary method_53955
Lnet/minecraft/class_3542;method_53955(Ljava/util/function/Supplier;)Lcom/mojang/serialization/Codec;
official b
Lazj;b(Ljava/util/function/Supplier;)Lcom/mojang/serialization/Codec;
-
createMapper
static <T extends StringIdentifiable> Function<String,T> createMapper(T[] values, Function<String, String> valueNameTransformer) - Mappings:
Namespace Name Mixin selector named createMapper
Lnet/minecraft/util/StringIdentifiable;createMapper([Lnet/minecraft/util/StringIdentifiable;Ljava/util/function/Function;)Ljava/util/function/Function;
intermediary method_53953
Lnet/minecraft/class_3542;method_53953([Lnet/minecraft/class_3542;Ljava/util/function/Function;)Ljava/util/function/Function;
official a
Lazj;a([Lazj;Ljava/util/function/Function;)Ljava/util/function/Function;
-
toKeyable
- Mappings:
Namespace Name Mixin selector named toKeyable
Lnet/minecraft/util/StringIdentifiable;toKeyable([Lnet/minecraft/util/StringIdentifiable;)Lcom/mojang/serialization/Keyable;
intermediary method_28142
Lnet/minecraft/class_3542;method_28142([Lnet/minecraft/class_3542;)Lcom/mojang/serialization/Keyable;
official a
Lazj;a([Lazj;)Lcom/mojang/serialization/Keyable;
-