|
| 1 | +# Staves |
| 2 | + |
| 3 | +HexGloop adds dyeable staves and a model predicate for when the staff is being used. |
| 4 | + |
| 5 | +The dyeable staves work by using the tintindex, so the `layer1` texture of the staff model should be a grayscale texture of the part that should be dyed. The other layers of the texture should avoid overlapping with this grayscale area to avoid z-fighting. |
| 6 | + |
| 7 | +The model predicate for when the staff is being used is `hexgloop:is_casting`, it's 0 when the staff is not in use and 1 when it is. For now this is just client side and based on when the player is using their own staff, but i do plan to one day add serverside support to see when others are using their staves. |
| 8 | + |
| 9 | +Since addons/resource packs may want to support the dyeable staves when gloop is installed but also not have the raw grayscale texture exposed when it isn't installed, we can take advantage of how minecraft loads undefined predicates to switch to the dyeable item model only when gloop is installed: |
| 10 | + |
| 11 | +### .../mymod/models/item/mystaff.json : |
| 12 | +```json |
| 13 | +{ |
| 14 | + "parent": "minecraft:item/handheld_rod", // this is usually what staves use to be positioned correctly in the player's hand but isn't required |
| 15 | + "overrides": [ |
| 16 | + { |
| 17 | + "model": "mymod:item/mystaff_dyeable", // a model file with dyeable texture on layer1 |
| 18 | + "predicate": { |
| 19 | + "hexgloop:is_casting": 0.0 // this override will simply be skipped if gloop is not installed. you'll still need this even if you don't plan on adding a separate casting model/texture |
| 20 | + } |
| 21 | + }, |
| 22 | + { |
| 23 | + "model": "mymod:item/mystaff_dyeable_casting", // a model file for a dyeable texture when the staff is in use - you don't need this section if you don't have/want a casting model |
| 24 | + "predicate": { |
| 25 | + "hexgloop:is_casting": 1 |
| 26 | + } |
| 27 | + } |
| 28 | + ], |
| 29 | + "textures": { |
| 30 | + "layer0": "mymod:item/mystaff" // texture to use when gloop isn't installed |
| 31 | + } |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +### .../mymod/models/item/mystaff_dyeable.json : |
| 36 | +```json |
| 37 | +{ |
| 38 | + "parent": "minecraft:item/handheld_rod", |
| 39 | + "textures": { |
| 40 | + "layer0": "mymod:item/mystaff_base", // base staff texture with the dyeable bit cut out |
| 41 | + "layer1": "mymod:item/mystaff_dyepart" // part of the texture to be dyed |
| 42 | + } |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +### .../mymod/models/item/mystaff_dyeable_casting.json : |
| 47 | +```json |
| 48 | +{ |
| 49 | + "parent": "minecraft:item/handheld_rod", |
| 50 | + "textures": { |
| 51 | + "layer0": "mymod:item/mystaff_base_casting", // base staff texture with the dyeable bit cut out |
| 52 | + "layer1": "mymod:item/mystaff_dyepart_casting" // part of the texture to be dyed |
| 53 | + } |
| 54 | +} |
| 55 | +``` |
0 commit comments