Tutorials - Malorolam/LootBags GitHub Wiki
Here is a collection of examples and tutorials for common tasks.
General Lootbag Table - The loot table that is shared between each bag.
Standard Item Format - Lootbags uses a standard item format for all whitelisted and blacklisted items. Depending on the context, later parts of this format are omitted. The format is as such: <Mod ID>:<Item Name>:<Metadata>:<Minimum Stack>:<Maximum Stack>:<Weight>:<NBT Data Byte Array>. The Mod ID and Item Name are fixed values set by the mod author and are used to register the item within Forge. These have to be exact so it is advised to use the lootbags_dumphelditem command or another packmaking utility to obtain them. The Metadata entry is an additional value to identify specific variations of the same item. These first three entries are present for every usage of the Standard Item Format. The Minimum and Maximum Stack values indicate minimum and maximum number of the item that can appear in a bag when whitelisted, limited by the item's own restriction on maximum stack size. In the held item dump these values are 1 and the max stack size respectively. The Weight is a representation of how common the item is in the loot table relative to the other items with higher values being more common. In the held item dump, this defaults to 20. The NBT Data Byte Array is a series of Bytes separated by vertical bars ( | ) and it only appears for whitelisted items and if the entry has NBT data. Do not attempt to generate this array through any method besides the lootbags_dumphelditem or lootbags_dumpinventory commands. The stack values, weight, and NBT data array are only used in whitelisted items.
Standard Bag - A bag that uses the General Lootbag Table. In the default config set these are the Common, Uncommon, Rare, Epic, Legendary, Artifact, and Old Blue bags.
These tutorials are written with Lootbags 1.10.2-2.3.5 in mind. The general idea will work for versions past Lootbags 2.0, but /lootbags_dumphelditem doesn't exist so an alternate method will be needed to obtain the item info. In 1.7.10, NEI has a dump items feature that can be used to get the mod ID and item name, then lootbags_pullNBT can be used to get the NBT data if it exists for the item.
<text> is used in several places to indicate replaced text, the <> symbols are included in the replacement.
- Load up the game with at least Lootbags and the mods with the items you want blacklisted installed. In this example we will use iron ingots.
- Hold the blacklisted item (1) in your hand and in the game chat type
/lootbags_dumphelditemand press enter. If everything works correctly, you will get a chat message indicating as such. The dump file is located in the **/dumps folder, where ** is the directory where the Minecraft instance is located. (The mods folder in this case would be **/mods) Opening the LootBagsHeldItemDump.txt file should show a single line in the Standard Item Format. In our example the file readsminecraft:iron_ingot:0:1:64:20. - Open up lootbags.cfg in the **/config folder and locate the
blacklisted itemsmajor section, which contains theS:"Global Blacklist"sub-list. On a new line inside the carrot braces ( < > ) copy and paste the Mod ID, Item Name, and Metadata from the held item dump file. In our example we're addingminecraft:iron_ingot:0. Repeat steps 2 and 3 for each item you wish to blacklist. - Save and close lootbags.cfg and open Minecraft. Checking JEI should reveal that none of the standard bags contain the blacklisted items anymore. In our case we find that the bags don't contain iron ingots anymore.
- Load up the game with at least Lootbags and the mods with the items you want whitelisted installed. In this example we will use cactus.
- Hold the blacklisted item (1) in your hand and in the game chat type
/lootbags_dumphelditemand press enter. If everything works correctly, you will get a chat message indicating as such. The dump file is located in the **/dumps folder, where ** is the directory where the Minecraft instance is located. (The mods folder in this case would be **/mods) Opening the LootBagsHeldItemDump.txt file should show a single line in the Standard Item Format. In our example the file readsminecraft:cactus:0:1:64:20. - Open up lootbags.cfg in the **/config folder and locate the
whitelisted itemsmajor section, which contains theS:"Global Whitelist"sub-list. On a new line inside the carrot braces ( < > ) copy and paste the entire line from the held item dump file. Change the minimum and maximum stack sizes and weight to suit your needs. In our example we're addingminecraft:cactus:0:4:16:5. Repeat steps 2 and 3 for each item you wish to blacklist. - Save and close lootbags.cfg and open Minecraft. Checking JEI should reveal that some or all of the standard bags contain the whitelisted items. In our case, the Common, Uncommon, Rare, Epic, and Legendary bags will contain cactus.
- Load up the game with at least Lootbags and the mods with the items you want blacklisted installed. In this example we will blacklist iron ingots from Uncommon bags.
- Hold the blacklisted item (1) in your hand and in the game chat type
/lootbags_dumphelditemand press enter. If everything works correctly, you will get a chat message indicating as such. The dump file is located in the **/dumps folder, where ** is the directory where the Minecraft instance is located. (The mods folder in this case would be **/mods) Opening the LootBagsHeldItemDump.txt file should show a single line in the Standard Item Format. In our example the file readsminecraft:iron_ingot:0:1:64:20. - Open up Lootbags_BagConfig.cfg in the **/config folder and locate the $STARTBAG command for the bag you are modifying. There may already be a $STARTBLACKLIST and $ENDBLACKLIST command pair with entries already in it. If not, add these commands somewhere between the $STARTBAG and $ENDBAG commands. On a new line inside the blacklist command pair, copy and paste the Mod ID, Item Name, and Metadata from the held item dump file. In our example we're adding
minecraft:iron_ingot:0. Repeat steps 2 and 3 for each item you wish to blacklist for each bag you are blacklisting them in. - Save and close Lootbags_BagConfig.cfg and open Minecraft. Checking JEI should reveal that none of the modified bags contain the blacklisted items anymore. In our case we find that the Uncommon bag doesn't contain iron ingots anymore.
- Load up the game with at least Lootbags and the mods with the items you want whitelisted installed. In this example we will add cactus to Common bags.
- Hold the blacklisted item (1) in your hand and in the game chat type
/lootbags_dumphelditemand press enter. If everything works correctly, you will get a chat message indicating as such. The dump file is located in the **/dumps folder, where ** is the directory where the Minecraft instance is located. (The mods folder in this case would be **/mods) Opening the LootBagsHeldItemDump.txt file should show a single line in the Standard Item Format. In our example the file readsminecraft:cactus:0:1:64:20. - Open up Lootbags_BagConfig.cfg in the **/config folder and locate the $STARTBAG command for the bag you are modifying. There may already be a $STARTWHITELIST and $ENDWHITELIST command pair with entries already in it. If not, add these commands somewhere between the $STARTBAG and $ENDBAG commands. On a new line inside the whitelist command pair, copy and paste the entire line from the held item dump file. Change the minimum and maximum stack sizes and weight to suit your needs. In our example we're adding
minecraft:cactus:0:4:16:5. Repeat steps 2 and 3 for each item you wish to blacklist for each bag you are adding the items to. - Save and close Lootbags_BagConfig.cfg and open Minecraft. Checking JEI should reveal that the desired bags contain the whitelisted items. In our case, the Common bag will contain cactus.
- Obtain the Standard Item Formats for all items you want to whitelist or blacklist as done in the previous tutorials. Copy each of these formats to a separate document. Open up Lootbags_BagConfig.cfg and navigate to the end of the file. It will be helpful to also open the Lootbags Bag Config Documentation as reference.
- Add the commands $STARTBAG and $ENDBAG, picking the desired unlocalized bag name and an unused bag ID. All further commands will be entered between these two commands in any order.
- Add the $ISSECRET command, using true to hide the bag from JEI
- If you are not using a custom texture, add the $BAGCOLOR command with the colors of choice.
- Add the $BAGTEXTCOLOR, BAGTEXTUNOPENED, $BAGTEXTOPENED, and $BAGTEXTSHIFT commands with the desired text and colors.
- Add the $CRAFTEDFROM command. Use the unlocalized name of the bag you're crafting from, or $NULL if there will be no source bag.
- Add the $PASSIVESPAWNWEIGHT, $PLAYERSPAWNWEIGHT, $MOBSPAWNWEIGHT, and $BOSSSPAWNWEIGHT commands and their values.
- Add $USEGENERALLOOTSOURCES, if you're going to use the general table, set it to true, otherwise false. If true, add $MAXIMUMGENERALLOOTWEIGHT and $MINIMUMGENERALLOOTWEIGHT.
- Add $MAXIMUMITEMS, $MINIMUMITEMS, and $EXCLUDEENTITIES. This is the end of the required commands. Steps 10-12 only apply to certain use cases and can be skipped.
- If you are whitelisting items, add the commands $STARTWHITELIST and $ENDWHITELIST. Within the commands, paste in all the whitelisted items you obtained in step 1, each one on its own line. This is the same process as in Tutorial 4.
- If you are blacklisting items, add the commands $STARTBLACKLIST and $ENDBLACKLIST. Within the commands, pase in all the blacklisted items you obtained in step 2, each one on its own line. This is the same process as in Tutorial 3. If you are not using the general table, this is not necessary.
- If you are blacklisting or whitelisting entities (through $EXCLUDEENTITIES above), add the commands $STARTENTITYLIST and $ENDENTITYLIST. Within the commands, add in the sub-command $VISIBLENAME or $INTERNALNAME depending on the entity reference you want. The config documentation details this more.
- Saving Lootbags_Bag_Config.cfg and loading Minecraft should show your new bag in all its unlocalized (and if you are using a custom texture, untextured) glory. We will need to add a localized name (and texture) through the use of resource packs. Tutorial 6 details this process.
-
Open a folder somewhere (this is just temporary working space, so where doesn't matter) and create a series of nested new folders named
<Desired Pack Name>\assets\lootbags\lang. The desired pack name can be anything, just something you can remember is for Lootbags, so we'll call it Lootbags Pack here. If you are using a custom texture, you will also need to make<Desired Pack Name>\assets\lootbags\textures\itemsand<Desired Pack Name>\assets\lootbags\models\item. -
Within the lang folder, create a new filed called en_US.lang. Make sure you have file extensions enabled in your operating system and that the file is not en_US.lang.txt. Open the file you just made and for each custom bag, add a line of the format
name.lootbags_<bag's unlocalized name as listed in Lootbags_Bag_Config.cfg>.name=<the desired localized name>. For example, the line for a common bag isname.lootbags_lootbagCommon.name=Common Lootbag`. Repeat this process for each new bag, with each entry on a new line. Save en_US.lang and close it. -
If you are using a custom texture, you will need to add the new texture and model. Create the texture for your custom bag in the image editing software of choice. Save the image as
<bag unlocalized name>ItemTexture.png. Place this image in the textures\items folder made above. In the models\item folder, create a file named<bag unlocalized name>.json. Within the file, copy the following into it:
{
"parent": "item/generated",
"textures": {
"layer0": "lootbags:items/<bag unlocalized name>ItemTexture"
}
}
Repeat this step for each new bag, creating a new texture and model .json file for each bag. -
We need one more thing to make this work, which is a pack.mcmeta file to tell Minecraft that this is a resource pack. Navigate to the folder and create a file named pack.mcmeta. Open the pack.mcmeta file and copy the following into it:
{
"pack":{
"pack_format":2,
"description":"Your Description Here"
}
} -
This is now a resource pack that contains a .lang file and possibly a model and texture for a new bag. Create a .zip file named and copy the contents of your folder into it. Copy and paste your zipped resource pack to the resource pack folder in your Minecraft instance. Loading up Minecraft, you should see the resource pack in Options > Resource Packs. Enabling the pack and going in-game will give the custom bag its proper localized name and texture.
(1) Some items, such as enchanted books, change item type when they're spawned. You will want to use the initial type (shown in the JEI pane or through the /lootbags_itemdump command) instead of the item that shows up in the bag.