-
Notifications
You must be signed in to change notification settings - Fork 36
ContentTweaker
Early draft of documenting the ContentTweaker integration
Use this package instead of mods.contenttweaker.tconstruct.MaterialBuilder
to make materials that are compatible with Construct's Armory armor! This has all of the functionality of the original package, plus additional functionality to provide armor capabilities. If you use this package at all, you do not need the original one.
Please prime yourself with the original Material Builder documentation, as this documentation will assume familiarity and will only address the differences in usage.
Instead of the original package, please import the following:
import mods.contenttweaker.conarm.ExtendedMaterialBuilder
Instead of the original method, please use the following:
//mods.contenttweaker.conarm.ExtendedMaterialBuilder.create(String identifier);
val myMat = mods.contenttweaker.conarm.ExtendedMaterialBuilder.create("kindlich_mat");
New possible values for dependency
are:
"core"
"plates"
"trim"
Remember to implement these as only armor parts whose stats have been added will be built!
myMat.addCoreMaterialStats(float durability, float defense);
myMat.removeCoreMaterialStats();
myMat.addPlatesMaterialStats(float modifier, float durability, float toughness);
myMat.removePlatesMaterialStats();
myMat.addTrimMaterialStats(float durability);
myMat.removeTrimMaterialStats();
An Armor Trait Representation represents a Construct's Armory Trait.
You can get such an object either from the Armor Trait Builder or from the Armor Trait Bracket Handler.
Use this package instead of mods.contenttweaker.tconstruct.Trait
Instead of the original package, please import the following:
mods.contenttweaker.conarm.ArmorTrait
Use this bracket handler instead of the original only when handling traits built for armor.
<conarmtrait:identifier>
<conarmtrait:cactus>
Use this package instead of mods.contenttweaker.tconstruct.TraitBuilder
to make traits for Construct's Armory armor!
Do not use this for building traits for tools.
Please prime yourself with the original Trait Builder documentation, as this documentation will assume familiarity and will only address the differences in usage.
Instead of the original package, please import the following:
import mods.contenttweaker.conarm.ArmorTraitBuilder
Instead of the original method, please use the following:
//create(String identifier);
val myTrait = mods.contenttweaker.conarm.ArmorTraitBuilder.create("kindlich_test");
myTrait.canApplyTogetherTrait = function(ArmorTraitRepresentation thisTrait, String otherTrait){....};
myTrait.canApplyTogetherEnchantment = function(ArmorTraitRepresentation thisTrait, IEnchantmentDefinition enchant){....};
myTrait.extraInfo = function(ArmorTraitRepresentation thisTrait, IItemStack item, IData tag){....};
Called each tick by the armor when loaded (that means in the player’s inventory). Parameters:
- A Trait Representation representing the currently used
trait
- An IItemStack representing the
armor
- An IWorld representing the
world
- An IEntity representing the
owner
- An int representing the
itemSlot
- A boolean that describes if the armor currently
isSelected
Returns nothing.
Created using:
myTrait.onUpdate = function(trait, armor, world, owner, itemSlot, isSelected) {
//CODE
};
Called before the armor is getting repaired with its repair material. Not to be confused with onArmorHealed which is called afterwards. Will be called multiple times if multiple items are used at once.
Parameters:
- A Trait Representation representing the currently used
trait
. - An IItemStack representing the
armor
to be repaired - An int representing the
amount
of durability to be increased.
Returns nothing.
Created using: myTrait.onArmorRepair = function(trait, armor, amount) { //CODE };
Called each tick when wearing the armor. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IWorld representing the
world
- An IPlayer representing the
player
Returns nothing.
Created using:
myTrait.onArmorTick = function(trait, armor, world, player) {
//CODE
};
Called when calculating damage reduction values from armor. Parameters:
- A Trait Representation representing the current used
trait
- An IPlayer representing the
player
- An
ArmorModification
representing themods
- An IItemStack representing the worn
armor
- An IDamageSource representing the
damageSource
- A double representing the amount of
damage
- An integer representing the armor slot
index
Returns an ArmorModification.
Created using:
myTrait.getArmorModifications = function(trait, player, mods, armor, damageSource, damage, index) {
//CODE
};
An ArmorModification object has 5 public fields:
- float
armor
that represents the armor amount - float
toughness
that represents the toughness amount - float
armorMod
that represents the armor multiplier - float
toughnessMod
that represents the toughness multiplier - float
effective
that represents the overall multiplier
Called when picking up an EntityItem
Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IEntityItem representing the picked up
item
- An EntityItemPickupEvent
evt
Returns nothing.
Created using:
myTrait.onItemPickup = function(trait, armor, item, evt) {
//CODE
};
Called when taking damage while wearing the armor, before armor and potion calculations. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IPlayer representing the
player
- An IDamageSource representing the
damageSource
- A float representing the amount of
originalDamage
- A float representing the amount of
newDamage
- A LivingHurtEvent
evt
Returns a float representing the new damage. Otherwise, returns newDamage
.
Created using:
myTrait.onHurt = function(trait, armor, player, source, damage, newDamage, evt) {
//CODE
};
Called when taking damage while wearing the armor, after armor and potion calculations. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IPlayer representing the
player
- An IDamageSource representing the
damageSource
- A float representing the amount of
originalDamage
- A float representing the amount of
newDamage
- A LivingDamageEvent
evt
Returns a float representing the new damage. Otherwise, returns newDamage
.
Created using:
myTrait.onDamaged = function(trait, armor, player, source, damage, newDamage, evt) {
//CODE
};
Called when being knocked back while wearing the armor. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IPlayer representing the
player
- A LivingKnockbackEvent
evt
Returns nothing.
Created using:
myTrait.onKnockback = function(trait, armor, player, evt) {
//CODE
};
Called when the player is set to fall. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IPlayer representing the
player
- A LivingFallEvent
evt
Returns nothing.
Created using:
myTrait.onFalling = function(trait, armor, player, evt) {
//CODE
};
Called when the player jumps. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IPlayer representing the
player
- A LivingJumpEvent
evt
Returns nothing.
Created using:
myTrait.onJumping = function(trait, armor, player, evt) {
//CODE
};
Called each tick when the player has the trait. Parameters:
- A Trait Representation representing the current used
trait
- An integer representing the trait
level
- An IWorld representing the
world
- An IPlayer representing the
player
Returns nothing.
Created using:
myTrait.onAbility = function(trait, level, world, player) {
//CODE
};
Called when the player equips the armor. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IPlayer representing the
player
- An integer representing the armor slot
index
Returns nothing.
Created using:
myTrait.onArmorEquip = function(trait, armor, player, index) {
//CODE
};
Called when the player removes the armor. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IPlayer representing the
player
- An integer representing the armor slot
index
Returns nothing.
Created using:
myTrait.onArmorRemove = function(trait, armor, player, index) {
//CODE
};
Called when the armor gets damaged by any means. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IDamageSource representing the
damageSource
- An integer representing the original
amount
- An integer representing the
newAmount
- An IPlayer representing the
player
- An integer representing the armor slot
index
Returns an integer representing the new damage amount. Otherwise, returns newAmount
.
Created using:
myTrait.onArmorDamaged = function(trait, armor, damageSource, amount, newAmount, player, index) {
//CODE
};
Called when the armor gets healed by any means. Parameters:
- A Trait Representation representing the current used
trait
- An IItemStack representing the worn
armor
- An IDamageSource representing the
healSource
- An integer representing the original
amount
- An integer representing the
newAmount
- An IPlayer representing the
player
- An integer representing the armor slot
index
Returns an integer representing the new heal amount. Otherwise, returns newAmount
.
Created using:
myTrait.onArmorHealed = function(trait, armor, healSource, amount, newAmount, player, index) {
//CODE
};
Called when a function needs to know the ability level of the trait on the armor piece. Parameters:
- A Trait Representation representing the current used
trait
- A ModifierNBT representing the
data
Returns an integer representing the ability level. Otherwise, returns 1.
Created using:
myTrait.getAbilityLevel = function(trait, data) {
//CODE
};