Импорт класса

Link to импорт-класса

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import mods.pmmo.CTUtils;

Name: registerPerk

Registers a perk for use in pmmo-Perks.toml.

ZenScript
Copy
CTUtils.registerPerk(perkID as ResourceLocation, defaults as MapData, customConditions as CTPerkPredicate, onExecute as CTPerkFunction, onConclude as CTPerkFunction, side as int)
ПараметрТипОписание
Параметр
perkID
Тип
ResourceLocation
Описание
the Perk ID
Параметр
defaults
Тип
MapData
Описание
the default settings for your perk. These
are provided to your execution if no manual user configuration
is present. This allows you to ignore null checks and
displays to users what settings are valid for your perk.
(NOTE: you are not required to add settings here for them
to work. It is permitted to have "hidden" settings.)
Параметр
customConditions
Тип
CTPerkPredicate
Описание
used to check for conditions in which
a perk is allowed to execute in addition to pmmo's default
checks. For example, if the player is the correct dimension.
Параметр
onExecute
Тип
CTPerkFunction
Описание
the logic executed by this perk
Параметр
onConclude
Тип
CTPerkFunction
Описание
if an event has an end state, this executes
Параметр
side
Тип
int
Описание
which logical side this fires on CLIENT=0, SERVER=1, BOTH=2

Name: setBonus

registers a configuration setting for bonuses to xp gains.

ZenScript
Copy
// CTUtils.setBonus(objectType as invalid, objectID as ResourceLocation, type as invalid, bonus as double?[string])

CTUtils.setBonus(<constant:pmmo:objecttype:value>, <resource:namespace:path>, <constant:pmmo:modifierdatatype:value>, {skillname: 0.0 as double?, otherskillname: 0.0 as double?});
ПараметрТипОписание
Параметр
objectType
Тип
invalid
Описание
a value of [item, block, entity, dimension, or biome]
Параметр
objectID
Тип
ResourceLocation
Описание
the object linked to the bonus
Параметр
type
Тип
invalid
Описание
the relation to the object which predicates the bonus
Параметр
bonus
Тип
double?[string]
Описание
a map of skills and multipliers (1.0 = no bonus)

Name: setEffectXp

Registers a configuration setting for xp gained from active effects

ZenScript
Copy
CTUtils.setEffectXp(effectID as ResourceLocation, effectLevel as int, xpGains as int?[string])
ПараметрТипОписание
Параметр
effectID
Тип
ResourceLocation
Описание
the key for the effect
Параметр
effectLevel
Тип
int
Описание
the level of the effect
Параметр
xpGains
Тип
int?[string]
Описание
a map of the skills and xp awarded when this effect is active

Name: setEnchantment

sets the requirements for a given enchantment and enchantment level

ZenScript
Copy
// CTUtils.setEnchantment(enchantID as ResourceLocation, enchantLevel as int, reqs as int?[string])

CTUtils.setEnchantment(<resource:namespace:path>, 1, {skillname: 00 as int?, otherskillname: 00 as int?});
ПараметрТипОписание
Параметр
enchantID
Тип
ResourceLocation
Описание
the key for the enchantment
Параметр
enchantLevel
Тип
int
Описание
the level of the enchantment
Параметр
reqs
Тип
int?[string]
Описание
a map of the skills and levels needed to use this enchantment

Name: setMobModifier

registers a configuration setting for mob modifiers to a biome or dimension.

Attribute types for the inner map of mob_modifiers can be referenced
using the static strings in this class prefixed with "MOB_"

ZenScript
Copy
CTUtils.setMobModifier(objectType as invalid, locationID as ResourceLocation, mobID as ResourceLocation, modifiers as double?[string])
ПараметрТипОписание
Параметр
objectType
Тип
invalid
Описание
a value of [item, block, entity, dimension, or biome]
Параметр
locationID
Тип
ResourceLocation
Описание
the biome or dimension key
Параметр
mobID
Тип
ResourceLocation
Описание
the key for the mob being set
Параметр
modifiers
Тип
double?[string]
Описание
a map of attributes (health, speed, or damage) and modifiers

