Interface StringIdentifiable

All Known Implementing Classes:
Attachment, AxolotlEntity.Variant, BambooLeaves, BedPart, Biome.Precipitation, Biome.TemperatureModifier, BiomeEffects.GrassColorModifier, BlockHalf, BlockMirror, BlockRotation, BoatEntity.Type, ChatLogEntry.Type, ChestType, ComparatorMode, CookingRecipeCategory, CraftingRecipeCategory, Decoration.Parameter, DensityFunctionTypes.BinaryOperationLike.Type, DensityFunctionTypes.UnaryOperation.Type, DensityFunctionTypes.WeirdScaledSampler.RarityValueMapper, DensityFunctionTypes.Wrapping.Type, Difficulty, Direction, Direction.Axis, DirectionTransformation, DoorHinge, DoubleBlockHalf, DyeColor, FilterMask.FilterStatus, Formatting, FoxEntity.Type, GameMode, GenerationStep.Carver, GenerationStep.Feature, Heightmap.Type, HorseColor, Instrument, JigsawBlockEntity.Joint, JigsawOrientation, LlamaEntity.Variant, MessageTrustStatus, MineshaftStructure.Type, MooshroomEntity.Type, OceanRuinStructure.BiomeTemperature, PandaEntity.Gene, ParrotEntity.Variant, PistonType, 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 a static final field that holds the codec for the enum.
Mappings:
Namespace Name
official aor
intermediary net/minecraft/class_3542
named net/minecraft/util/StringIdentifiable
  • Field Details

    • field_38377

      static final int field_38377
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official W Laor;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 Laor;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 its asString() method and a given decode function.
      Mappings:
      Namespace Name Mixin selector
      official a Laor;a(Ljava/util/function/Supplier;)Laor$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;
    • toKeyable

      static com.mojang.serialization.Keyable toKeyable(StringIdentifiable[] values)
      Mappings:
      Namespace Name Mixin selector
      official a Laor;a([Laor;)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;