Pommel - 手持物品模型
—手持物品模型资源包—
什么是 Pommel?
Pommel 是一个 Fabric 模组,它允许资源包替换物品的“手持版本”模型——就像望远镜和三叉戟那样——让你自定义手中物品的样子。想要在手握中制作一个 3D 模型的战锤、一把火焰巨剑或一根古老的魔法法杖,同时保留原始物品的外观吗?有了 Pommel,这一切都能实现!
同样适用于模组添加的物品!
如果你使用 Pommel 创建了资源包,欢迎与我分享你的作品!我很期待看到你创作的内容!
面向资源包创作者
添加了以下物品谓词(Item Predicates):
pommel:is_held — 当物品在第三人称或第一人称视角中被手持时
pommel:first_third_person — 区分第一人称与第三人称视角下的物品
- 值为 0.5 时更改第一人称视角下指定的模型,值为 1.0 时更改第三人称视角下的模型。
pommel:is_offhand — 物品位于用户的副手槽位中
pommel:is_fixed — 当物品放置在物品展示框中时
pommel:is_head — 当物品佩戴在头盔槽位的头部时
pommel:is_ground — 当物品掉落在地面上时
pommel:is_thrown — 投掷类物品被抛出时(如鸡蛋、雪球、末影珍珠等)
pommel:is_used — 当物品正在被使用时(即按住使用/右键键);如果服务器安装了该模组且玩家也拥有该模组,则支持多人游戏同步
pommel:item_use — 物品被使用/消耗(例如吃东西)的持续时间
pommel:is_submerged — 物品浸没在 minecraft:water 中(不适用于其他液体)
- 当一个物品实体被扔进水里,但随后不再处于水中时(例如你移除了水),该物品仍会保持其“浸没”状态
pommel:is_enchanted — 如果物品附魔了
pommel:is_misc_entity_holding — 由村民、女巫、熊猫和狐狸持有的物品。
- 请注意,这三个实体仍将采用上述模型的“地面显示”设置。如有需要,你可以调整地面显示的旋转、平移和缩放,使这些实体手中的物品看起来更好。
- is_using 和 is_submerged 也会改变 GUI 中的物品模型
例如,通过修改模型文件 iron_pickaxe.json,你可以告诉模组在持有 pommel:is_held 时应显示哪个模型。
只要由物品模型 JSON 文件指定,提供的持握模型及其纹理可以位于任意位置。
JSON 示例:
{
"parent": "item/handheld",
"textures": {
"layer0": "minecraft:item/2d_model_texture"
},
"overrides": [
{ "predicate": { "pommel:is_held": 1.0 }, "model": "minecraft:item/my_held_item" },
{ "predicate": { "pommel:is_fixed": 1.0 }, "model": "minecraft:item/my_framed_item" },
{ "predicate": { "pommel:is_head": 1.0 }, "model": "minecraft:item/my_worn_item" },
{ "predicate": { "pommel:is_ground": 1.0 }, "model": "minecraft:item/my_ground_item" }
]
}
吃苹果示例:
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/apple"
},
"overrides": [
{ "predicate": { "pommel:is_held": 1 }, "model": "minecraft:item/held_items/apple_3d" },
{ "predicate": { "pommel:item_use": 0.25 }, "model": "minecraft:item/apple_eat_0" },
{ "predicate": { "pommel:is_held": 1, "pommel:item_use": 0.25 }, "model": "minecraft:item/held_items/apple_eat_0_3d" },
{ "predicate": { "pommel:item_use": 0.50 }, "model": "minecraft:item/apple_eat_1" },
{ "predicate": { "pommel:is_held": 1, "pommel:item_use": 0.50 }, "model": "minecraft:item/held_items/apple_eat_1_3d" },
{ "predicate": { "pommel:item_use": 0.75 }, "model": "minecraft:item/apple_eat_2" },
{ "predicate": { "pommel:is_held": 1, "pommel:item_use": 0.75 }, "model": "minecraft:item/held_items/apple_eat_2_3d" }
]
}
在此示例中,当你食用苹果时,苹果物品会从 apple_eat_0 变为 apple_eat_2。当它在你的手中被持握时,它也会变为该物品的 3D 版本,并且在食用时拥有独特的持握模型。
你还可以为持握模型指定文件目录以进行组织,并将父模型更改为其他模型。
其他示例
常见问题
问:此模组是否兼容 CIT(自定义物品纹理)?
- 答:只要您使用 CIT 将物品替换为物品模型(而非纹理),CIT Resewn 和 Optifine 即可正常工作。CIT 允许您替换物品的模型,因此 Pommel 仍能让您使用自定义手持模型。
问:这能用于原版 Minecraft 的物品谓词吗?例如自定义模型数据(Custom Model Data)或弓的拉弓状态?
- 答:可以,但请确保你为
custom_model_data 模型也指定了 pommel:is_held。
- 以下是使用原版物品谓词和手持物品模型的示例:
-
{
"parent": "item/handheld",
"textures": {
"layer0": "item/base_item"
},
"overrides": [
{ "predicate": { "pommel:is_held": 1.0 }, "model": "minecraft:item/base_item_held" },
{ "predicate": { "custom_model_data": 1 }, "model": "minecraft:item/custom_item" },
{ "predicate": { "custom_model_data": 1, "pommel:is_held": 1.0 }, "model": "minecraft:item/custom_item_held" }
]
}
- 答:是的,Eating Animation 允许你在食用物品时,通过 Pommel 替换为你选择的模型。该模组有两个谓词:
eating 和 eat(没有模组 ID 前缀),因此你可以将它们与 Pommel 的谓词结合使用。代码结构与上面 custom_model_data 的示例相同,只需替换为 Eating Animation 的谓词即可。此外,Eating Animation 还有一个视频指南(也在该模组的页面中链接),展示了如何设置它!请务必查看该模组!
- 答:第二种方案,你也可以直接使用
pommel:item_use,效果完全相同,且无需使用 Eating Animation 模组。我并不想“取代” Eating Animation。相反,item_use 谓词之所以被创建,是因为 Eating Animation 模组在 CIT(自定义物品纹理)方面存在一些兼容性问题,因此它可以作为替代方案。在使用 Eating Animation 时,物品模型可能无法正确更改/渲染对应的 CIT 模型,而 Pommel 则不存在此类问题。
问:我该如何替换模组物品的持握模型?
- 答:JSON 层级结构与 JSON 示例 相同,只是将前面的
minecraft ID 替换为 <mod_id>。
问:我的持握模型无法正常工作,遇到了一些问题。我该去哪里排查故障?
- 答:首先检查你的 JSON 代码是否有错误,因为 JSON 代码很容易不小心写错。大多数 IDE 都会自动检查错误,但也有一些网站可以提供在线检查。如果你仍然遇到问题,说实话,获得支持的最佳方式是前往 Discord 联系我(用户名是 timmychips),或者在 GitHub 上提交 Issue 请求!
Pommel - Held Item Models
—Held Item Model Resource Pack—
What is Pommel?
Pommel is a Fabric mod that lets resourcepacks replace the models for the held version of items—just like the spyglass and the trident—letting you customize what your item looks in your hand. Want to make a 3d model of the mace in your hand, a fiery greatsword, or an ancient magical staff while still retaining the original item? With Pommel, all that can be achieved!
Works for modded items as well!
If you create a resource pack with Pommel, feel free to share your work to me! I'd love to see what you can make!
For Resource Pack Creators
Adds the following Item Predicates:
pommel:is_held — when item is held in hand in third or first person
pommel:first_third_person — item in first person vs third person
- Value of 0.5 changes the model specified when in first person, value of 1.0 changes the model when in third person.
pommel:is_offhand — item is in the user's offhand slot
pommel:is_fixed — when item is in an item frame
pommel:is_head — when item is worn on head in helmet slot
pommel:is_ground — when item is dropped onto the ground
pommel:is_thrown — throwable items when thrown (egg, snowball, enderpearl, etc.)
pommel:is_used — when item is being used (i.e. holding the use/RMB key); syncs with multiplayer if mod is on server and players have the mod
pommel:item_use — duration use of an item being used/consumed, like eating food
pommel:is_submerged — item is submerged in minecraft:water (doesn't work with other liquids)
- When an item entity is thrown into water but then is no longer in water (e.g. you remove the water) the item still stays in it's "submerged" state
pommel:is_enchanted — if item is enchanted
pommel:is_misc_entity_holding — items held by Villagers, Witches, Pandas, and Foxes.
- Note that these three entities will still also take the display settings of the Ground display settings for said model. If need be, you can change the Ground display rotation, translation, scale to make items look better when held in these entity's hands.
- is_using and is_submerged also change the item model in the gui
For example, by modifying the model, iron_pickaxe.json, you can tell the mod what model should be displayed when held with pommel:is_held.
The held model provided as well as the textures for it can be wherever as long as it's specified by the item model json file.
JSON Example:
{
"parent": "item/handheld",
"textures": {
"layer0": "minecraft:item/2d_model_texture"
},
"overrides": [
{ "predicate": { "pommel:is_held": 1.0 }, "model": "minecraft:item/my_held_item" },
{ "predicate": { "pommel:is_fixed": 1.0 }, "model": "minecraft:item/my_framed_item" },
{ "predicate": { "pommel:is_head": 1.0 }, "model": "minecraft:item/my_worn_item" },
{ "predicate": { "pommel:is_ground": 1.0 }, "model": "minecraft:item/my_ground_item" },
]
}
Apple Eating Example:
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/apple"
},
"overrides": [
{ "predicate": { "pommel:is_held": 1 }, "model": "minecraft:item/held_items/apple_3d" },
{ "predicate": { "pommel:item_use": 0.25 }, "model": "minecraft:item/apple_eat_0" },
{ "predicate": { "pommel:is_held": 1, "pommel:item_use": 0.25 }, "model": "minecraft:item/held_items/apple_eat_0_3d" },
{ "predicate": { "pommel:item_use": 0.50 }, "model": "minecraft:item/apple_eat_1" },
{ "predicate": { "pommel:is_held": 1, "pommel:item_use": 0.50 }, "model": "minecraft:item/apple_eat_1_3d" },
{ "predicate": { "pommel:item_use": 0.75 }, "model": "minecraft:item/apple_eat_2" },
{ "predicate": { "pommel:is_held": 1, "pommel:item_use": 0.75 }, "model": "minecraft:item/apple_eat_2_3d" }
]
}
In this example, the apple item will change from apple_eat_0 to apple_eat_2 as you eat it. The apple item will also change to a 3d version of this when it's being held in your hand, as well as having unique models for the hand when being eaten.
You may also specify file directories for held models for organizing, as well as changing the parent model to something else.
Other Examples
Questions
Q: Does this work with CIT [Custom Item Textures]?
- A: CIT Resewn and Optifine will work as long as you have CIT replace the item with an item model (and not with a texture). CIT lets you replace an item's model, so Pommel will still allow you to have custom held models.
Q: Does this work with Vanilla Minecraft's item predicates such as Custom Model Data or bow Pulling?
- A: Yes, but be sure you specify
pommel:is_held for the custom_model_data models as well.
- Here is an example of using vanilla item predicates and held item models:
-
{
"parent": "item/handheld",
"textures": {
"layer0": "item/base_item"
},
"overrides": [
{ "predicate": { "pommel:is_held": 1.0 }, "model": "minecraft:item/base_item_held" },
{ "predicate": { "custom_model_data": 1 }, "model": "minecraft:item/custom_item" },
{ "predicate": { "custom_model_data": 1, "pommel:is_held": 1.0 }, "model": "minecraft:item/custom_item_held" }
]
}
- A: Yes, Eating Animation can let you replace the model of your choosing with Pommel when you eat an item.
The mod has two predicates,
eating and eat (no mod id in front) so you can combine that with the Pommel predicates. The code will be just like the custom_model_data example above with Eating Animation's predicates. There is also a video guide on Eating Animation (also linked on the mod's page) that will show you how to set it up, too! Please check out the mod!
- A: Second answer, you can also use
pommel:item_use exactly the same with the identical effect without the use of Eating Animation mod. I do not want to "replace" Eating Animation. Rather, the item_use predicate was made as Eating Animation mod has some compatability issues with CIT, so this can be used as an alternative. Item models may not change/render the correct CIT model with Eating Animation, whereas Pommel does not have such issue.
Q: How would I replace a modded item's held model?
- A: Same json hierarchy as in the JSON example, but instead of the id,
minecraft in front, it would be <mod_id>.
Q: I'm having issues getting my held model to work. Where can I go for troubleshooting?
- A: First check if your JSON code doesn't have errors, as it's pretty easy to accidentally screw up JSON code. Most IDEs will check for any errors, but there are some other websites that can check. If you're still having issues, honestly the best way to get support is to reach out to me on Discord (username is timmychips), or make an Issue request on the Github!
评论 0
登录后参与评分
还没有评论,来抢沙发吧