Interface StringIdentifiable

All Known Subinterfaces:
SkullBlock.SkullType, SlotRange
All Known Implementing Classes:
AdvancementFrame, Arm, ArmadilloEntity.State, Attachment, AttributeModifierSlot, AxolotlEntity.Variant, BambooLeaves, BedPart, Biome.Precipitation, Biome.TemperatureModifier, BiomeEffects.GrassColorModifier, BlockFace, BlockHalf, BlockMirror, BlockRotation, ChatLogEntry.Type, ChestType, ClickEvent.Action, CloudRenderMode, ComparatorMode, CookingRecipeCategory, CopyComponentsLootFunction.Source, CopyNameLootFunction.Source, CopyNbtLootFunction.Operator, CraftingRecipeCategory, CreakingHeartBlock.Creaking, DamageEffects, DamageScaling, DataPackStructureProvider.Format, 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, EquipmentModel.LayerType, EquipmentSlot, EquipmentType, FilterMask.FilterStatus, FireworkExplosionComponent.Type, FontFilterType, FontType, Formatting, FoxEntity.Type, GameMode, GenerationStep.Feature, Heightmap.Type, HorseColor, HoverEvent.Action, InactivityFpsLimit, 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, SalmonEntity.Variant, Scaling.Type, ScoreboardCriterion.RenderType, ScoreboardDisplaySlot, SculkSensorPhase, SetNameLootFunction.Target, SkullBlock.Type, SlabType, SpawnGroup, SpawnParticlesEnchantmentEffect.PositionSourceType, SpreadType, StairShape, StructureBlockMode, StructureLiquidSettings, StructurePlacement.FrequencyReductionMethod, StructurePool.Projection, StructureSpawns.BoundingBox, StructureTerrainAdaptation, TelemetryEventProperty.GameMode, TelemetryEventProperty.ServerType, TextContent.Type, Thickness, Tilt, TrialSpawnerState, TropicalFishEntity.Variety, UseAction, 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 a static final field that holds the codec for the enum.
Mappings:
Namespace Name
named net/minecraft/util/StringIdentifiable
intermediary net/minecraft/class_3542
official bba
  • 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 Lbba;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 Lbba;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 its asString() 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 Lbba;a(Ljava/util/function/Supplier;)Lbba$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 its asString() 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 Lbba;a(Ljava/util/function/Supplier;Ljava/util/function/Function;)Lbba$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 Lbba;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 Lbba;a([Lbba;Ljava/util/function/Function;)Ljava/util/function/Function;
    • toKeyable

      static com.mojang.serialization.Keyable toKeyable(StringIdentifiable[] values)
      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 Lbba;a([Lbba;)Lcom/mojang/serialization/Keyable;