ItemBlockState.java
net.minecraft.client.renderer.item.properties.select.ItemBlockState
信息
- 全限定名:net.minecraft.client.renderer.item.properties.select.ItemBlockState
- 类型:public record
- 包:net.minecraft.client.renderer.item.properties.select
- 源码路径:src/main/java/net/minecraft/client/renderer/item/properties/select/ItemBlockState.java
- 起始行号:L17
- 实现:SelectItemModelProperty
- 职责:
TODO
字段/常量
-
VALUE_CODEC- 类型:
PrimitiveCodec<String> - 修饰符:
public static final - 源码定位:
L18 - 说明:
TODO
- 类型:
-
TYPE- 类型:
SelectItemModelProperty.Type<ItemBlockState,String> - 修饰符:
public static final - 源码定位:
L19 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public String get(ItemStack itemStack, ClientLevel level, LivingEntity owner, int seed, ItemDisplayContext displayContext) @ L26
- 方法名:get
- 源码定位:L26
- 返回类型:String
- 修饰符:public
参数:
- itemStack: ItemStack
- level: ClientLevel
- owner: LivingEntity
- seed: int
- displayContext: ItemDisplayContext
说明:
TODO
public SelectItemModelProperty.Type<ItemBlockState,String> type() @ L31
- 方法名:type
- 源码定位:L31
- 返回类型:SelectItemModelProperty.Type<ItemBlockState,String>
- 修饰符:public
参数:
- 无
说明:
TODO
public Codec<String> valueCodec() @ L36
- 方法名:valueCodec
- 源码定位:L36
- 返回类型:Codec
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public record ItemBlockState(String property) implements SelectItemModelProperty<String> {
public static final PrimitiveCodec<String> VALUE_CODEC = Codec.STRING;
public static final SelectItemModelProperty.Type<ItemBlockState, String> TYPE = SelectItemModelProperty.Type.create(
RecordCodecBuilder.mapCodec(
i -> i.group(Codec.STRING.fieldOf("block_state_property").forGetter(ItemBlockState::property)).apply(i, ItemBlockState::new)
),
VALUE_CODEC
);
public @Nullable String get(ItemStack itemStack, @Nullable ClientLevel level, @Nullable LivingEntity owner, int seed, ItemDisplayContext displayContext) {
BlockItemStateProperties blockItemStateProperties = itemStack.get(DataComponents.BLOCK_STATE);
return blockItemStateProperties == null ? null : blockItemStateProperties.properties().get(this.property);
}
@Override
public SelectItemModelProperty.Type<ItemBlockState, String> type() {
return TYPE;
}
@Override
public Codec<String> valueCodec() {
return VALUE_CODEC;
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
字段/实现/方法调用/返回值 - 关联成员:
SelectItemModelProperty.Type.create()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
参数
- 引用位置: