Hold My Items is a first-person animation mod for Minecraft 1.21.5, allowing resource packs to define fully custom animations using JavaScript. Whether you're making swords feel more impactful, tools look more realistic, or just creating stylish motion effects β this mod gives you full control over how items and hands animate in first person.
- π¬ JavaScript-based animation scripting
- π§° Built-in math, player, and item helpers
- π§ Persistent variables (float, boolean, int, item)
- π¦ Fully resourcepack-driven (no modding required for new animations)
- π Supports separate hand and item animations
- π Supports easing functions for smooth transitions
To define your custom animations, include the following files in a resource pack:
assets/minecraft/holdmyitems/hand_pose.js
assets/minecraft/holdmyitems/item_pose.js
These scripts will be automatically loaded and run during first-person item rendering.
The mod uses JavaScript (via GraalVM) to define animations. Scripts are executed each frame and are provided with the following bindings and utility classes:
| Name | Type | Description |
|---|---|---|
matrices |
MatrixStack |
Used to apply translations, rotations, and scaling |
deltaTime |
float |
delta time |
equipProgress |
float |
0.0β1.0 progress of item equip animation |
swingProgress |
float |
0.0β1.0 progress of item swing animation |
item |
ItemStack |
Currently rendered item |
hand |
Hand |
main_hand or off_hand |
mainHand |
boolean |
true if the item is in the main hand |
bl |
boolean |
true if current hand is right |
player |
AbstractClientPlayerEntity |
Reference to the local player |
registry |
Map<String, Float> |
For defining persistent float variables via global.varName = value; |
M.scale(matrices, x, y, z);
M.moveX(matrices, amount);
M.rotateY(matrices, degrees);
M.sin(angleRadians); // etc.Includes:
- Basic trig:
sin,cos,abs,floor,ceil,round,pow,clamp - Transforms:
scale,moveX/Y/Z,rotateX/Y/Z(with and without pivot)
The P class is a utility that exposes player-related properties and states in a script-friendly way. These methods help you query player movement, position, state (like sneaking or swimming), view rotation, and equipped items.
Returns true if the player is sneaking (crouching).
Returns true if the player is currently on the ground.
Returns true if the player is swimming (in water and using swimming mechanics).
Returns true if the player is currently climbing (e.g., on a ladder or vine).
Returns true if the player is in crawling pose (triggered by 1-block height gaps or trapdoors).
Returns true if the player is fully submerged in water (e.g., for underwater swimming).
These return the playerβs world position:
double getX(player)β Returns the X coordinatedouble getY(player)β Returns the Y coordinatedouble getZ(player)β Returns the Z coordinate
Useful for movement-based animations:
double getXSpeed(player)β Horizontal X velocitydouble getYSpeed(player)β Vertical Y velocitydouble getZSpeed(player)β Horizontal Z velocitydouble getSpeed(player)β Combined movement speed (vector length)
boolean isUsingItem(player)β Returnstrueif the player is holding and using an item (e.g., eating, charging a bow)Hand getActiveHand(player)β Returns the hand (main_handoroff_hand) used in the active item use
double getYaw(player)β Playerβs head yaw (horizontal rotation)double getPitch(player)β Playerβs head pitch (vertical rotation)
ItemStack getMainItem(player)β Item in main handItemStack getOffhandItem(player)β Item in off-hand
The I class is a helper utility for querying item stack properties such as type, tags, action, and name.
Returns true if the ItemStack is of the given Item.
I.isOf(item, Items.get("minecraft:diamond_sword"));Returns true if the item is part of a given tag group.
I.isIn(item, ItemTags.SWORDS);Tags can also include custom or conventional tags loaded from datapacks or mods.
Returns true if the item stack is empty.
Returns the item's use animation as a string (e.g., "eat", "drink", "bow").
if (I.getUseAction(item) === "bow") {
// Animate bow drawing
}Returns the localized display name of the item as a string.
Returns true if the item is a crossbow and is currently charged (i.e., ready to fire).
Useful for checking tags, use state, or item identity.
Items.get("minecraft:diamond_sword")Retrieves an Item instance by namespaced ID.
For checking standard item tags or custom tag groups.
Contains various easing functions (e.g., easeInOutQuad, easeOutSine) for smooth transitions.
Define persistent values inside scripts:
global.swingOffset = 0;
global.isCharging = false;Example usage
global.idle = 0;
idle += 0.1 * deltaTime;
M.rotateX(matrices, 3 * M.sin(idle));These values persist across frames and reloads, allowing stateful animations.
You can reference and mutate them freely.
- Install Fabric for Minecraft
1.21.5. - Download and add your received beta build of
Hold My Itemsto yourmods/folder. - Add or create a resource pack with your animation scripts.
MIT License β free to use and modify.
Created by sapling.
Thanks to the FabricMC and Minecraft modding communities!