FANDOM



This mod allows you to customize all loot lists, vanilla or otherwise, and even add your own lists. Many properties accept number ranges for values, and are randomized for each item generated.

Everything in this mod is completely configurable. This mod will do nothing if you do not edit its properties files. The properties files are generated in your .minecraft/config directory.

The properties files use a format known as JSON (JavaScript Object Notation). You can find specs and examples of JSON on the JSON website and various tutorials scattered throughout the internet. This page will assume you understand JSON enough to write a file and know what I mean when I say "object", "array", "name", and "value".


How To UseEdit

Install the mod and start Minecraft once to generate five files in your config folder:

CustomChestLoot.cfg - the general properties for the mod.

CustomChestLoot - the folder where all of your loot list files are stored. Should be full of auto-generated loot lists at this point.

CustomChestLootExternal - the folder that houses all of your external functions. This will be covered more later.

CustomChestLootInfo - the folder where loot files are generated when using /cclinfo. This won't show up until you use the command.

You probably won't need to mess with the general .cfg file. The few things inside are self-explanatory, so I won't be going over them here.

Open up your CustomChestLoot folder (.minecraft/config/CustomChestLoot). You will see that the mod has already generated a file for each registered chest type - including any added by mods that use Forge's ChestGenHooks system. You may reorganize the files into folders however you want and even may add entirely new files, which will be loaded into the game to be usable by other mods that let you specify loot lists (such as Mob/Block Properties).

You can open up JSON files with any text editor, or you can use any JSON or JavaScript program to help you write them. I recommend this online editor to write your properties files with. It's simple, effective, free, and doesn't require a download.

When you open up one of the generated loot files, you'll see it has four basic parts to it: "_name", "min", "max", and "loot". The value of "_name" is the string id of the chest type the file will apply to. Only one file may exist for any string loot id. "min" and "max" are the minimum and maximum number of times to place a loot entry from "loot" into each chest being generated. "loot" is the array which contains all of your loot entries, each one of which represents an item (or items) that can be generated in the chest; one of these is chosen at random for each item generated in the chest.

Advanced loot entries can have some or all of themselves be determined by functions. Functions can do anything from giving the item a random name, to changing the item below a certain y-value, to actually being multiple items.

Function objects are what alter the items generated by loot entries. A function object is simply an object containing the field "function" with a value equal to the string name of the function you want to use, along with any required and optional name/value pairs associated with that function.

Any function object can be used as an external function. It must be saved in its own .json file and placed in the subfolder of CustomChestLootExternal that fits its context. For example, a function that edits nbt data should go in CustomChestLootExternal/nbt.

Throughout the tables below, you will see some fields say (number range). This means that those fields accept single numbers as numbers or strings, or two string numbers separated by a tilde (~). Any of these numbers may be represented as hexidecimal by prefixing the hex number with "0x". A number range will randomly be one of the two numbers, or any number in between. If a fractional number is used where an integer is needed, one of the two nearest integers is chosen at random, weighted towards the closer one (e.g., "0.3" has a 30% chance to be 1 and a 70% chance be be 0). All random decisions are made on a per-item basis (from the above example, "0.3" will be 1 for 30% of generated items and 0 for the remaining 70% of items).

You may place a comment anywhere except in arrays. To do this, just make a string field called "_comment" and for its value, type whatever you want in quotations (e.g., "_comment":"This is a comment!"). Feel free to place multiple comments in one place -the overlapping of names will not matter because comments are ignored by the mod.

Loot EntriesEdit

Each object in the "loot" array of a loot list file is called a loot entry. A loot entry is an object with a few fields that define the item and the chance of it occurring in a chest.

Below is information about each field that can be included in a loot entry.

Quick ReferenceEdit

entry type: required_field*  optional_field  etc.
simple:     id*  damage  weight  min  max
advanced:   id  damage  weight  min  max  enchant  enchant_chance  external  functions
keep:       keep*  id  damage  nbt  count

Full TableEdit

Entry Type Description Fields (* - Required)
simple A simple loot entry using the capacity of vanilla chest loot. id*: the string id of the item to generate. Default is none (causes everything else in this function to do nothing, except other "loot" functions in the "functions" array).

damage: the damage of the item to generate. Default is 0.

weight: the weight of this item to be chosen. Default is 1.

min: the minimum stack size of the item to generate. Default is 1.

max: the maximum stack size of the item to generate. Default is the value of "min".

