Repository navigation
Data Components
This mod is made possible by leveraging the new Data Components added in 1.20.5. By using commands you're able to turn any item into a backpack, lunch box, quiver, etc. and fully leverage the potential of this mod for your gameplay or modpack.
As a general rule, the items that can be inserted into these cannot be items not allowed in shulker boxes or items that have another trait. Later in the wiki when I say "holds all kinds of items", refer to this. Here are examples how to give a player a diamond that acts like the various storage types. Be aware that items already with unique functions like buckets or vanilla bundles might not work correctly with these components attached.
For example, we will use the give command. To add data components to items, follow the item's id with square brackets. Inside the brackets is where you will write the components like this:
/give @p minecraft:diamond[beansbackpacks:bundle={size:4,sound:"HARD"}].
All traits have a optional sound field that determines the sound of inserting/removing items. The options for sounds are: HARD, SOFT, VWOOMP, CRUNCH, and CLAY. With the field excluded from the command the sound will default to HARD
Traits are the term used for the Data Components that must be applied to a item to convert it to one of the many storage types this mod adds. Only a single trait should be on an item at a time or else unexpected results might occur. Below are the technical IDs for each trait that this mod adds.
Fields: size, sound
The bundle traits holds all kinds of items. The size field determines how many weighted stacks can be stored. One weighted stack can equal either 64 Cobblestone, 16 Ender Pearls, 32 Seeds + 8 Eggs, or 1 Iron Sword.
Fields: size, sound
Holds only items with the minecraft:food component. Right clicking while holding this item will begin consuming the item selected with the scroll wheel in the inventory.
Fields: size, sound
Command only component which holds all kinds of items. Acts similar to the bundle, but this trait stores it's items as traditional slots instead of weighted stacks, meaning if the field size was 2, only a Cobblestone and an Apple would fill up the trait and only 63 more Cobblestone and 63 more Apples could fit. Just like if a chest had 2 slots.
Fields: size, sound
Stores items similar to the chest trait and holds Potions, Water Bottles, Honey Bottles, and Milk Buckets. Right clicking while holding this item with a Potion selected will immediately use the Potion and grant the player the effects while destroying the Glass Bottle instead of returning it. Selecting a Water Bottle will extinguish the player while consuming the Glass Bottle. Selecting a Honey Bottle will immediately fill the player's hunger while *you guessed it* consuming the Glass Bottle. And finally, using a Milk Bucket will remove any effects the player has but will return the Empty Bucket to the bag's inventory.
Fields: size, sound
Stores items similar to the chest trait and holds Arrows. With the Quiver trait anywhere in the inventory, a Bow or Crossbow will search for it and use any arrows stored inside. Using the mouse wheel you can change the selected arrow that the Bows would use. Picking up an arrow from the ground will immediately store it in the quiver.
Fields: size, sound, slot, texture
Similar to the bundle trait but is equipped to the player's back. The additional fields slot, handles which slot the backpack is equipped whether it's the back, like a backpack, or the legs, like leather leggings. texture is responsible for the texture when the backpack is placed.
Simply takes a namespaced location for a item model and overrides it's current model. Try it for yourself; /give @p minecraft:diamond[beansbackpacks:display="minecraft:iron_ingot"]. This gives a diamond to the player while looking like a Iron Ingot. display takes the model minecraft:iron_ingot and disguises the diamond by directing it to render as the given model.
With a trait present, this component takes either a list of namespaced item ids or a item tag which limits which items can be inserted into the present trait's inventory. As example, if you wanted to only allow for iron items to be stored in a bundle, the give command would look like;
/give @p beansbackpacks:bundle[beansbackpacks:filter=["minecraft:iron_ingot","minecraft:iron_nugget","minecraft:iron_block"]]. This item only allows Iron Ingots, Nuggets, and Block in the bundle.
Alternatively you could use minecraft Item Tags to filter items; /give @p beansbackpacks:bundle[beansbackpacks:filter="#minecraft:trim_materials"] gives the player a bundle that can only store materials which can be used to trim armor. Inverting a tag by starting it with !# works as well.
Both the Equipable and Placeable Components leverage Item Models to allow for customization. Item Model Predicates is an advanced way to modify the item's model under specific conditions. The Minecraft Wiki has a full list of vanilla conditions you can check out HERE, and this mod adds a few we'll go over now.
This predicate measures the amount of storage used. 0 being completely empty, and 1 being completely full. As soon as an item is stored the scale begins at 0.1, the climbs to 1 the closer to full it gets.
This predicate tests if the item has the lunch trait and is currently being used. Use the value 1 for when it's being eaten from and 0 if not.