Bow Texture Dependency

Recently I wrote an entire page dedicated to predicate values, within models.
Only after writing it did I discover an interesting oversight to do with bow models, which I posted on twitter.

In the video you can see the sword change material depending on the pull of the bow, wooden sword is shown when the bow is not being pulled, and a diamond sword will show when the bow is fully pulled back, this will affect the second bow anywhere in the hotbar, the offhand, or even when it’s on the player’s head.

So how did it work?

Firstly it uses two bows, the item in my offhand is another bow with a different damage value, the interesting thing comes from how the second bow had it’s predicates specified.

{ “predicate”: { “damage”: 0 }, “model”: “item/bow”},
{ “predicate”: { “damage”: 0, “pulling”: 1 }, “model”: “item/bow_pulling_0”},
{ “predicate”: { “damage”: 0, “pull”: 0.65, “pulling”: 1 }, “model”: “item/bow_pulling_1”},
{ “predicate”: { “damage”: 0, “pull”: 0.9, “pulling”: 1 }, “model”: “item/bow_pulling_2”},
{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 0 }, “model”: “item/wooden_sword” },
{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 0.333 }, “model”: “item/stone_sword” },
{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 0.667 }, “model”: “item/iron_sword” },
{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 1 }, “model”: “item/diamond_sword” },
{ “predicate”: { “damaged”: 1 }, “model”: “item/bow”},
{ “predicate”: { “damaged”: 1, “pulling”: 1 }, “model”: “item/bow_pulling_0”},
{ “predicate”: { “damaged”: 1, “pull”: 0.65, “pulling”: 1 }, “model”: “item/bow_pulling_1”},
{ “predicate”: { “damaged”: 1, “pull”: 0.9, “pulling”: 1 }, “model”: “item/bow_pulling_2”}

There’s a lot of predicates, so let’s break it down into smaller chunks.

{ “predicate”: { “damage”: 0 }, “model”: “item/bow”},
{ “predicate”: { “damage”: 0, “pulling”: 1 }, “model”: “item/bow_pulling_0”},
{ “predicate”: { “damage”: 0, “pull”: 0.65, “pulling”: 1 }, “model”: “item/bow_pulling_1”},
{ “predicate”: { “damage”: 0, “pull”: 0.9, “pulling”: 1 }, “model”: “item/bow_pulling_2”},

This is the default bow model, it’s been modified so that it will show when using a bow with 0 damage.

{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 0 }, “model”: “item/wooden_sword” },
{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 0.333 }, “model”: “item/stone_sword” },
{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 0.667 }, “model”: “item/iron_sword” },
{ “predicate”: { “damaged”: 0, “damage”: 0.0025974025974025974, “pull”: 1 }, “model”: “item/diamond_sword” },

This is the predicates used to display the swords, the thing to notice between these values and the previous values is the fact that “pulling”: 1 is not used. This is what causes the bow to animate when pulling another bow.
The “pull” predicate does not check whether the player is holding that specific bow in it’s hand, but “pulling” does, so specifying “pulling” will cause the bow only to animate if it is that bow that is being pulled.

The last 4 predicates are the same as the first 4 but are used when the bow is damaged ie when the bow is not unbreakable, so the default bow is used when the bow is not unbreakable.

Download this example resourcepack

This only affects bows and will not work with any other items, also the second bow is a bow itself, which could cause some problems if used as the player could potentially fire the second bow.

I have reported this behaviour to the bug tracker which thanks to another user has some code analysis, including a simple fix, which means this oversight will probably be fixed some time.

Although this means that you need to specify “pulling”: 1 for each override that is used when the bow is being pulled, if you want to have several bow models using different damage values, or you may run into this problem.

Bow Texture Dependency

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s