Interface IClientItemExtensions
public interface IClientItemExtensions
Client-only extensions to
Item
.- See Also:
-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
applyForgeHandTransform
(PoseStack poseStack, LocalPlayer player, HumanoidArm arm, ItemStack itemInHand, float partialTick, float equipProcess, float swingProcess) Called right before when client applies transformations to item in hand and render it.default HumanoidModel.ArmPose
getArmPose
(LivingEntity entityLiving, InteractionHand hand, ItemStack itemStack) This method returns an ArmPose that can be defined using theHumanoidModel.ArmPose.create(String, boolean, IArmPoseTransformer)
method.default BlockEntityWithoutLevelRenderer
Queries this item's renderer.default @Nullable Font
getFont
(ItemStack stack, IClientItemExtensions.FontContext context) Returns the font used to render data related to this item as specified in thecontext
.default Model
getGenericArmorModel
(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the armor model for this item when it's equipped.default HumanoidModel
<?> getHumanoidArmorModel
(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the humanoid armor model for this item when it's equipped.static IClientItemExtensions
static IClientItemExtensions
default void
renderHelmetOverlay
(ItemStack stack, Player player, int width, int height, float partialTick) Called when the client starts rendering the HUD, and is wearing this item in the helmet slot.default boolean
shouldBobAsEntity
(ItemStack stack) Returns Whether the item should bob when rendered in the world as an entity.default boolean
shouldSpreadAsEntity
(ItemStack stack) Returns Whether the item should be spread out when rendered in the world as an entity.
-
Field Details
-
DEFAULT
-
-
Method Details
-
of
-
of
-
getFont
@Nullable default @Nullable Font getFont(ItemStack stack, IClientItemExtensions.FontContext context) Returns the font used to render data related to this item as specified in thecontext
. Returnnull
to use the default font.- Parameters:
stack
- The item stackcontext
- The context in which the font will be used- Returns:
- A
Font
or null to use the default
-
getArmPose
@Nullable default HumanoidModel.ArmPose getArmPose(LivingEntity entityLiving, InteractionHand hand, ItemStack itemStack) This method returns an ArmPose that can be defined using theHumanoidModel.ArmPose.create(String, boolean, IArmPoseTransformer)
method. This allows for creating custom item use animations.- Parameters:
entityLiving
- The entity holding the itemhand
- The hand the ArmPose will be applied toitemStack
- The stack being held- Returns:
- A custom ArmPose that can be used to define movement of the arm
-
applyForgeHandTransform
default boolean applyForgeHandTransform(PoseStack poseStack, LocalPlayer player, HumanoidArm arm, ItemStack itemInHand, float partialTick, float equipProcess, float swingProcess) Called right before when client applies transformations to item in hand and render it.- Parameters:
poseStack
- The pose stackplayer
- The player holding the item, it's always main client playerarm
- The arm holding the itemitemInHand
- The held itempartialTick
- Partial tick time, useful for interpolationequipProcess
- Equip process time, Ranging from 0.0 to 1.0. 0.0 when it's done equippingswingProcess
- Swing process time, Ranging from 0.0 to 1.0. 0.0 when it's done swinging- Returns:
- true if it should skip applying other transforms and go straight to rendering
-
getHumanoidArmorModel
default HumanoidModel<?> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the humanoid armor model for this item when it's equipped.- Parameters:
livingEntity
- The entity wearing the armoritemStack
- The item stackequipmentSlot
- The slot the item is inoriginal
- The original armor model. Will have attributes set.- Returns:
- A HumanoidModel to be rendered. Relevant properties are to be copied over by the caller.
- See Also:
-
getGenericArmorModel
default Model getGenericArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, HumanoidModel<?> original) Queries the armor model for this item when it's equipped. Useful in place ofgetHumanoidArmorModel(LivingEntity, ItemStack, EquipmentSlot, HumanoidModel)
for wrapping the original model or returning anything non-standard.If you override this method you are responsible for copying any properties you care about from the original model.
- Parameters:
livingEntity
- The entity wearing the armoritemStack
- The item stackequipmentSlot
- The slot the item is inoriginal
- The original armor model. Will have attributes set.- Returns:
- A Model to be rendered. Relevant properties must be copied over manually.
- See Also:
-
renderHelmetOverlay
default void renderHelmetOverlay(ItemStack stack, Player player, int width, int height, float partialTick) Called when the client starts rendering the HUD, and is wearing this item in the helmet slot.This is where pumpkins would render their overlay.
- Parameters:
stack
- The item stackplayer
- The player entitywidth
- The viewport widthheight
- Viewport heightpartialTick
- Partial tick time, useful for interpolation
-
getCustomRenderer
Queries this item's renderer.Only used if
BakedModel.isCustomRenderer()
returnstrue
orBlockBehaviour.BlockStateBase.getRenderShape()
returnsRenderShape.ENTITYBLOCK_ANIMATED
.By default, returns vanilla's block entity renderer.
-
shouldBobAsEntity
Returns Whether the item should bob when rendered in the world as an entity.- Parameters:
stack
- The stack being rendered- Returns:
- Whether the item should bob when rendered in the world as an entity
-
shouldSpreadAsEntity
Returns Whether the item should be spread out when rendered in the world as an entity.- Parameters:
stack
- The stack being rendered- Returns:
- Whether the item should be spread out when rendered in the world as an entity
-