tModLoader v2024.03
A mod to make and play Terraria mods
ExtraJump Class Referenceabstract

ExtraJump is a singleton, defining the properties and behaviour of midair extra jumps.
Fields defining the state of a jump per player are stored in ExtraJumpState More...

Inherits ModType< TEntity, TModType >.

Inherited by VanillaExtraJump.

Classes

class  After
 
class  Before
 
class  Position
 

Public Member Functions

virtual bool CanShowVisuals (Player player)
 Return false to prevent ShowVisuals(Player) from executing.
By default, this hook returns whether the player is moving upwards with respect to Player.gravDir More...
 
virtual bool CanStart (Player player)
 An extra condition for whether this extra jump can be started. Used by vanilla for flippers (Entity.wet). Returns true by default. More...
 
abstract Position GetDefaultPosition ()
 Returns this extra jump's default position in regard to the vanilla extra jumps. Make use of e.g. Before/After, and provide an extra jump.

More...
 
abstract float GetDurationMultiplier (Player player)
 Vanilla's jumps use the following values: More...
 
virtual IEnumerable< PositionGetModdedConstraints ()
 Modded jumps are placed between vanilla jumps via GetDefaultPosition and, by default, are sorted in load order.
This hook allows you to sort this jump before/after other modded jumps that were placed between the same two vanilla jumps.
Example: More...
 
virtual void OnEnded (Player player)
 This hook runs before ExtraJumpState.Active is set from true to false
Jumps end when their duration expires or when ExtraJumpState.Enabled is no longer true.
Jumps may end early via Player.StopExtraJumpInProgress, called when a grappling hook is thrown, the player grabs onto a rope, or when the player is frozen, turned to stone or webbed. More...
 
virtual void OnRefreshed (Player player)
 This hook runs before ExtraJumpState.Available is set to true in Player.RefreshDoubleJumps
This occurs at the start of the grounded jump and while the player is grounded, or when jumping off a grappling hook/rope. More...
 
virtual void OnStarted (Player player, ref bool playSound)
 This hook runs when the player uses this jump via pressing the jump key
Effects that should appear when the jump starts can be spawned here.
For example, the Cloud in a Bottle's initial puff of smoke is spawned here.

To make the jump re-usable, set ExtraJumpState.Available to true
More...
 
sealed override void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. More...
 
virtual void ShowVisuals (Player player)
 Spawn effects that should appear while the player is performing this jump here.
Only runs while the jump is ExtraJumpState.Active
For example, the Sandstorm in a Bottle's dusts are spawned here. More...
 
override string ToString ()
 
virtual void UpdateHorizontalSpeeds (Player player)
 Modify the player's horizontal movement while performing this jump here.
Only runs while the jump is ExtraJumpState.Active

Vanilla's jumps use the following values: More...
 
- Public Member Functions inherited from ModType< TEntity, TModType >
virtual TModType Clone (TEntity newEntity)
 Create a copy of this instanced global. Called when an entity is cloned. More...
 
virtual bool IsLoadingEnabled (Mod mod)
 Allows you to stop Mod.AddContent from actually adding this content. Useful for items that can be disabled by a config. More...
 
virtual void Load ()
 Allows you to perform one-time loading tasks. Beware that mod content has not finished loading here, things like ModContent lookup tables or ID Sets are not fully populated. More...
 
virtual TModType NewInstance (TEntity entity)
 Create a new instance of this ModType for a specific entity More...
 
string PrettyPrintName ()
 
virtual void SetStaticDefaults ()
 Allows you to modify the properties after initial loading has completed. More...
 
virtual void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. More...
 
virtual void Unload ()
 Allows you to safely unload things you added in Load. More...
 
virtual bool IsLoadingEnabled (Mod mod)
 Whether or not this type should be loaded when it's told to. Returning false disables Mod.AddContent from actually loading this type. More...
 
abstract void Load (Mod mod)
 Called when loading the type. More...
 
abstract void Unload ()
 Called during unloading when needed. More...
 
- Public Member Functions inherited from ModType< TEntity >
virtual TModType Clone (TEntity newEntity)
 Create a copy of this instanced global. Called when an entity is cloned. More...
 
virtual bool IsLoadingEnabled (Mod mod)
 Allows you to stop Mod.AddContent from actually adding this content. Useful for items that can be disabled by a config. More...
 
virtual void Load ()
 Allows you to perform one-time loading tasks. Beware that mod content has not finished loading here, things like ModContent lookup tables or ID Sets are not fully populated. More...
 
virtual TModType NewInstance (TEntity entity)
 Create a new instance of this ModType for a specific entity More...
 
string PrettyPrintName ()
 
virtual void SetStaticDefaults ()
 Allows you to modify the properties after initial loading has completed. More...
 
virtual void SetupContent ()
 If you make a new ModType, seal this override, and call SetStaticDefaults in it. More...
 
virtual void Unload ()
 Allows you to safely unload things you added in Load. More...
 

Protected Member Functions

sealed override void Register ()
 If you make a new ModType, seal this override. More...
 
