This mod is inspired by LuckyCases but it has less security problems* and it's much more configurable.
Configuration
General mod configuration is located at /config/cases.cfg
Custom case configs are in the /config/cases/ directory.
Custom kit configs are in /config/kits/
Example case config (put it in /config/cases/pickaxes.json):
{
"displayName": {"en_us": "Case with pickaxes and wool",
"ru_ru": "Кейс с кирками и шерстью"
},
"contents": [
{
"action": "collect",
"type": "pickaxe",
"filter": {
"mod": "minecraft"
}
},
{"action": "extended", "type": "minecraft:wool", "rarity": 1},
{"action": "exclude", "type": "wool", "meta": 0}
],
"color": "#555555"
}
Note: Json file name (your_case.json) is an internal name of your case that's being used for id registration. It should only contain latin letters, numbers, dots and underscores.
Detailed explanation of the config above:
- The "displayName" property is the display name of your case (OMG CAPTAIN OBVIOUS).
It coud be either a string or a json object:
"Pickaxe case" <-- default value for every language
OR
{
"en_us": "Pickaxe case", <-- default value for every language except those listed below
"ru_ru": "Кейс с кирками"
}
- The "color" property defines item overlay color
- The "contents" property is the most hardest part here. It consists of a multiple json objects where each one represents a so-called 'action' that can add/remove single/multiple items within a case. There are six different actions:
- "single" - adds a single item. It has several extra properties such as:
- "type" - contains item id (e.g. minecraft:apple),
- "meta" - an item's metadata (for items like colored wool where meta defines wool color or planks where meta defines tree type. Defaults to '0'),
- "amount" (Could be either a single number or a range [for random item amount. e.g. '1-10' will drop from one to ten items. But for damaged items: '0-1' indicates that item can have a random damage value. Where 0 means that item is completely broken and 1 means that item is untouched. ] Defaults to '1'),
- "nbt" - an item's extra data (so-called 'Named Binary Tag' which is moustly used for items that store energy or mana, etc.)
- "enchant" - a chance for a tool to have a random enchantment (minimal (and default) value: 0, maximal: 1)
- "rarity"- an integer value from 0 to 4 that says how rare the item is.
- "extended" - works the same way as "single" but has no "meta" property because it adds all the item's variants to the case at once.
- "oredict" - this one is similar to "extended" but it finds item by their 'oredict name' instead of item id. It also has several builtin values such as 'ingots' for every ingot, 'gems' for every gem, 'ores' for every ore and 'ingotBlocks' for every ingot block. (e.g. "type": "ingots"). Values can be filtered using "filter" property. E.g. "mod" filter.
It could be either a JsonArray or a single string:
"filter": {
"mod": "minecraft" <-- Only vanilla items will be added
}
OR
"filter": {
"mod": [ <-- Only vanilla, IC2 and Thaumcraft items will be added
"minecraft",
"ic2",
"thaumcraft"
]
} - "collect" - this one is similar to "extended" and "oredict" but can only add equipment, foodstuffs and enchantment books. Possible values are: 'hoe', 'pickaxe', 'sword', 'shovel', 'axe', 'boots' (boot), 'leggings' (legs), 'chestplate' (chest), 'helmet' (helm), 'food', 'enchantBooks'. Items can be filtered like in the previous action and they are unenchanted and undamaged by default, but you can add theese properties to change that: "condition" (similar to "amount" which's value is in range from 0 to 1) and the "enchant" (unlike the "single"'s "enchant" property this one is jus a multiplier for a pre-calculated values. E.g. when set to 1 it doesn't mean that all the items will be enchanted but instead they will be allowed to be enchanted with ther pre-calculated enchantment chances. E.g. for wooden pick enchantment chance is 0.5 and for the iron pick is 0.4 and so on. And if you set the value to 0.5 the iron pickaxe will have 0.5 * 0.4 = 0.2 enchantment chance . The default value here is 0 which means that enchantments are disabled).
- "extract" - extract contents from another case. ("case": "your_case_name_here"). This one is useful when you want to create a case that contains all the tools and armors, etc.
- "exclude" - this one is opposite to "single" because it removes specified item from the list.
- "single" - adds a single item. It has several extra properties such as:
Pre-calculated enchantment chances:
Common items: 0.5 (50%)
Uncommon items: 0.4 (40%)
Rare items: 0.3 (30%)
Very rare items: 0.2 (20%)
Ultra rare items: 0.1 (10%)
Note: Your case configurations will be synchronized among the network so you only need to put them on your server and your players will automatically get'em during connection.
Commands
The mod has a set of a useful commands that will help you with case creation.
- /cases reload - reload case configuration on the fly (no restart needed)
- /cases nbt - print JSON'ifyed NBT of the held item (It can be really large [hi, Forestry!] so you will need to look into your latest.log)
- /cases new kit|case <name> - creates new case/kit and adds all the items to the config from an inventory you're looking at.
Porting 'n' stuff
Don't ask me to update this mod to version X.Y.Z. I'll do it myself when I have enough free time!