advanced A loot entry capable of using functions and randomized damage. id: the string id of the item to generate. Default is none (causes everything else in this function to do nothing, except other "loot" functions in the "functions" array).

damage: (number range) the damage of the item to generate. Default is 0.

min: the minimum stack size of the item to generate. Default is 1.

max: the maximum stack size of the item to generate. Default is the value of "min".

enchant: (number range) the level of enchanting to apply (as if in an enchanting table), if the item shoudl be enchanted. Default is "5~30".

enchant_chance: (number range) the chance to enchant the item with a level of "enchant". Default is 0.

external: the external item stats function to run (identical to using the "external" function). Default is none.

functions: array of item stats functions to apply to the item (see Item Stats Functions). Default is none.

keep Used to prevent the mod from removing custom mod-added loot entries that can not be automatically duplicated by this mod. These will normally be auto-generated for you. keep*: the name of the class representing the loot entry to keep.

id: the id of the item the custom entry claims to add. Default is none (doubtful "none" will ever be used).

damage: the damage of the item the custom entry claims to add. Default is 0.

nbt: (true/false) true if the entry to keep has an nbt tag, false otherwise. Default is false.

count: the number of identical loot entries to not remove. Default is 1.

Universal FunctionsEdit

These functions can be used anywhere that functions are accepted. Universal functions are generally logicals, conditionals, or loops.

Quick ReferenceEdit

function: required_field*  optional_field  etc.
all:      functions*  count
choose:   functions*  count
if_X:     functions*  count
external: file*  count
conditionals:
if_is_tile_entity_X
if_check_nbt_X

if_raining
if_thundering
if_moon_phase_X
if_beyond_X
if_difficulty_X
if_past_world_difficulty_X
if_past_day_time_X
if_past_world_time_X
if_in_dimension_X
if_in_biome_X
if_touching_block_X
if_below_X

if_in_biome_X
if_in_biome_type_X
if_biome_temp_X
if_biome_height_below_X
if_is_humid
if_rainfall_above_X
if_temp_above_X
if_biome_temp_above_X

if_player_online_X

Full TableEdit

Function Description Fields (* - Required)
all Used to perform functions multiple times or to use multiple functions where only a single function is accepted. functions*: array of function objects that will all be performed when the all function is.

count: (number range) number of times to perform the functions. Default is 1.

choose Chooses only one of several functions at random, based on the weights you have assigned them. functions*: array of function objects to be chosen from - each function in this array also has the optional field weight, which is its likeliness to be chosen, and defaults to 1 for each function.

count: (number range) number of times to choose a function to perform. Default is 1.

if_X Only performs the functions under certain circumstances, based on the name of this function. (See below for a full list.) functions*: array of function objects that will all be performed if the condition is met.

count: (number range) number of times to perform the functions. Default is 1.

external Executes the function inside the external file specified. file*: the file name of the function to execute. Do not include the file extension (.json).

count: (number range) number of times to perform the function. Default is 1.

If FunctionEdit

The if_X function is a function which performs exactly like the all, but does not do anything at all if its condition is not met. The condition is determined by the name you use for the if_X function.

Using an exclamation mark at the beginning of the function inverts its behavior, then only performing functions if its condition is NOT met.

Some conditions require additional input, such as if_in_dimension_X, where you must replace the X with your input (in this case, an integer).

Remember that these conditions are checked when the chest is generated, so time/weather-based conditionals may not be good choices in naturally generating chests, but may be very useful for chests generated by player actions (e.g., using Mob Properties to spawn a chest with a custom loot list as a mob drop).


Functions:

function:                   condition
if_is_tile_entity_X:        if the tile entity the loot is generating in has the savegame id of X
if_check_nbt_X:             if the nbt comparison is true (see below)

if_raining:                 if it is currently raining
if_thundering:              if there is currently a thunderstorm
if_can_see_sky:             if the block has a direct view of the sky
if_moon_phase_X:            if the moon is currently in phase X (X is full, waning_gibbous, third_quarter,
                                waning_crescent, new, waxing_crescent, first_quarter, or waxing_gibbous)
if_beyond_X:                if the block is farther than X blocks from the world spawn point
if_difficulty_X:            if the difficulty is set to X (X is peaceful, easy, normal, or hard)
if_past_world_difficulty_X: if the Apocalypse mod is installed, if the world difficulty is greater than X
if_past_day_time_X:         if the day time is greater than X (varies from 0 to 23999)
if_past_world_time_X:       if the total world time is greater than X
if_in_dimension_X:          if the block is in dimension X (X is an integer dimension id)
if_in_biome_X:              if the block is in biome X (X is an integer biome id)
if_touching_block_X:        if the block is adjacent to X (X is a string block id)
if_below_X:                 if the block is below layer X (X is an integer block height)

if_in_biome_X:              if the mob is in biome X (X is a biome's name exactly as shown in F3)
if_in_biome_type_X:         if the mob is in a biome similar to X (see below)
if_biome_temp_X:            if the biome temperature is in the X category (X is cold, medium, or warm)
                                temp ranges: (-0.5)- cold -(0.1)- invalid/cold -(0.2)- medium -(1.0)- hot -(2.0)
if_biome_height_below_X:    if the biome's base height is below X blocks (see below for standard heights)
if_is_humid:                if the biome is considered humid (normally rainfall > 0.85)
if_rainfall_above_X:        if the biome's rainfall is greater than X
if_temp_above_X:            if the temperature at the entity's location is above X (same as biome temp below 65 blocks,
                                above 65 blocks decreses by a random amount, then -0.001667 for each block above 64)
if_biome_temp_above_X:      if the biome's standard sea-level temperature is greater than X (water freezes below 0.2)

if_player_online_X:         if the player with username X is in the world

if_check_nbt_X:

For checking nbt tag values, X is the path of the tag, followed by ==, >, <, >=, or <=, and then by the value to compare to. String tags can only be compared using ==. For example, you want to check if the integer value called "Value", which is contained inside the "ForgeData" compound, is greater than or equal to 1 - you would use "if_check_nbt_ForgeData/Value>=1". Values and compounds in lists are represented by their index in that list (the first index is 0, then 1, and so on). For an example using a list, we can check if the harvester is below the y-level 16 by using "if_check_harvester_nbt_Pos/1<16" (in the "Pos" list, index 0 is the x position, index 1 is the y, and index 2 is the z) (Note: harvester function not supported in Custom Chest Loot).

if_in_biome_type_X:

The vanilla biome types are beach, desert, end, forest, hell, hills, jungle, mesa, mushroom, ocean, plains, river, savanna, snow, stone_beach, swamp, and taiga. Hills refers specifically to extreme hills, and hell is the Nether's biome. The type can also be the normal name of any biome in a type - this allows you to still use mod-added biomes and consider them as "types".

if_biome_height_below_X:

Sea level is at 64 blocks in default world generation. In addition to using normal y-values, you can also compare the biome height with the generic heights used by vanilla (e.g., "if_biome_height_below_default").

(y)   name

(6)   deep_oceans
(32)  oceans
(48)  shallow_waters
(57)  partly_submerged

(64)  shores
(67)  rocky_waters
(67)  default
(68)  low_plains
(70)  mid_plains
(70)  low_islands
(78)  low_hills
(96)  mid_hills
(112) high_plateaus


Item Stats FunctionsEdit

These functions can be used in any array with the name "item_stats". Item stats functions alter item stacks by editing their nbt tag.

Quick ReferenceEdit

function: required_field*  optional_field  etc.
loot:     id  damage  min  max  enchant  enchant_chance  external  functions
name:     value*
modifier: attribute*  value*  operator
potion:   id*  amplifier  duration  ambient
nbt:      tags*
enchant:  id  level
lore:     value*
color:    value

Full TableEdit

Function Description Fields (* - Required)
loot Adds an additional loot entry to generate along with the normally generated entry (added before the main loot, so can be overwritten by the loot itself generating). id: the string id of the item to generate. Default is none (causes everything else in this function to do nothing, except other "loot" functions in the "functions" array).

damage: (number range) the damage of the item to generate. Default is 0.

min: the minimum stack size of the item to generate. Default is 1.

max: the maximum stack size of the item to generate. Default is the value of "min".

enchant: (number range) the level of enchanting to apply (as if in an enchanting table), if the item should be enchanted. Default is "5~30".

enchant_chance: (number range) the chance to enchant the item with a level of "enchant". Default is 0.

external: the external item stats function to run (identical to using the "external" function). Default is none.

functions: array of item stats functions to apply to the item. Default is none.

name Applies a custom name to the item. value*: the name to apply to the item. Accepts item name codes for randomization.
modifier Applies an attribute modifier to the item, which only applies when equipped or held. Applying a modifier will overwrite innate modifiers, such as weapon damage. (See here for more info.) attribute*: the string id of the attribute to modify.