- Protected Member Functions inherited from ModType< TEntity, TModType >
abstract TEntity CreateTemplateEntity ()
 
virtual void InitTemplateInstance ()
 Create dummy objects for instanced mod-types More...
 
override void InitTemplateInstance ()
 Create dummy objects for instanced mod-types More...
 
abstract void Register ()
 If you make a new ModType, seal this override. More...
 
virtual void ValidateType ()
 Check for the correct overrides of different hook methods and fields and properties More...
 
- Protected Member Functions inherited from ModType< TEntity >
abstract TEntity CreateTemplateEntity ()
 
virtual void InitTemplateInstance ()
 Create dummy objects for instanced mod-types More...
 
override void InitTemplateInstance ()
 Create dummy objects for instanced mod-types
 
abstract void Register ()
 If you make a new ModType, seal this override. More...
 
virtual void ValidateType ()
 Check for the correct overrides of different hook methods and fields and properties More...
 

Static Protected Attributes

static readonly Position AfterBottleJumps = new After(CloudInABottle)
 
static readonly Position BeforeBottleJumps = new Before(SandstormInABottle)
 
static readonly Position BeforeMountJumps = new Before(BasiliskMount)
 
static readonly Position MountJumpPosition = new After(BasiliskMount)
 

Properties

static ExtraJump BasiliskMount = new BasiliskMountJump() [get]
 
static ExtraJump BlizzardInABottle = new BlizzardInABottleJump() [get]
 
static ExtraJump CloudInABottle = new CloudInABottleJump() [get]
 
static ExtraJump FartInAJar = new FartInAJarJump() [get]
 
static ExtraJump Flipper = new FlipperJump() [get]
 
static ExtraJump GoatMount = new GoatMountJump() [get]
 
static ExtraJump SandstormInABottle = new SandstormInABottleJump() [get]
 
static ExtraJump SantankMount = new SantankMountJump() [get]
 
static ExtraJump TsunamiInABottle = new TsunamiInABottleJump() [get]
 
int Type [get, set]
 The internal ID of this ExtraJump.
 
static ExtraJump UnicornMount = new UnicornMountJump() [get]
 
- Properties inherited from ModType< TEntity, TModType >
virtual bool CloneNewInstances [get]
 Whether to create new instances of this mod type via Clone(TEntity) or via the default constructor Defaults to false (default constructor).
 
TEntity Entity [get, set]
 
string FullName [get]
 The internal name of this, including the mod it is from. More...
 
virtual bool IsCloneable [get]
 Whether or not this type is cloneable. Cloning is supported if
all reference typed fields in each sub-class which doesn't override Clone are marked with [CloneByReference]
 
Mod Mod [get, set]
 The mod this belongs to. More...
 
virtual string Name [get]
 The internal name of this. More...
 
- Properties inherited from IModType
string FullName [get]
 => $"{Mod.Name}/{Name}" More...
 
Mod Mod [get]
 The mod this belongs to. More...
 
string Name [get]
 The internal name of this instance. More...
 
- Properties inherited from ModType< TEntity >
virtual bool CloneNewInstances [get]
 Whether to create new instances of this mod type via Clone(TEntity) or via the default constructor Defaults to false (default constructor).
 
TEntity Entity [get, set]
 
string FullName [get]
 The internal name of this, including the mod it is from. More...
 
virtual bool IsCloneable [get]
 Whether or not this type is cloneable. Cloning is supported if
all reference typed fields in each sub-class which doesn't override Clone are marked with [CloneByReference]
 
Mod Mod [get, set]
 The mod this belongs to. More...
 
virtual string Name [get]
 The internal name of this. More...
 

Detailed Description

ExtraJump is a singleton, defining the properties and behaviour of midair extra jumps.
Fields defining the state of a jump per player are stored in ExtraJumpState

Member Function Documentation

◆ CanShowVisuals()

virtual bool ExtraJump.CanShowVisuals ( Player  player)
virtual

Return false to prevent ShowVisuals(Player) from executing.
By default, this hook returns whether the player is moving upwards with respect to Player.gravDir

Parameters
playerThe player performing the jump

◆ CanStart()

virtual bool ExtraJump.CanStart ( Player  player)
virtual

An extra condition for whether this extra jump can be started. Used by vanilla for flippers (Entity.wet). Returns true by default.

Parameters
playerThe player that would perform the jump
Returns
true to let the jump be started, false otherwise.

Reimplemented in FlipperJump.

◆ GetDefaultPosition()

abstract Position ExtraJump.GetDefaultPosition ( )
pure virtual

Returns this extra jump's default position in regard to the vanilla extra jumps. Make use of e.g. Before/After, and provide an extra jump.

Recommended using one of: BeforeMountJumps, MountJumpPosition, BeforeBottleJumps, AfterBottleJumps

NOTE: The position must specify a vanilla ExtraJump otherwise an exception will be thrown.

Implemented in VanillaExtraJump.

◆ GetDurationMultiplier()

