Record Class BlockItemStateProperties
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.BlockItemStateProperties
- All Implemented Interfaces:
TooltipProvider
public record BlockItemStateProperties(Map<String,String> properties)
extends Record
implements TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<BlockItemStateProperties> static final BlockItemStatePropertiesThe field for thepropertiesrecord component.private static final StreamCodec<io.netty.buffer.ByteBuf, Map<String, String>> static final StreamCodec<io.netty.buffer.ByteBuf, BlockItemStateProperties> -
Constructor Summary
ConstructorsConstructorDescriptionBlockItemStateProperties(Map<String, String> properties) Creates an instance of aBlockItemStatePropertiesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) apply(BlockState state) final booleanIndicates whether some other object is "equal to" this one.<T extends Comparable<T>>
@Nullable Tfinal inthashCode()Returns a hash code value for this object.booleanisEmpty()Returns the value of thepropertiesrecord component.final StringtoString()Returns a string representation of this record class.private static <T extends Comparable<T>>
BlockStateupdateState(BlockState state, Property<T> property, String value) <T extends Comparable<T>>
BlockItemStatePropertieswith(Property<T> property, BlockState state) <T extends Comparable<T>>
BlockItemStateProperties
-
Field Details
-
properties
-
EMPTY
-
CODEC
-
PROPERTIES_STREAM_CODEC
private static final StreamCodec<io.netty.buffer.ByteBuf, Map<String,String>> PROPERTIES_STREAM_CODEC -
STREAM_CODEC
-
-
Constructor Details
-
BlockItemStateProperties
-
-
Method Details
-
with
-
with
public <T extends Comparable<T>> BlockItemStateProperties with(Property<T> property, BlockState state) -
get
-
apply
-
updateState
private static <T extends Comparable<T>> BlockState updateState(BlockState state, Property<T> property, String value) -
isEmpty
public boolean isEmpty() -
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 withObjects::equals(Object,Object). -
properties
-