tModLoader v0.11.8.9
A mod to make and play Terraria mods
Terraria.ModLoader.ModTree Class Referenceabstract

This class represents a type of modded tree. The tree will share a tile ID with the vanilla trees (5), so that the trees can freely convert between each other if the soil below is converted. This class encapsulates several functions that distinguish each type of tree from each other. Use ModTile.SetModTree or GlobalTile.AddModTree to make a tile able to grow this kind of tree. More...

Public Member Functions

virtual bool CanDropAcorn ()
 Whether or not this tree can drop acorns. Returns true by default. More...
 
virtual int CreateDust ()
 Return the type of dust created when this tree is destroyed. Returns 7 by default. More...
 
abstract int DropWood ()
 The ID of the item that is dropped in bulk when this tree is destroyed. More...
 
abstract Texture2D GetBranchTextures (int i, int j, int trunkOffset, ref int frame)
 Return the texture containing the possible tree branches that can be drawn next to this tree. The trunkOffset parameter can be added to i to get the x-coordinate of the tree's trunk. More...
 
abstract Texture2D GetTexture ()
 Return the texture that represents the tile sheet used for drawing this tree. More...
 
abstract Texture2D GetTopTextures (int i, int j, ref int frame, ref int frameWidth, ref int frameHeight, ref int xOffsetLeft, ref int yOffset)
 Return the texture containing the possible tree tops that can be drawn above this tree. More...
 
virtual int GrowthFXGore ()
 Return the type of gore created to represent leaves when this tree grows on-screen. Returns -1 by default. More...
 

Detailed Description

This class represents a type of modded tree. The tree will share a tile ID with the vanilla trees (5), so that the trees can freely convert between each other if the soil below is converted. This class encapsulates several functions that distinguish each type of tree from each other. Use ModTile.SetModTree or GlobalTile.AddModTree to make a tile able to grow this kind of tree.

Definition at line 8 of file ConvertiblePlants.cs.

Member Function Documentation

◆ CanDropAcorn()

virtual bool Terraria.ModLoader.ModTree.CanDropAcorn ( )
virtual

Whether or not this tree can drop acorns. Returns true by default.

Returns

Definition at line 30 of file ConvertiblePlants.cs.

30 {
31 return true;
32 }

◆ CreateDust()

virtual int Terraria.ModLoader.ModTree.CreateDust ( )
virtual

Return the type of dust created when this tree is destroyed. Returns 7 by default.

Returns

Definition at line 14 of file ConvertiblePlants.cs.

14 {
15 return 7;
16 }

◆ DropWood()

abstract int Terraria.ModLoader.ModTree.DropWood ( )
pure virtual

The ID of the item that is dropped in bulk when this tree is destroyed.

Returns

◆ GetBranchTextures()

abstract Texture2D Terraria.ModLoader.ModTree.GetBranchTextures ( int  i,
int  j,
int  trunkOffset,
ref int  frame 
)
pure virtual

Return the texture containing the possible tree branches that can be drawn next to this tree. The trunkOffset parameter can be added to i to get the x-coordinate of the tree's trunk.

Parameters
i
j
trunkOffset
frame
Returns

◆ GetTexture()

abstract Texture2D Terraria.ModLoader.ModTree.GetTexture ( )
pure virtual

Return the texture that represents the tile sheet used for drawing this tree.

Returns

◆ GetTopTextures()

abstract Texture2D Terraria.ModLoader.ModTree.GetTopTextures ( int  i,
int  j,
ref int  frame,
ref int  frameWidth,
ref int  frameHeight,
ref int  xOffsetLeft,
ref int  yOffset 
)
pure virtual

Return the texture containing the possible tree tops that can be drawn above this tree.

Parameters
i
j
frame
frameWidth
frameHeight
xOffsetLeft
yOffset
Returns

◆ GrowthFXGore()

virtual int Terraria.ModLoader.ModTree.GrowthFXGore ( )
virtual

Return the type of gore created to represent leaves when this tree grows on-screen. Returns -1 by default.

Returns

Definition at line 22 of file ConvertiblePlants.cs.

22 {
23 return -1;
24 }