CrossbowPull.java
net.minecraft.client.renderer.item.properties.numeric.CrossbowPull
信息
- 全限定名:net.minecraft.client.renderer.item.properties.numeric.CrossbowPull
- 类型:public class
- 包:net.minecraft.client.renderer.item.properties.numeric
- 源码路径:src/main/java/net/minecraft/client/renderer/item/properties/numeric/CrossbowPull.java
- 起始行号:L14
- 实现:RangeSelectItemModelProperty
- 职责:
TODO
字段/常量
MAP_CODEC- 类型:
MapCodec<CrossbowPull> - 修饰符:
public static final - 源码定位:
L15 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
- 无
方法
下面的方法块按源码顺序生成。
public float get(ItemStack itemStack, ClientLevel level, ItemOwner owner, int seed) @ L17
- 方法名:get
- 源码定位:L17
- 返回类型:float
- 修饰符:public
参数:
- itemStack: ItemStack
- level: ClientLevel
- owner: ItemOwner
- seed: int
说明:
TODO
public MapCodec<CrossbowPull> type() @ L30
- 方法名:type
- 源码定位:L30
- 返回类型:MapCodec
- 修饰符:public
参数:
- 无
说明:
TODO
代码
@OnlyIn(Dist.CLIENT)
public class CrossbowPull implements RangeSelectItemModelProperty {
public static final MapCodec<CrossbowPull> MAP_CODEC = MapCodec.unit(new CrossbowPull());
@Override
public float get(ItemStack itemStack, @Nullable ClientLevel level, @Nullable ItemOwner owner, int seed) {
LivingEntity entity = owner == null ? null : owner.asLivingEntity();
if (entity == null) {
return 0.0F;
} else if (CrossbowItem.isCharged(itemStack)) {
return 0.0F;
} else {
int chargeDuration = CrossbowItem.getChargeDuration(itemStack, entity);
return (float)UseDuration.useDuration(itemStack, entity) / chargeDuration;
}
}
@Override
public MapCodec<CrossbowPull> type() {
return MAP_CODEC;
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
UseDuration.useDuration()
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
方法调用 - 关联成员:
CrossbowItem.getChargeDuration(), CrossbowItem.isCharged()
- 引用位置:
-
- 引用位置:
参数
- 引用位置: