Datapack Basics
A guide to setting up your workspace for Cold Sweat's data system and some important data structures
Cold Sweat has several data systems in place that allow developers or modpack creators more granular control over the mod's config settings. These systems provide advanced functionality that is not accessible through the traditional TOML files.
Workspace Setup
Data files for Cold Sweat are stored in data/<yourmod>/cold_sweat/*
where "yourmod" is the ID of your mod. If you are making a traditional datapack, this can be anything.
So far, there are 4 categories of data: item
, block
, world
, and entity
. Each of these are a dedicated folder within the datapack directory.
Data-driven JSON configs can also be put in the mod's config folder in the game directory: config/coldsweat/data/*
. These allow users to use the more advanced JSON system without having to make a datapack.
Notes for 1.16:
Mods for this version must define Cold Sweat data in /data/cold_sweat/configs/*
.
World datapacks (in the datapacks
folder in world files) are not currently supported, but users can define custom settings in the config/coldsweat/data
folder as in other versions.
Important Data Structures
Before getting into specific use cases, it should be noted how this JSON is formed. Most of the data structures used are based on existing Vanilla data structures as closely as possible. Below are the most important ideas that need to be understood to fully utilize this system:
Item Requirements
An item requirement is a set of criteria that an item must meet. They currently support checking:
Item IDs and tags
Item count (though most things don't check this)
durability
enchantments (including enchanted books)
potion type (for potion items)
nbt
These are modeled after Vanilla's item predicates, and are structured like so:
Block Requirements
A block requirement is a set of criteria that a block must meet. They currently support checking:
Block IDs and tags
NBT (if the block is a block entity)
If the block has solid faces on certain sides
If the block is within the world border
If the block is replaceable
This requirement can also be negated, meaning everything that doesn't match the given checks passes.
Example:
NBT
Multiple Accepted Values
Wherever NBT is used to ensure an entity, item, etc. has the correct NBT tag, Cold Sweat's NBT system supports defining multiple accepted values for a given NBT tag. This is done by using the custom cs:any_of
argument.
Example:
This translates to:
If HeatLevel matches either of the given values, the check will pass. This is a very useful alternative to defining multiple possible NBT structures for the same thing.
Numerical Ranges
It is also possible to define a range of accepted values if the tag being checked is a number.
Example:
Checks if an item's damage is somewhere between 50 and 100. Note that ranges are represented by a string value of two numbers separated by a hyphen ( - ). Decimal values are also accepted.
List Contents
When checking the contents of a list, the Vanilla NBT system would require that the contents of the list match the test exactly. This isn't always desired, so Cold Sweat introduces two new arguments:
cs:contains_any
Checks if the list contains any of the provided values.
Example:
cs:contains_all
Checks if the list contains all of the given values (but the list can have additional values not specified)
Example:
Last updated