Interface IClientItemExtensions
Item.- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanapplyForgeHandTransform(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 intgetArmorLayerTintColor(ItemStack stack, EquipmentClientInfo.Layer layer, int layerIdx, int fallbackColor) Called when armor layers are rendered byEquipmentLayerRenderer.default @Nullable ResourceLocationgetArmorTexture(ItemStack stack, EquipmentClientInfo.LayerType type, EquipmentClientInfo.Layer layer, ResourceLocation _default) Called by RenderBiped and RenderPlayer to determine the armor texture that should be used for the currently equipped item.default HumanoidModel.ArmPosegetArmPose(LivingEntity entityLiving, InteractionHand hand, ItemStack itemStack) This method returns an ArmPose that can be defined using themethod.invalid reference
net.minecraft.client.model.HumanoidModel.ArmPose#create(String, boolean, IArmPoseTransformer)default intgetDefaultDyeColor(ItemStack stack) Called once per render pass of equipped armor items, regardless of the number of layers; the return value of this method is passed togetArmorLayerTintColor(ItemStack, EquipmentClientInfo.Layer, int, int)as thefallbackColorparameter.default @Nullable FontgetFont(ItemStack stack, IClientItemExtensions.FontContext context) Returns the font used to render data related to this item as specified in thecontext.default ModelgetGenericArmorModel(ItemStack itemStack, EquipmentClientInfo.LayerType layerType, Model original) Queries the armor model for this item when it's equipped.default ModelgetHumanoidArmorModel(ItemStack itemStack, EquipmentClientInfo.LayerType layerType, Model original) Queries the humanoid armor model for this item when it's equipped.default ResourceLocationgetScopeOverlayTexture(ItemStack stack) Returns the texture to use for scoping with the item.static IClientItemExtensionsstatic IClientItemExtensionsdefault voidrenderFirstPersonOverlay(ItemStack stack, EquipmentSlot equipmentSlot, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) Called to render an overlay on the first-person camera.default voidsetupModelAnimations(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, Model model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) Called when an armor piece is about to be rendered, allowing parts of the model to be animated or changed.default booleanshouldBobAsEntity(ItemStack stack) Returns Whether the item should bob when rendered in the world as an entity.default booleanshouldSpreadAsEntity(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. Returnnullto use the default font.- Parameters:
stack- The item stackcontext- The context in which the font will be used- Returns:
- A
Fontor 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 themethod. This allows for creating custom item use animations.invalid reference
net.minecraft.client.model.HumanoidModel.ArmPose#create(String, boolean, IArmPoseTransformer)- 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 Model getHumanoidArmorModel(ItemStack itemStack, EquipmentClientInfo.LayerType layerType, Model original) Queries the humanoid armor model for this item when it's equipped.- Parameters:
itemStack- The item stacklayerType- 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(ItemStack itemStack, EquipmentClientInfo.LayerType layerType, Model original) Queries the armor model for this item when it's equipped. Useful in place ofgetHumanoidArmorModel(ItemStack, EquipmentClientInfo.LayerType, Model)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:
itemStack- The item stacklayerType- 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:
-
setupModelAnimations
default void setupModelAnimations(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, Model model, float limbSwing, float limbSwingAmount, float partialTick, float ageInTicks, float netHeadYaw, float headPitch) Called when an armor piece is about to be rendered, allowing parts of the model to be animated or changed.- Parameters:
livingEntity- The entity wearing the armoritemStack- The item stack being wornequipmentSlot- The slot the armor stack is being worn inmodel- The armor model being renderedlimbSwing- The swing position of the entity's walk animationlimbSwingAmount- The swing speed of the entity's walk animationpartialTick- The partial tick timeageInTicks- The total age of the entity, with partialTick already appliednetHeadYaw- The yaw (Y rotation) of the entity's headheadPitch- The pitch (X rotation) of the entity's head
-
renderFirstPersonOverlay
default void renderFirstPersonOverlay(ItemStack stack, EquipmentSlot equipmentSlot, Player player, GuiGraphics guiGraphics, DeltaTracker deltaTracker) Called to render an overlay on the first-person camera.This method will always be called to render an overlay, regardless of whether the client camera overlay provided by the
Equippable data componentis present. If the equippable overlay is present (e.g. the pumpkin overlay), this method will be called after it has been rendered.This method should be used if the overlay is dynamic or has dynamic components. For a static overlay, prefer using
Equippable.cameraOverlay().- Parameters:
stack- The item stack that the player is wearingequipmentSlot- The slot in which the player is wearing or holding the above item stackplayer- The player entityguiGraphics- The gui graphicsdeltaTracker- The delta tracker
-
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
-
getArmorLayerTintColor
default int getArmorLayerTintColor(ItemStack stack, EquipmentClientInfo.Layer layer, int layerIdx, int fallbackColor) Called when armor layers are rendered byEquipmentLayerRenderer.Allows custom dye colors to be specified per-layer; default vanilla behavior allows for only a single dye color (specified by the
DataComponents.DYED_COLORdata component) for all layers.Returning 0 here will cause rendering of this layer to be skipped entirely; this is recommended if the layer doesn't need to be rendered for a particular armor slot.
- Parameters:
stack- the armor item stack being renderedlayer- the armor layer being renderedlayerIdx- an index into the list of layers for theArmorMaterialused by this itemfallbackColor- the return value ofgetDefaultDyeColor(ItemStack), passed as a parameter for performance- Returns:
- a custom color for the layer, in ARGB format, or 0 to skip rendering
-
getDefaultDyeColor
Called once per render pass of equipped armor items, regardless of the number of layers; the return value of this method is passed togetArmorLayerTintColor(ItemStack, EquipmentClientInfo.Layer, int, int)as thefallbackColorparameter.You can override this method for your custom armor item to provide an alternative default color for the item when no explicit color is specified.
- Parameters:
stack- the armor item stack- Returns:
- a default color for the layer, in ARGB format
-
getArmorTexture
@Nullable default @Nullable ResourceLocation getArmorTexture(ItemStack stack, EquipmentClientInfo.LayerType type, EquipmentClientInfo.Layer layer, ResourceLocation _default) Called by RenderBiped and RenderPlayer to determine the armor texture that should be used for the currently equipped item. This will be called on stacks with theDataComponents.EQUIPPABLEcomponent. Returning null from this function will use the default value.- Parameters:
stack- ItemStack for the equipped armortype- The layer type of the armorlayer- The armor layer_default- The default texture determined by the equipment renderer- Returns:
- Path of texture to bind, or null to use default
-
getScopeOverlayTexture
Returns the texture to use for scoping with the item.- Parameters:
stack- The scoping item stack- Returns:
- The texture to use for scoping
-