Creating a Resourceful Lootbags custom bag
The information that I found on the web about how to integrate with this modpack were scarse, so I decided to create this gist to explain a little bit.
Note: This guide was created with the intention of explaining this for server creators who want to integrate this modpack into their server, however it could also help people who are trying to use this mod for their own mod or pack.
A lootbag is defined by creating a custom recipe JSON with the type of lootbags:loot
,
and other keys that are briefly explained in the mod wiki.
To do this, you will need to use a datapack. The folder structure of our datapack will look something like this, note that things enclosed inside [square braces]
are meant to be changed:
# inside [world folder]/datapacks/
[datapack name]/
├ data/
│ ├ [category_name]/
│ │ └ recipes/
│ │ ├ [lootbag_name].json
│ │ └ [another_bag].json
│ ├ # You can have more folders if you want to be organised!
│ └ # [second_category]/
└ pack.mcmeta
Example:
[datapcak name]
->lolcat
also
this/
is a folder and things that are visually inside (2 spaces in) are folders or files within it.
The [lootbag_name].json
(and others) is where you will put the lootbag information, with the afforementioned keys.
Here are two examples:
If the following confuses you, you should look up "json" to understand this config file better.
{
"type": "lootbags:loot",
"name": "[Name]",
"rarity": "COMMON",
"output": {
"rolls": 2,
"entries": [
{
"stack": "minecraft:stone",
"weight": 1
},
{
"stack": {
"id": "minecraft:diamond_sword",
"count": 1
},
"weight": 1
}
]
}
}
{
"type": "lootbags:loot",
"name": "[Name]",
"output": {
"table": "minecraft:chests/end_city_treasure"
}
}
- The
type
key must not be modified. Leave the value aslootbags:lootbag
- The
name
key can be whatever you want, and it will be displayed in the top corner of the screen when opening a lootbag. This is NOT the item name when in your hand. - The
output
key is what actually defines what loot to give when right-clicking the bag. It should be a sub-section with these keys:- The
rolls
key defines the amount of items that will be given to the player. - The
entries
key lists the actual items, aka the loot table. This should be a listsee below of sub-sections with the following keys:- The
stacks
key is an item. Can also be item format instead of text. - The
weight
key could be explained as "the probability of an item being chosen". The higher the number, the more likely it is to be chosen.
- The
- The
table
key selects a predefined minecraft loot table, and is mutually excluside with the previous two.
- The
A list is defined as a comma-separated sequence of elements, in our case it will be dictionaries (aka sections).
Here's an example of a list with three empty sections: [{}, {}, {}]
This is pretty straightforwards. We use pack format of 10, and the description can be whatever you want.
{
"pack": {
"pack_format": 10,
"description": "[Something meaningful that explains your datapack]"
}
}
The items can be obtained via /give
or any other method that drops an item. It should be a lootbags:loot_bag
with an NBT data defined.
- The
Loot
key must point to a lootbag file, with the formatfolder:file
. - The
Type
key is to select the texture to display (via rarity), as the bags have different textures depending on the rarity. - The
Color
key should be an integer representation of a colour. This will be the colour of the text of the item. If you have a hex, such as#ffff00
, you can use an online converter. Remove the#
from the beginning.
Example assuming the file structure defined above (remember to change what's inside the []
):
/give [player] lootbags:loot_bag{"Loot":"[category_name]:[lootbag_name]","Name":"[Anything you want]","Color":[Number],"Type":"RARE"}
If anything was not clear, here is a full pack example, with the appropriate folders. This could also serve as a baseline to edit.
External download via leo.might-be.gay
Example command:
/give @s lootbags:loot_bag{"Loot":"example_name:example_name_two","Name":"Hello from GitHub","Color":16777215}