Project home for New Alterlite - A new locaria community pack focused on a different approach of minecrafting.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
NewAlterlite/config/triumph/documentation/script/ScriptAdvancement.txt

379 lines
13 KiB

These are the functions which can be called directly in a script advancement file.
addCriteria:
Arguments:
String, String
Usage:
criteria name, criteria trigger type
Notes:
Adds a criteria to the advancement with the specified type. Returns the criteria object for use as a variable.
pageRequiresRoot:
Notes:
Convenience method to add a 'triumph:completed_advancement' criteria for this root to every advancement on the page. Can only be used in a root advancement.
addRewardRecipe:
Arguments:
String
Usage:
recipe name
Notes:
Adds a recipe as a reward for completing the advancement. You can get the name of the recipe you want to grant from NEI or JEI.
addRequirements:
Arguments:
String array
Usage:
array of criteria requirements
Notes:
This is the manual way of adding requirements. The array of criteria requirements will be added as a requirement array. This is done in basically the same way as vanilla Json advancements, where an array of requirements is a group of criteria that, if all are completed, the advancement is completed. Multiple arrays can be added by calling this function multiple times.
addRewardItem:
Arguments:
ItemBlockData
Usage:
item data
Notes:
Adds the item as a reward for completing this advancement.
setRequirements:
Arguments:
String, String array
Usage:
Requirements type, criteria exception array
Notes:
This is a helper method designed to make setting criteria requirements easier. If set to "all" this will make all criteria required for completion. If set to "any" this will make any criteria complete the advancement. If set to "any" the array of criteria exceptions is used to configure the requirements where all exceptions are required plus any other single criteria.
setRequirements:
Arguments:
String
Usage:
Requirements type. This type can be either "any" or "all"
Notes:
This is a helper method designed to make setting criteria requirements easier. If set to "all" this will make all criteria required for completion. If set to "any" this will make any criteria complete the advancement.
pageVisibleIf:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Only usable in root advancements. Makes the page visible if the provided advancement/gamestage is complete. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
visibleIf:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Makes the advancement visible if the provided advancement/gamestage is complete. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
hiddenIf:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Makes the advancement hidden if the provided advancement/gamestage is complete. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
setRepeatTime:
Arguments:
long
Usage:
number of seconds before the advancement can be repeated
Notes:
Sets the number of seconds real time between advancement completion and when it will be completable again.
setShowToast:
Arguments:
boolean
Usage:
if the toast should be shown
Notes:
Sets if a toast should be shown to the player when the advancement is completed.
hiddenUnless:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Makes the advancement hidden if the provided advancement/gamestage is not completed. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
setFrameType:
Arguments:
boolean
Usage:
frame type
Notes:
Sets the frame type for the advancement. Options are "TASK", "CHALLENGE", "GOAL". Default is TASK.
alwaysVisible:
Notes:
Makes the advancement always visible. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
pageAlwaysHidden:
Notes:
Only usable in root advancements. Makes the page always hidden. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
visibleUnless:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Makes the advancement visible if the provided advancement/gamestage is not completed. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
pageHiddenUnless:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Only usable in root advancements. Makes the page hidden if the provided advancement/gamestage is not completed. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
alwaysHidden:
Notes:
Makes the advancement always hidden. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
pageHiddenIf:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Only usable in root advancements. Makes the page hidden if the provided advancement/gamestage is complete. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
hideLines:
Notes:
Sets the advancement to hide connection lines to parents.
drawDirectLines:
Notes:
Sets the advancement to draw direct lines to parents.
setHidden:
Arguments:
boolean
Usage:
if the advancement should be hidden
Notes:
Sets if the advancement should be hidden until it is completed. Not compatible with other visibility options.
setPos:
Arguments:
int, int
Usage:
x pos, y pos
Notes:
Sets the x and y coordinates of the advancement.
setTitle:
Arguments:
String
Usage:
title
Notes:
Sets the title for the advancement. This or setTranslatedTitle is required.
setIcon:
Arguments:
ItemBlockData
Usage:
item data
Notes:
Sets the item icon for the advancement. This is required.
addParent:
Arguments:
String
Notes:
Adds a parent for the advancement. This only effects its position on the advancement page and connection lines. By default parents are not required for the advancement to be completed. At least one parent is required for non-root advancements. If the string ends with a / it will be treated as a folder, and all advancements within that folder will be added as parents.
setBackground:
Arguments:
boolean
Usage:
background resource location
Notes:
Sets the background for the advancement page. This is required and only used by root advancements. Be aware the background is tiled.
setDescription:
Arguments:
String
Usage:
description
Notes:
Sets the description for the advancement. This or setTranslatedDescription is required.
addRewardLootTable:
Arguments:
String
Usage:
loottable resource location
Notes:
Adds a loot table reward.
setAnnounceToChat:
Arguments:
boolean
Usage:
if advancement completion should be announced in chat
Notes:
Sets if the advancement completion should be announced in chat.
setCompletedIconColor:
Arguments:
int
Usage:
color
Notes:
Sets the completed icon color for the advancement.
setCompletedIconColor:
Arguments:
int, int, int
Usage:
red, green, blue
Notes:
Sets the completed icon color for the advancement.
setUncompletedLineColor:
Arguments:
int, int, int
Usage:
red, green, blue
Notes:
Sets the uncompleted line color for the advancement.
setUncompletedLineColor:
Arguments:
int
Usage:
color int
Notes:
Sets the uncompleted line color for the advancement.
addRewardFunction:
Arguments:
String
Usage:
function name
Notes:
Adds the function with the provided name as a reward for completing the advancement.
setTranslatedDescription:
Arguments:
String
Usage:
description translation path
Notes:
Sets the description for the advancement. Used for localization. This or setDescription is required.
setCompletedLineColor:
Arguments:
int, int, int
Usage:
red, green, blue
Notes:
Sets the completed line color for the advancement.
setCompletedLineColor:
Arguments:
int
Usage:
color int
Notes:
Sets the completed line color for the advancement.
pageAlwaysVisible:
Notes:
Only usable in root advancements. Makes the page always visible. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
setUncompletedTitleColor:
Arguments:
int, int, int
Usage:
red, green, blue
Notes:
Sets the uncompleted title color for the advancement.
setUncompletedTitleColor:
Arguments:
int
Usage:
color int
Notes:
Sets the uncompleted title color for the advancement.
addRewardSkillable:
Arguments:
String, int
Usage:
skill, levels
Notes:
Adds a Skillable skill level up reward.
setCompletedTitleColor:
Arguments:
int
Usage:
color
Notes:
Sets the completed title color for the advancement.
setCompletedTitleColor:
Arguments:
int, int, int
Usage:
red, green, blue
Notes:
Sets the completed title color for the advancement.
setUncompletedIconColor:
Arguments:
int
Usage:
color int
Notes:
Sets the uncompleted icon color for the advancement.
setUncompletedIconColor:
Arguments:
int, int, int
Usage:
red, green, blue
Notes:
Sets the uncompleted icon color for the advancement.
setTranslatedTitle:
Arguments:
String
Usage:
title translation path
Notes:
Sets the translated title for the advancement. Used for localization. This or setTitle is required.
setRequiresParents:
Notes:
This is a helper method which adds criteria either named 'completedParent'/'completedParent2'/etc or if the 'useNewParentCompletionCriteriaNames' option is set in the main config named the same as their title or resource location (Example: "Completed Some Advancement Title") with type "triumph:completed_advancement", and makes them a requirement. This effectively makes the advancement require its parents to be completed before it can be completed.
pageVisibleUnless:
Arguments:
String
Usage:
Advancement resource location or gamestage name
Notes:
Only usable in root advancements. Makes the page visible if the provided advancement/gamestage is not completed. All visibility options (alwaysVisible, alwaysHidden, visibleIf, hiddenIf, visibleUnless and hiddenUnless) are run in order of addition to the script. The first one in the list to be completed is the one which enforces its visibility option.
setRewardExperience:
Arguments:
int
Usage:
experience
Notes:
Sets the experience amount for the reward for completing the advancement. This is in xp, not in levels.