Link to setNegativeEffect

Name: setNegativeEffect

registers a configuration setting for what status effects should be applied to the player
if they attempt to wear/hold and item they are not skilled enough to use.

ZenScript
Copy
// CTUtils.setNegativeEffect(objectType as invalid, objectID as ResourceLocation, effects as int?[ResourceLocation])

CTUtils.setNegativeEffect(<constant:pmmo:objecttype:value>, <resource:namespace:path>, {<resource:namespace:path>: 00 as int?, <resource:othernamespace:otherpath>: 00 as int?});
ПараметрТипОписание
Параметр
objectType
Тип
invalid
Описание
a value of [item, block, entity, dimension, or biome]
Параметр
objectID
Тип
ResourceLocation
Описание
Параметр
effects
Тип
int?[ResourceLocation]
Описание
a map of effect ids and levels

Link to setPositiveEffect

Name: setPositiveEffect

registers a configuration setting for what status effects should be applied to the player
based on their meeting or not meeting the requirements for the specified location.
Note: a "negative" effect on a dimension will have no use in-game

ZenScript
Copy
// CTUtils.setPositiveEffect(objectType as invalid, objectID as ResourceLocation, effects as int?[ResourceLocation])

CTUtils.setPositiveEffect(<constant:pmmo:objecttype:value>, <resource:namespace:path>, {<resource:namespace:path>: 00 as int?, <resource:othernamespace:otherpath>: 00 as int?});
ПараметрТипОписание
Параметр
objectType
Тип
invalid
Описание
a value of [item, block, entity, dimension, or biome]
Параметр
objectID
Тип
ResourceLocation
Описание
Параметр
effects
Тип
int?[ResourceLocation]
Описание
a map of effect ids and levels

Name: setReq

sets a configuration setting for a requirement to perform
and action for the specified item.

ZenScript
Copy
// CTUtils.setReq(objectType as invalid, objectID as ResourceLocation, type as invalid, requirements as int?[string])

CTUtils.setReq(<constant:pmmo:objecttype:value>, <resource:namespace:path>, <constant:pmmo:reqtype:value>, {skillname: 00 as int?, otherskillname: 00 as int?});
ПараметрТипОписание
Параметр
objectType
Тип
invalid
Описание
a value of [item, block, entity, dimension, or biome]
Параметр
objectID
Тип
ResourceLocation
Описание
the key for the item being configured
Параметр
type
Тип
invalid
Описание
the requirement category
Параметр
requirements
Тип
int?[string]
Описание
a map of skills and levels needed to perform the action

Name: setSalvage

registers a configuration setting for items which can be obtained
via salvage from the item supplied.
This class provides SalvageBuilder as a means to construct
the salvage settings for each output object

ZenScript
Copy
// CTUtils.setSalvage(item as ResourceLocation, salvage as SalvageBuilder[ResourceLocation])

CTUtils.setSalvage(<resource:namespace:path>, {<resource:namespace:path>:builderInstance, <resource:othernamespace:otherpath>:otherbuilderInstance});
ПараметрТипОписание
Параметр
item
Тип
ResourceLocation
Описание
a key for the item to be consumed by the salvage operation
Параметр
salvage
Тип
SalvageBuilder[ResourceLocation]
Описание
a map of output item keys and the conditions for salvage

Name: setXpAward

registers a configuration setting for experience that should be awarded
to a player for performing an action with/on a specific object.

ZenScript
Copy
// CTUtils.setXpAward(objectType as invalid, objectID as ResourceLocation, type as invalid, award as long?[string])

CTUtils.setXpAward(<constant:pmmo:objecttype:value>, <resource:namespace:path>, <constant:pmmo:eventtype:value>, {skillname: 00 as long?, otherskillname: 00 as long?});
ПараметрТипОписание
Параметр
objectType
Тип
invalid
Описание
a value of [item, block, entity, dimension, or biome]
Параметр
objectID
Тип
ResourceLocation
Описание
the key for the item being configured
Параметр
type
Тип
invalid
Описание
the event which awards the experience
Параметр
award
Тип
long?[string]
Описание
a map of skills and experience values to be awarded