CTUtils
Link to ctutils
Requires PMMO 0.5.4 or above!
导入类
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 Copyimport mods.pmmo.CTUtils;
Static Methods
Link to static-methods
Name: setBonus
Registers a configuration setting for bonuses to xp gains.
ZenScript Copy// CTUtils.setBonus(objectType as ObjectType, objectID as ResourceLocation, type as ModifierDataType, 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 | 类型 ObjectType | 描述 a value of [item, block, entity, dimension, or biome] |
参数 objectID | 类型 资源位置 | 描述 the object linked to the bonus |
参数 类型 | 类型 ModifierDataType | 描述 the relation to the object which predicates the bonus |
参数 bonus | 类型 double?[string] | 描述 a map of skills and multipliers (1.0 = no bonus) |
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 | 类型 资源位置 | 描述 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 CopyCTUtils.setMobModifier(objectType as ObjectType, locationID as ResourceLocation, mobID as ResourceLocation, modifiers as double?[string])
参数 | 类型 | 描述 |
---|---|---|
参数 objectType | 类型 ObjectType | 描述 a value of [item, block, entity, dimension, or biome] |
参数 locationID | 类型 资源位置 | 描述 the biome or dimension key |
参数 mobID | 类型 资源位置 | 描述 the key for the mob being set |
参数 modifiers | 类型 double?[string] | 描述 a map of attributes (health, speed, or damage) and modifiers |
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 ObjectType, 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 | 类型 ObjectType | 描述 a value of [item, block, entity, dimension, or biome] |
参数 objectID | 类型 资源位置 | 描述 |
参数 effects | 类型 int?[ResourceLocation] | 描述 a map of effect ids and levels |
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 ObjectType, 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 | 类型 ObjectType | 描述 a value of [item, block, entity, dimension, or biome] |
参数 objectID | 类型 资源位置 | 描述 the key for the dimension or biome being configured |
参数 effects | 类型 int?[ResourceLocation] | 描述 a map of effect ids and levels |
Name: setReq
Sets a configuration setting for a requirement to perform an action for the specified item.
ZenScript Copy// CTUtils.setReq(objectType as ObjectType, objectID as ResourceLocation, type as ReqType, 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 | 类型 ObjectType | 描述 a value of [item, block, entity, dimension, or biome] |
参数 objectID | 类型 资源位置 | 描述 the key for the item being configured |
参数 类型 | 类型 ReqType | 描述 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 | 类型 资源位置 | 描述 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 ObjectType, objectID as ResourceLocation, type as EventType, 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 | 类型 ObjectType | 描述 a value of [item, block, entity, dimension, or biome] |
参数 objectID | 类型 资源位置 | 描述 the key for the item being configured |
参数 类型 | 类型 EventType | 描述 the event which awards the experience |
参数 award | 类型 long?[string] | 描述 a map of skills and experience values to be awarded |