abstract float ExtraJump.GetDurationMultiplier ( Player  player)
pure virtual

Vanilla's jumps use the following values:

Basilisk mount: 0.75
Blizzard in a Bottle: 1.5
Cloud in a Bottle: 0.75
Fart in a Jar: 2
Goat mount: 2
Sandstorm in a Bottle: 3
Santank mount: 2
Tsunami in a Bottle: 1.25
Unicorn mount: 2

Parameters
playerThe player performing the jump
Returns
A modifier to the player's jump height, which when combined effectively acts as the duration for the jump

Implemented in FlipperJump, GoatMountJump, BasiliskMountJump, SantankMountJump, UnicornMountJump, SandstormInABottleJump, BlizzardInABottleJump, FartInAJarJump, TsunamiInABottleJump, and CloudInABottleJump.

◆ GetModdedConstraints()

virtual IEnumerable< Position > ExtraJump.GetModdedConstraints ( )
virtual

Modded jumps are placed between vanilla jumps via GetDefaultPosition and, by default, are sorted in load order.
This hook allows you to sort this jump before/after other modded jumps that were placed between the same two vanilla jumps.
Example:

yield return new After(ModContent.GetInstance<SimpleExtraJump>());

By default, this hook returns null, which indicates that this jump has no modded ordering constraints.

Reimplemented in VanillaExtraJump.

◆ OnEnded()

virtual void ExtraJump.OnEnded ( Player  player)
virtual

This hook runs before ExtraJumpState.Active is set from true to false
Jumps end when their duration expires or when ExtraJumpState.Enabled is no longer true.
Jumps may end early via Player.StopExtraJumpInProgress, called when a grappling hook is thrown, the player grabs onto a rope, or when the player is frozen, turned to stone or webbed.

Parameters
playerThe player that was performing the jump

◆ OnRefreshed()

virtual void ExtraJump.OnRefreshed ( Player  player)
virtual

This hook runs before ExtraJumpState.Available is set to true in Player.RefreshDoubleJumps
This occurs at the start of the grounded jump and while the player is grounded, or when jumping off a grappling hook/rope.

Parameters
playerThe player instance

◆ OnStarted()

virtual void ExtraJump.OnStarted ( Player  player,
ref bool  playSound 
)
virtual

This hook runs when the player uses this jump via pressing the jump key
Effects that should appear when the jump starts can be spawned here.
For example, the Cloud in a Bottle's initial puff of smoke is spawned here.

To make the jump re-usable, set ExtraJumpState.Available to true

Parameters
playerThe player performing the jump
playSoundWhether the poof sound should play. Set this parameter to false if you want to play a different sound.

Reimplemented in FlipperJump, GoatMountJump, BasiliskMountJump, SantankMountJump, UnicornMountJump, FartInAJarJump, TsunamiInABottleJump, and CloudInABottleJump.

◆ Register()

sealed override void ExtraJump.Register ( )
protectedvirtual

If you make a new ModType, seal this override.

Implements ModType< TEntity >.

◆ SetupContent()

sealed override void ExtraJump.SetupContent ( )
virtual

If you make a new ModType, seal this override, and call SetStaticDefaults in it.

Reimplemented from ModType< TEntity >.

◆ ShowVisuals()

virtual void ExtraJump.ShowVisuals ( Player  player)
virtual

Spawn effects that should appear while the player is performing this jump here.
Only runs while the jump is ExtraJumpState.Active
For example, the Sandstorm in a Bottle's dusts are spawned here.

Parameters
playerThe player performing the jump

Reimplemented in UnicornMountJump, SandstormInABottleJump, BlizzardInABottleJump, FartInAJarJump, TsunamiInABottleJump, and CloudInABottleJump.

◆ UpdateHorizontalSpeeds()

virtual void ExtraJump.UpdateHorizontalSpeeds ( Player  player)
virtual

Modify the player's horizontal movement while performing this jump here.
Only runs while the jump is ExtraJumpState.Active

Vanilla's jumps use the following values:

Basilisk mount: runAcceleration *= 3; maxRunSpeed *= 1.5;
Blizzard in a Bottle: runAcceleration *= 3; maxRunSpeed *= 1.5;
Cloud in a Bottle: no change
Fart in a Jar: runAcceleration *= 3; maxRunSpeed *= 1.75;
Goat mount: runAcceleration *= 3; maxRunSpeed *= 1.5;
Sandstorm in a Bottle: runAcceleration *= 1.5; maxRunSpeed *= 2;
Santank mount: runAcceleration *= 3; maxRunSpeed *= 1.5;
Tsunami in a Bottle: runAcceleration *= 1.5; maxRunSpeed *= 1.25;
Unicorn mount: runAcceleration *= 3; maxRunSpeed *= 1.5;

Parameters
playerThe player performing the jump

Reimplemented in GoatMountJump, BasiliskMountJump, SantankMountJump, UnicornMountJump, SandstormInABottleJump, BlizzardInABottleJump, FartInAJarJump, and TsunamiInABottleJump.