Vectors - Mitchellbrine/DiseaseCraft-Remastered GitHub Wiki
There are four categories of vectors that can be utilized by the diseases the user can create: WORLD, ENTITY, ITEM, and ACTION. These categories each contain several types of vectors that can be customized and fire upon the corresponding action in game.
Types of Vectors
World Vectors
World vectors are vectors that occur when a player interacts with the world passively (or is interacted with). The following are world vectors and how to use them.
Type | Parameter Type | Description |
---|---|---|
biome_temp_and_downfall | Temperature/Downfall | Separate with ; if checking both values |
in_biome | Biome | |
inwater_biome | Biome | |
inwater_temp | Temperature | Make negative to test for < (less than) values. |
in_water | no parameters required | |
is_wet | no parameters required | |
lightning | no parameters required | |
dim_enter | Dimension | |
stat | Statistic and value (Integer) | Make value negative to calculate less than (<) and remember to separate parameters with semicolon ';' |
time_since_rest | Number of ticks (1 tick = 1/20th of a second) | A statistic vector that specifically targets time since sleeping |
time_since_death | Number of ticks (1 tick = 1/20th of a second) | A statistic vector that specifically targets time since last death, can be targeted for old age. |
Entity Vectors
Entity vectors occur when a player interacts in some way with an entity (distance, interact, etc.). The following are entity vectors:
Type | Parameter Type | Description |
---|---|---|
entity_interact | Entity | |
entity_aabb | Entity |
Item Vectors
Item vectors occur in the various life-cycle of item creation and use. Specific actions are in the Action Vectors. The following are item vectors:
Type | Parameter Type | Description |
---|---|---|
equip_change_<slot> | Item | Use slot (resource tag) for type name |
pickup_item | Item | |
craft_item | Item | |
smelt_item | Item | |
brew_item | Item | |
use_item | Item | |
destroy_item | Item | |
item_break | Item |
Action Vectors
Action vectors occur when utilizing items or being interacted with by entities (e.g. damage). The following are action vectors:
Type | Parameter Type | Description |
---|---|---|
player_awaken | no parameters required | |
damage_<damage_source> | Entity [optional, if damage_source is "mob"] | Use damage source for type |
shield_block | no parameters required | |
bonemeal_use | isHarvestable (boolean; true/false) [optional] | |
fished | Item [optional] | |
sleep | BedSleepingProblem [optional] | |
break_block | Block | |
arrow_attempt | failShotIfInfected (boolean; true/false) [optional] |
Implementing Vectors Into Your Diseases
When entering a vector in the disease JSON file for a specific disease, it should be formatted as such within the JsonArray of "vectors:"
{
"type":"", // REMEMBER to use a namespace (e.g., "diseasecraft:")
"heap:"", // The parameter (if needed for the vector, leave blank if optional and not wanted)
"weight":2 // The chance of contracting the illness every time the vector fires [stored with the base disease, not with the vector]
}
Here is an annotated example from the base mod code:
"vectors": [
{
"type":"diseasecraft:entity_aabb", // This is an entity vector, notice the use of the namespace "diseasecraft:", which is used for all base mod vectors.
"heap":"minecraft:pig", // The parameter for this vector is an entity and we are using the resource name for a pig, but this can be used for other mod animals as well.
"weight":3 // There is a 3% chance every second you stand within 2m of a pig that you will contract this disease.
},
{
"type":"diseasecraft:entity_aabb", // Note how the type is able to be the same as a previous vector for even the same disease.
"heap":"minecraft:chicken", // This is because disease vectors are compared to each other both in their type and parameters.
"weight":1 // As stated above, the weight is stored with the disease (NOT the vector), so it plays no role in comparisons.
}
]