value*: (number range) the amount to modify by.

operator: (0/1/2) the operation to apply the value with. Default is 0.

potion Applies a custom potion effect to the item. In vanilla, this only affects potion items. id*: the string id of the potion to apply (localization, usually potion.potionName).

amplifier: (number range) the level of the potion to apply. Default is 0 (level I).

duration: (number range) the duration of the potion to apply, in ticks (20 ticks = 1 second). Default is 2147483647.

ambient: (true/false) true if the potion effect should be less noticable. Default is false.

nbt Writes NBT data to the item's tag compound. tags*: array of NBT functions to write to the item's tag compound (see NBT Functions). Default is none.
enchant Applies a specific enchantment to the item or randomly enchants it (like an enchantment table) if none is specified. id: the string id of the enchantment to apply (localization, usually enchantment.enchantmentName). If -1, enchants the same as an enchanting table with the given level. Default is -1.

level: (number range) the level of the enchant to apply. Default is 1.

lore Adds a line of lore (info text) to the item. Defaults to purple italic text, but formatting codes are allowed. value*: the line of text to add.
color Dyes the item. Defaults to a random color. In vanilla, only leather armor gets any effect from this. value: (number range) the color to dye the item. Default is "0x000000~0xffffff".

Item Name CodesEdit

Include these anywhere in the value field of the name function to be replaced by randomized text.

  • ~c - Complete. Generates an entire name. If capitalized, it will base the name on one of the item's enchantments or modifiers (eventually - this is a WIP).
  • ~i - Info. Generates a name describing what the item is. Randomizes the name of the material and tool if they are not added by a mod.
  • ~p - Prefix. Generates an item prefix. If capitalized, it will base the name on one of the item's enchantments or modifiers (at least, it will - this is a WIP).
  • ~s - Postfix. Generates an item postfix. If capitalized, it will base the name on one of the item's enchantments or modifiers (at least, it will - this is a WIP).
  • ~d - Descriptor. Generates a describing word. Generally, you will want to precede this code with "NAME the ".
  • ~m - Mash. Generates a random name from the mash word generator. (Just jumbles up syllables.)
  • ~n - Normal. Generates a normal name from the list of pre-defined names.


NBT FunctionsEdit

These functions can be used in any array with the name "tags". NBT functions represent NBT tags saved as an entity or item stack's tag compound. Using these, you can do just about anything. Make sure you know what you are doing when using these. Using the wrong data type or trying to put multiple data types in a tag list will crash your game and may even corrupt your world. For info on vanilla entities, see here. For items, see here.

Use /bpreload to give yourself a stick that can convert nbt data of in-game entities and tile entities to an nbt function!

Quick ReferenceEdit

function:   required_field*  optional_field  etc.
compound:   name  tags
list:       name  tags
<type>:     name  value
delete:     name
chest_loot: name  loot  inventory_size  count
item_id:    name  value*
potion_id:  name  value*
enchant_id: name  value*
types:
string  boolean  byte  byte_array  short
int  int_array  long  float  double

Full TableEdit

Function Description Fields (* - Required)
compound Represents a tag compound, which can contain any number of named tags.

name: the string name of the NBT tag. Leave this out only in tag lists. Default is "".

tags: array of tags (NBT functions) contained in this compound. Default is none.

list Represents a tag list, which can contain any number of unnamed tags. This will preserve the order you apply the tags in. name: the string name of the NBT tag. Leave this out only in tag lists (though I really doubt you will need to make a list of lists). Default is "".

tags: array of tags (NBT functions) contained in this list. NBT functions in here do not use the name field. Default is none.

<type> Represents an NBT value with type of <type>. See the quick reference above for a full list of types. name: the string name of the NBT tag. Leave this out only in tag lists. Default is "".

value: (number range where applicable) the value of the tag. The type you enter here must agree with the tag's type. Default is "", [], 0, or false, depending on type.

delete Completely deletes an NBT tag and all data contained in it. name: the string name of the NBT tag to delete. Leave this out only in tag lists (deletes the last tag in the list). Default is "".
chest_loot Convenience function to generate a tag list containing random items in an inventory format. name: the string name of the NBT tag. You will not have to specify this for any vanilla tile entity. Default is "Items".

loot: the ChestGenHooks code for the loot list to generate from. Default is "dungeonChest".

inventory_size: so you may fill different size containers or partly fill them. Default is 27 (the chest's inventory size).

count: (number range) overrides the chest loot's usual number of items to generate. Default is the loot list's count range.

item_id Saves an item's numerical id as a short using its string id. You MUST use this to use mod item ids in nbt with any amount of reliability. name: the string name of the NBT tag. You will not have to specify this for any vanilla item. Default is "id".

value*: the string id of the item.

potion_id Convenience method to save a potion's numerical id as a byte using its string id (localization). name: the string name of the NBT tag. You will not have to specify this for any vanilla potion effect. Default is "Id".

value*: the string id of the potion (localization, usually potion.potionName).

enchant_id Convenience method to save an enchantment's numerical id as a short using its string id (localization). name: the string name of the NBT tag. You will not have to specify this for any vanilla enchantment list. Default is "id".

value*: the string id of the enchantment (localization, usually enchantment.enchantmentName).

ExamplesEdit

There's no way I could expect you to memorize all of the functions. If I were you, I would go to the quick reference section of each function section and copy/paste them all into a text document so you don't need to come back here and look through them. (Make sure you update it as new versions are released - the changelog will definitely tell you if any functions are added or implemented in an update!)

To be continued...

AppendixEdit

Below are useful resources and information from other places compiled into one handy location. Yay!

  • Recommended JSON editor [1]
  • Vanilla item/block ids, item damage values, and block metadata [2]
  • Vanilla attributes [3]
  • Vanilla entity NBT format [4]
  • Vanilla item NBT format [5]
  • Text formatting codes (use "\u00a7" for "§") [6]

Added CommandsEdit

/cclreload - reloads all chest loot files
/ccltest <lootList> - reloads files and generates a chest at your feet with the specified loot list
/cclinfo - generates a json file for the item in your hand, ready to be added to a "loot" array

Vanilla Tile Entity IdsEdit

Furnace            Furnace
(Trapped) Chest    Chest
Ender Chest        EnderChest
Jukebox            RecordPlayer
Dispenser          Trap
Dropper            Dropper
Sign               Sign
Monster Spawner    MobSpawner
Note Block         Music
Piston             Piston
Brewing Stand      Cauldron
Enchantment Table  EnchantTable
End Portal Frame   Airportal
Command Block      Control
Beacon             Beacon
Mob Head           Skull
Daylight Detector  DLDetector
Hopper             Hopper
Comparator         Comparator
Flower Pot         FlowerPot

Vanilla Potion IdsEdit

Speed              potion.moveSpeed
Slowness           potion.moveSlowdown
Haste              potion.digSpeed
Mining Fatigue     potion.digSlowDown
Strength           potion.damageBoost
Weakness           potion.weakness
Instant Health     potion.heal
Instant Damage     potion.harm
Jump Boost         potion.jump
Nausea             potion.confusion
Regeneration       potion.regeneration
Resistance         potion.resistance
Fire Resistance    potion.fireResistance
Water Breathing    potion.waterBreathing
Invisibility       potion.invisibility
Blindness          potion.blindness
Night Vision       potion.nightVision
Hunger             potion.hunger
Poison             potion.poison
Wither             potion.wither
Health Boost       potion.healthBoost
Absorption         potion.absorption
Saturation         potion.saturation

Vanilla Enchantment IdsEdit

Sharpness              enchantment.damage.all
Smite                  enchantment.damage.undead
Bane of Arthropods     enchantment.damage.arthropods
Knockback              enchantment.knockback
Fire Aspect            enchantment.fire
Protection             enchantment.protect.all
Fire Protection        enchantment.protect.fire
Feather Falling        enchantment.protect.fall
Blast Protection       enchantment.protect.explosion
Projectile Protection  enchantment.protect.projectile
Respiration            enchantment.oxygen
Aqua Affinity          enchantment.waterWorker
Efficiency             enchantment.digging
Silk Touch             enchantment.untouching
Unbreaking             enchantment.durability
Looting                enchantment.lootBonus
Fortune                enchantment.lootBonusDigger
Luck of the Sea        enchantment.lootBonusFishing
Lure                   enchantment.fishingSpeed
Power                  enchantment.arrowDamage
Flame                  enchantment.arrowFire
Punch                  enchantment.arrowKnockback
Infinity               enchantment.arrowInfinite
Thorns                 enchantment.thorns

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.