Record Class MapId
java.lang.Object
java.lang.Record
net.minecraft.world.level.saveddata.maps.MapId
- All Implemented Interfaces:
TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<MapId> private final intThe field for theidrecord component.private static final Componentstatic final StreamCodec<io.netty.buffer.ByteBuf, MapId> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intid()Returns the value of theidrecord component.key()final StringtoString()Returns a string representation of this record class.
-
Field Details
-
id
private final int idThe field for theidrecord component. -
CODEC
-
STREAM_CODEC
-
LOCKED_TEXT
-
-
Constructor Details
-
MapId
public MapId(int id) Creates an instance of aMapIdrecord class.- Parameters:
id- the value for theidrecord component
-
-
Method Details
-
key
-
addToTooltip
public void addToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) - Specified by:
addToTooltipin interfaceTooltipProvider
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with thecomparemethod from their corresponding wrapper classes. -
id
public int id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-