tModLoader v2023.01
A mod to make and play Terraria mods
|
Inherits Terraria.Entity, Terraria.ModLoader.IO.TagSerializable, and Terraria.ModLoader.IEntityWithGlobals< GlobalItem >.
Public Member Functions | |
Item (int setDefaultsToType, int stack=1, int prefix=0) | |
string | AffixName () |
bool | CanCombineStackInWorld () |
bool | CanFillEmptyAmmoSlot () |
bool | checkMat () |
void | ClearNameOverride () |
Item | Clone () |
void | CloneDefaults (int TypeToClone) |
Item | CloneWithModdedDataFrom (Item dataSource) |
bool | CountsAsClass (DamageClass damageClass) |
bool | CountsAsClass< T > () |
void | DefaultToAccessory (int newwidth=24, int newheight=24) |
void | DefaultToBow (int singleShotTime, float shotVelocity, bool hasAutoReuse=false) |
This method sets a variety of common Item values common to bow weapons. Specifically: width = 14; height = 30; UseSound = SoundID.Item5; Addtionally: More... | |
void | DefaultToCapturedCritter (int npcIdToSpawnOnUse) |
void | DefaultToFood (int newwidth, int newheight, int foodbuff, int foodbuffduration, bool useGulpSound=false, int animationTime=17) |
This method sets a variety of common Item values common to food items. Specifically: UseSound = useGulpSound ? Item3 : Item2; useStyle = useGulpSound ? DrinkLiquid : EatFood; useTurn = true; useAnimation = useTime = animationTime; maxStack = 30; consumable = true; buffType = foodbuff; buffTime = foodbuffduration; rare = Blue; value = 20 silver; More... | |
void | DefaultToGolfBall (int projid) |
void | DefaultToGolfClub (int newwidth, int newheight) |
void | DefaultToGuitar (int newwidth=24, int newheight=24) |
void | DefaultToHeadgear (int newwidth, int newheight, int helmetArtID) |
void | DefaultToHealingPotion (int newwidth, int newheight, int healingAmount, int animationTime=17) |
void | DefaultTokite (int projId) |
void | DefaultToLawnMower (int newwidth, int newheight) |
void | DefaultToMagicWeapon (int projType, int singleShotTime, float shotVelocity, bool hasAutoReuse=false) |
void | DefaultToMount (int mount) |
void | DefaultToMusicBox (int style) |
void | DefaultToPlacableWall (ushort wallToPlace) |
This method sets a variety of common Item values common to placeable walls. Specifically: useStyle = 1; useTurn = true; useAnimation = 15; useTime = 7; autoReuse = true; maxStack = 999; consumable = true; createWall = wallToPlace; width = 12; height = 12; More... | |
void | DefaultToPlaceableTile (int tileIDToPlace, int tileStyleToPlace=0) |
void | DefaultToPlaceableTile (ushort tileIDToPlace, int tileStyleToPlace=0) |
void | DefaultToQuestFish () |
void | DefaultToRangedWeapon (int baseProjType, int ammoID, int singleShotTime, float shotVelocity, bool hasAutoReuse=false) |
This method sets a variety of common Item values common to ranged weapons. Specifically: autoReuse = hasAutoReuse; useStyle = 5; useAnimation = singleShotTime; useTime = singleShotTime; shoot = baseProjType; useAmmo = ammoID; shootSpeed = shotVelocity; noMelee = true; ranged = true; More... | |
void | DefaultToSeaShelll () |
void | DefaultToSpear (int projType, float pushForwardSpeed, int animationTime) |
void | DefaultToStaff (int projType, float pushForwardSpeed, int singleShotTime, int manaPerShot) |
void | DefaultToThrownWeapon (int baseProjType, int singleShotTime, float shotVelocity, bool hasAutoReuse=false) |
void | DefaultToTorch (int tileStyleToPlace, bool allowWaterPlacement=false) |
void | DefaultToVanitypet (int projId, int buffID) |
void | DefaultToWhip (int projectileId, int dmg, float kb, float shootspeed, int animationTotalTime=30) |
void | DeserializeFrom (BinaryReader reader, ItemSerializationContext context) |
void | FindOwner (int whoAmI) |
bool | FitsAmmoSlot () |
Color | GetAlpha (Color newColor) |
Color | GetColor (Color newColor) |
T | GetGlobalItem< T > (bool exactType=true) |
Gets the instance of the specified GlobalItem type. This will throw exceptions on failure. More... | |
T | GetGlobalItem< T > (T baseInstance) |
Gets the local instance of the type of the specified GlobalItem instance. This will throw exceptions on failure. More... | |
Rectangle | getRect () |
int | GetStoreValue () |
bool | IsNotSameTypePrefixAndStack (Item compareItem) |
returns false if and only if netID (deprecated, equivalent to type), stack and prefix match | |
void | netDefaults (int type) |
void | OnPurchase (Item item) |
bool | Prefix (int pre) |
void | RebuildTooltip () |
void | Refresh () |
void | ResetStats (int Type) |
void | Serialize (BinaryWriter writer, ItemSerializationContext context) |
TagCompound | SerializeData () |
void | SetDefaults (int Type, bool noMatCheck=false) |
void | SetDefaults (int Type=0) |
void | SetDefaults1 (int type) |
void | SetDefaults2 (int type) |
void | SetDefaults3 (int type) |
void | SetDefaults4 (int type) |
void | SetDefaults5 (int type) |
void | SetNameOverride (string name) |
void | SetShopValues (ItemRarityColor rarity, int coinValue) |
void | SetWeaponValues (int dmg, float knockback, int bonusCritChance=0) |
override string | ToString () |
void | TryCombiningIntoNearbyItems (int i) |
bool | TryGetGlobalItem< T > (out T result, bool exactType=true) |
Gets the instance of the specified GlobalItem type. More... | |
bool | TryGetGlobalItem< T > (T baseInstance, out T result) |
Safely attempts to get the local instance of the type of the specified GlobalItem instance. More... | |
void | TurnToAir () |
void | UpdateItem (int i) |
Public Member Functions inherited from Terraria.Entity | |
float | AngleFrom (Vector2 Source) |
float | AngleTo (Vector2 Destination) |
Vector2 | DirectionFrom (Vector2 Source) |
Vector2 | DirectionTo (Vector2 Destination) |
float | Distance (Vector2 Other) |
float | DistanceSQ (Vector2 Other) |
IEntitySource | GetSource_Accessory (Item item, string? context=null) |
IEntitySource | GetSource_CatchEntity (Entity caughtEntity, string? context=null) |
IEntitySource | GetSource_Death (string? context=null) |
IEntitySource | GetSource_DropAsItem (string? context=null) |
IEntitySource | GetSource_FromAI (string? context=null) |
IEntitySource | GetSource_FromThis (string? context=null) |
IEntitySource | GetSource_GiftOrReward (string? context=null) |
IEntitySource | GetSource_ItemUse (Item item, string? context=null) |
IEntitySource | GetSource_ItemUse_WithPotentialAmmo (Item item, int ammoItemId, string? context=null) |
IEntitySource | GetSource_Loot (string? context=null) |
IEntitySource | GetSource_Misc (string context) |
IEntitySource | GetSource_OnHit (Entity victim, string? context=null) |
IEntitySource | GetSource_OnHurt (Entity attacker, string? context=null) |
IEntitySource | GetSource_OpenItem (int itemType, string? context=null) |
IEntitySource | GetSource_ReleaseEntity (string? context=null) |
IEntitySource | GetSource_TileInteraction (int tileCoordsX, int tileCoordsY, string? context=null) |
bool | WithinRange (Vector2 Target, float MaxRange) |
TagCompound | SerializeData () |
Static Public Member Functions | |
static int | BannerToItem (int banner) |
static int | BannerToNPC (int i) |
static int | buyPrice (int platinum=0, int gold=0, int silver=0, int copper=0) |
static void | DropCache (IEntitySource reason, Vector2 pos, Vector2 spread, int t, bool stopCaching=true) |
static Rectangle | GetDrawHitbox (int type, Player user) |
static bool | IsAGolfingItem (Item item) |
static bool | MechSpawn (float x, float y, int type) |
static int | NewItem (IEntitySource source, int X, int Y, int Width, int Height, int Type, int Stack=1, bool noBroadcast=false, int pfix=0, bool noGrabDelay=false, bool reverseLookup=false) |
Spawns an item into the game world with the given type and stack size. The X, Y, Width, and Height parameters dictate a rectangle, the item will be spawned centered within that rectangle. Other overloads support passing in a position directly, or just use 0 for Width and Height if the center is passed in a X and Y. This method should not be called on multiplayer clients. If you need to spawn items from client code, use Player.QuickSpawnItem(IEntitySource, int, int) instead, it handles the multiplayer syncing code needed. See the noBroadcast documentation if you need to customize attached ModItem or GlobalItem data prior to syncing. The source represents the entity causing this item to spawn. The return value is the index of the spawned Item within the Main.item array. More... | |
static int | NewItem (IEntitySource source, int X, int Y, int Width, int Height, Item item, bool noBroadcast=false, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses an Item instead of just the item type. All modded data will be preserved. More... | |
static int | NewItem (IEntitySource source, Rectangle rectangle, int Type, int Stack=1, bool noBroadcast=false, int prefixGiven=0, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses a Rectangle instead of X, Y, Width, and Height to determine the actual spawn position. More... | |
static int | NewItem (IEntitySource source, Rectangle rectangle, Item item, bool noBroadcast=false, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses an Item instead of just the item type. All modded data will be preserved. This particular overload uses a Rectangle instead of X, Y, Width, and Height to determine the actual spawn position. More... | |
static int | NewItem (IEntitySource source, Vector2 pos, int Width, int Height, int Type, int Stack=1, bool noBroadcast=false, int prefixGiven=0, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position. More... | |
static int | NewItem (IEntitySource source, Vector2 pos, int Width, int Height, Item item, bool noBroadcast=false, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses an Item instead of just the item type. All modded data will be preserved. This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position. More... | |
static int | NewItem (IEntitySource source, Vector2 pos, Vector2 randomBox, int Type, int Stack=1, bool noBroadcast=false, int prefixGiven=0, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses two Vector2 to determine the actual spawn position. More... | |
static int | NewItem (IEntitySource source, Vector2 pos, Vector2 randomBox, Item item, bool noBroadcast=false, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses an Item instead of just the item type. All modded data will be preserved. This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position. More... | |
static int | NewItem (IEntitySource source, Vector2 position, int Type, int Stack=1, bool noBroadcast=false, int prefixGiven=0, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses a Vector2 instead of X, Y, Width, and Height to determine the actual spawn position. More... | |
static int | NewItem (IEntitySource source, Vector2 position, Item item, bool noBroadcast=false, bool noGrabDelay=false, bool reverseLookup=false) |
This particular overload uses an Item instead of just the item type. All modded data will be preserved. This particular overload uses a Vector2 instead of X, Y, Width, and Height to determine the actual spawn position. More... | |
static int | NPCtoBanner (int i) |
static int | sellPrice (int platinum=0, int gold=0, int silver=0, int copper=0) |
static void | StartCachingType (int t) |
Static Public Member Functions inherited from Terraria.Entity | |
static IEntitySource | GetSource_NaturalSpawn () |
static ? IEntitySource | GetSource_None () |
static IEntitySource | GetSource_TownSpawn () |
static ? IEntitySource | InheritSource (Entity entity) |
Public Attributes | |
bool | accessory |
int | alpha |
int | ammo = AmmoID.None |
bool | autoReuse |
int | axe |
sbyte | backSlot = -1 |
int | bait |
The numerical value this item adds to a player's fishing skill when used as bait. If greater than 0, categorizes this item as bait. Bait can be put into ammo slots and is consumed when fishing. The higher the value of bait , the lower the chance the bait is consumed.Defaults to 0. | |
sbyte | balloonSlot = -1 |
sbyte | beardSlot = -1 |
bool | beingGrabbed |
If true, then this item is currently being grabbed by a player. Items being grabbed by the player cannot combine with nearby items, be picked up by enemies, burn in lava, or despawn. | |
string | BestiaryNotes |
int | bodySlot = -1 |
int | buffTime |
int | buffType |
bool | buy |
bool | buyOnce |
bool | canBePlacedInVanityRegardlessOfConditions |
bool | cartTrack |
bool | channel |
Color | color |
bool | consumable |
int | createTile = -1 |
int | createWall = -1 |
int | crit |
int | damage |
bool | DD2Summon |
If true, the given item is categorized as a Dungeon Defenders 2 summon item. DD2 summon items get a counter for how much Etherian Mana is in the player's inventory. This field being set does not make the item consume Etherian Mana. Etherian Mana consumption is handled manually per-type. Defaults to false . | |
int | defense |
int | dye |
The numerical ID of the armor shader in GameShaders.Armor this item activates when worn in a dye slot. If greater than 0, then this item can be equipped into dye slots. Defaults to -1. | |
bool | expert |
If true, then the given item is automatically given the Expert rarity, causing its name to be drawn in rainbow text. It also adds the "Expert" tooltip. To use the Expert rarity without adding this tooltip, see ItemRarityID.Expert. | |
bool | expertOnly |
If true, then the given item's effects only function in Expert Mode or higher (Main.expertMode). Specifically, any equipped, Expert-only accessory will not update, any Expert-only minecart will not be used when riding minecart tracks, and an 'X' will be drawn over the item when equipped. Unused in vanilla. | |
sbyte | faceSlot = -1 |
bool | favorited |
If true, then the given item is favorited. Favorited items cannot be dropped, automatically moved into chests, placed in any kind of item rack, sold, trashed, or sorted. Favorited items can still be dropped if the player has no inventory space and will still drop on death on Mediumcore or higher difficulties. An item becomes unfavorited if removed from the player's inventory, including if the item is move to any equipment slot. Defaults to false . | |
int | fishingPole = 1 |
The numerical value this item adds to a player's fishing skill when held. If greater than 0, categorizes this item as a fishing pole. Fishing poles can be placed into weapon racks, have a counter for the bait the player is carrying, and are held out when a bobber is active. Defaults to 0. | |
bool | flame |
sbyte | frontSlot = -1 |
short | glowMask |
int | hairDye = -1 |
int | hammer |
sbyte | handOffSlot = -1 |
sbyte | handOnSlot = -1 |
int | headSlot = -1 |
int | healLife |
int | healMana |
int | holdStyle |
bool | instanced |
If true, then the given item is instanced per-client. Instanced items only appear on the client they were spawned on and are less likely to be replaced if a new item is spawned. Instanced items do not exist on servers. Vanilla uses this field for treasure bags and Defender Medals. tModLoader automatically handles this for modded treasure bags. If you would like to make an instanced item, see any one of the following for examples: More... | |
bool | isAShopItem |
If true, then the given item is being sold in a shop. Shop items display their price. See value. | |
int | keepTime |
float | knockBack |
int | legSlot = -1 |
int | lifeRegen |
int | makeNPC |
The numerical ID of the NPC that this item creates when used. Mainly used for caught critters as items so that they can be released into the world. | |
int | mana |
int | manaIncrease |
bool | master |
If true, then the given item is automatically given the Master rarity, causing its name to be drawn in red-orange text. It also adds the "Master" tooltip. To use the Master rarity without adding this tooltip, see ItemRarityID.Master. | |
bool | masterOnly |
If true, then the given item's effects only function in Master Mode or higher (Main.masterMode). Specifically, any equipped, Master-only accessory will not update, any Master-only minecart will not be used when riding minecart tracks, and an 'X' will be drawn over the item when equipped. Unused in vanilla. | |
bool | material |
int | maxStack |
bool | mech |
If true, then the given item will show all placed wires and actuators when held. This item will also be grouped with other items with mech set to true when the inventory is sorted.Defaults to false . | |
int | mountType = -1 |
sbyte | neckSlot = -1 |
int | netID |
bool | newAndShiny |
int | noGrabDelay |
The delay, in ticks, before players can pick up this item. Usually set to 100 (approximately 1.666... seconds) whenever an item is dropped. Set to 0 whenever an item drops from a projectile. | |
bool | noMelee |
bool | notAmmo |
bool | noUseGraphic |
bool | noWet |
int | ownIgnore = -1 |
int | ownTime |
byte | paint |
The numerical ID of the paint applied by this item when used with a paint brush or paint roller. For conversion into a shader index, see Main.ConvertPaintIdToTileShaderIndex. For more details regarding paint, see Tile.TileColor and Tile.WallColor. Defaults to 0. | |
int | pick |
int | placeStyle |
int | playerIndexTheItemIsReservedFor = 255 |
bool | potion |
int | prefix |
bool | questItem |
If true, categorizes the given item as a quest fish. Quest fish get a special tooltip, their own category in the Research Menu, and cannot be auto-moved to the Void Vault when picked up. If you'd like to make a quest fish, see DefaultToQuestFish. If you'd just like to emulate the one-per-inventory behavior of quest fish, see uniqueStack. Defaults to false . | |
int | rare |
int | reuseDelay |
float | scale = 1f |
bool | sentry |
sbyte | shieldSlot = -1 |
sbyte | shoeSlot = -1 |
int | shoot |
float | shootSpeed |
int? | shopCustomPrice |
If not null , the custom value of the given item when being bought from a shop.Used for assigning a non-default price to an item in shops. To get the raw price of an item, use GetStoreValue. To get the price of an item after discounts, use Player.GetItemExpectedPrice. Defaults to null . | |
int | shopSpecialCurrency = -1 |
The numerical ID of the special currency this item is bought using. To make an item bought using Defender Medals, set this to CustomCurrencyID.DefenderMedals. Defaults to -1, which means an item is bought using coins. | |
bool | social |
int | stack |
int | stringColor |
int | tileBoost |
int | tileWand = -1 |
The numerical ID of the item this item consumes when used. If greater than 0, this item cannot be used unless the player has the item type tileWand is set to. The item also gains a counter for said item type.Defaults to -1. | |
int | timeLeftInWhichTheItemCannotBeTakenByEnemies |
int | timeSinceItemSpawned |
A value that increases every tick an item is in the world. Defaults to the value in ItemID.Sets.NewItemSpawnPriority when an item is created, and increases by ItemID.Sets.ItemSpawnDecaySpeed every tick. When creating new items, items with a high timeSinceItemSpawned value will be replaced if no empty item slots are available. | |
int | timeSinceTheItemHasBeenReservedForSomeone |
ItemTooltip | ToolTip |
int | tooltipContext = -1 |
The context in which this item's tooltip is being drawn. See ItemSlot.Context for more details. Defaults to -1. | |
int | type |
bool | uniqueStack |
Players cannot pick up a uniqueStack item if they have an item with the same type in their inventory.This does not apply to equipped items, nor does it apply to items held with the mouse (Main.mouseItem). This field only prevents picking items up: Multiple uniqueStack items may still be transferred into the player's inventory from chests.Defaults to false . | |
int | useAmmo = AmmoID.None |
int | useAnimation |
SoundStyle? | UseSound |
int | useStyle |
int | useTime |
bool | useTurn |
int | value |
bool | vanity |
sbyte | waistSlot = -1 |
sbyte | wingSlot = -1 |
bool | wornArmor |
If true, then this item is in the local player's armor slots. This causes the item to gain the set bonus tooltip if Player.setBonus isn't an empty string. Defaults to false . | |
Public Attributes inherited from Terraria.Entity | |
bool | active |
int | direction = 1 |
int | height |
bool | honeyWet |
bool | lavaWet |
int | oldDirection |
Vector2 | oldPosition |
Vector2 | oldVelocity |
Vector2 | position |
Vector2 | velocity |
bool | wet |
byte | wetCount |
int | whoAmI |
int | width |
Static Public Attributes | |
static int[] | bodyType = new int[246] |
An array for converting an bodySlot value into a type value. Indexed by bodySlot. Defaults to 0. | |
static int[] | cachedItemSpawnsByType = ItemID.Sets.Factory.CreateIntSet(-1) |
The number of cached item spawns by type. A value of -1 means that an item type is not being cached. See StartCachingType and DropCache for more info. Indexed by type.Defaults to -1. | |
static bool[] | claw = new bool[5125] |
If true, categorizes the given item type as a claw. Claws are held differently when their useStyle is ItemUseStyleID.Swing, but are otherwise no different than any other item. Used exclusively by the Bladed Glove in vanilla. Indexed by type. Defaults to false . | |
static int | coinGrabRange = 350 |
The additional distance, in pixels, that coins may be grabbed from if the player has the Gold Ring or its upgrades (Player.goldRing). Applies to ItemID.CopperCoin, ItemID.SilverCoin, ItemID.GoldCoin, and ItemID.PlatinumCoin. | |
const int | copper = 1 |
static readonly Func< TagCompound, Item > | DESERIALIZER = ItemIO.Load |
const int | flaskTime = 72000 |
const int | gold = 10000 |
const int | goldCritterRarityColor = 3 |
static int[] | headType = new int[277] |
An array for converting an headSlot value into a type value. Indexed by headSlot. Defaults to 0. | |
static int[] | legType = new int[234] |
An array for converting an legSlot value into a type value. Indexed by legSlot. Defaults to 0. | |
static int | lifeGrabRange = 250 |
The additional distance, in pixels, that mana stars may be grabbed from if the player has consumed a Heartreach Potion (Player.lifeMagnet). Applies to ItemID.Heart, ItemID.CandyApple, and ItemID.CandyCane. | |
const int | luckPotionDuration1 = 10800 |
const int | luckPotionDuration2 = 18000 |
const int | luckPotionDuration3 = 36000 |
static int | manaGrabRange = 300 |
The additional distance, in pixels, that mana stars may be grabbed from if the player has the Celestial Magnet or its upgrades (Player.manaMagnet). Applies to ItemID.Star, ItemID.SoulCake, and ItemID.SugarPlum. | |
static int | mushroomDelay = 1800 |
The default cooldown, in ticks, of Mushrooms. This value is never changed. For creating a Philosopher's Stone-like item, see Player.pStone or Player.mushroomDelayTime. | |
static int | numberOfNewItems = 0 |
const int | platinum = 1000000 |
static int | potionDelay = 3600 |
The default cooldown, in ticks, of most healing items. This value is never changed. For creating a Philosopher's Stone-like item, see Player.pStone or Player.potionDelayTime. | |
static int | restorationDelay = 2700 |
The default cooldown, in ticks, of Restoration Potions. This value is never changed. For creating a Philosopher's Stone-like item, see Player.pStone or Player.restorationDelayTime. | |
const int | silver = 100 |
static bool[] | staff = new bool[5125] |
If true, categorizes the given item type as a staff. Staffs are held differently when their useStyle is ItemUseStyleID.Shoot, but are otherwise no different than any other item. Indexed by type. Defaults to false . | |
static int | treasureGrabRange = 150 |
The additional distance, in pixels, that items may be grabbed from if the player has equipped a Treasure Magnet (Player.treasureMagnet). | |
const int | WALL_PLACEMENT_USETIME = 7 |
Properties | |
bool | AllowReforgeForStackableItem [get, set] |
Set to true in SetDefaults to allow this item to receive a prefix on reforge even if maxStack is not 1. This prevents it from receiving a prefix on craft. | |
int | ArmorPenetration [get, set] |
The number of defense points that this item can ignore on its own. Cannot be set to negative values. Defaults to 0. | |
bool | attackSpeedOnlyAffectsWeaponAnimation [get, set] |
Dictates whether or not attack speed modifiers on this weapon will actually affect its use time. Defaults to false, which allows attack speed modifiers to affect use time. Set this to true to prevent this from happening. Used in vanilla by all melee weapons which shoot a projectile and have noMelee set to false. | |
bool | CanBeQuickUsed [get] |
bool | consumeAmmoOnFirstShotOnly [get, set] |
Dictates whether or not this item should only consume ammo on its first shot of each use. Defaults to false. Used in vanilla by the following: More... | |
bool | consumeAmmoOnLastShotOnly [get, set] |
Dictates whether or not this item should only consume ammo on its last shot of each use. Defaults to false. Used in vanilla by the following: More... | |
DamageClass | DamageType [get, set] |
The damage type of this Item. Assign to DamageClass.Melee/Ranged/Magic/Summon/Throwing for vanilla classes, or ModContent.GetInstance for custom damage types. | |
bool | FitsAccessoryVanitySlot [get] |
RefReadOnlyArray< Instanced< GlobalItem > > | Globals [get] |
string | HoverName [get] |
bool | InterruptChannelOnHurt [get, set] |
When enabled and the player is hurt, Player.channel will be set to false | |
bool | IsACoin [get] |
bool | IsAir [get] |
bool | IsCandidateForReforge [get] |
Used to make stackable items reforgeable | |
bool | IsCurrency [get] |
ModItem | ModItem [get, set] |
string | Name [get] |
int | OriginalDamage [get] |
int | OriginalDefense [get] |
int | OriginalRarity [get] |
List< Mod > | StatsModifiedBy = new() [get] |
bool | StopAnimationOnHurt [get, set] |
When enabled and the player is hurt, Player.channel will be set to false, and the item animation will stop immediately | |
int? | useLimitPerAnimation [get, set] |
Dictates the amount of times a weapon can be used (shot, etc) each time it animates (is swung, clicked, etc). Defaults to null. Used in vanilla by the following: More... | |
Properties inherited from Terraria.Entity | |
Vector2 | Bottom [get, set] |
Vector2 | BottomLeft [get, set] |
Vector2 | BottomRight [get, set] |
Vector2 | Center [get, set] |
Rectangle | Hitbox [get, set] |
Vector2 | Left [get, set] |
Vector2 | Right [get, set] |
Vector2 | Size [get, set] |
Vector2 | Top [get, set] |
Vector2 | TopLeft [get, set] |
Vector2 | TopRight [get, set] |
virtual Vector2 | VisualPosition [get] |
Properties inherited from Terraria.ModLoader.IEntityWithGlobals< GlobalItem > | |
RefReadOnlyArray< Instanced< T > > | Globals [get] |
bool Terraria.Item.CountsAsClass< T > | ( | ) |
T | : | DamageClass | |
T | : | CountsAsClass | |
T | : | ModContent.GetInstance<T>() |
void Terraria.Item.DefaultToBow | ( | int | singleShotTime, |
float | shotVelocity, | ||
bool | hasAutoReuse = false |
||
) |
This method sets a variety of common Item values common to bow weapons.
Specifically: width = 14; height = 30; UseSound = SoundID.Item5;
Addtionally:
singleShotTime | |
shotVelocity | |
hasAutoReuse |
void Terraria.Item.DefaultToFood | ( | int | newwidth, |
int | newheight, | ||
int | foodbuff, | ||
int | foodbuffduration, | ||
bool | useGulpSound = false , |
||
int | animationTime = 17 |
||
) |
This method sets a variety of common Item values common to food items.
Specifically: UseSound = useGulpSound ? Item3 : Item2; useStyle = useGulpSound ? DrinkLiquid : EatFood;
useTurn = true; useAnimation = useTime = animationTime; maxStack = 30; consumable = true;
buffType = foodbuff; buffTime = foodbuffduration; rare = Blue; value = 20 silver;
newwidth | |
newheight | |
foodbuff | |
foodbuffduration | |
useGulpSound | If true, the gulp sound is set, otherwise the crunch sound is set |
animationTime |
void Terraria.Item.DefaultToPlacableWall | ( | ushort | wallToPlace | ) |
This method sets a variety of common Item values common to placeable walls.
Specifically: useStyle = 1; useTurn = true; useAnimation = 15; useTime = 7; autoReuse = true; maxStack = 999; consumable = true; createWall = wallToPlace; width = 12; height = 12;
wallToPlace |
void Terraria.Item.DefaultToRangedWeapon | ( | int | baseProjType, |
int | ammoID, | ||
int | singleShotTime, | ||
float | shotVelocity, | ||
bool | hasAutoReuse = false |
||
) |
This method sets a variety of common Item values common to ranged weapons.
Specifically: autoReuse = hasAutoReuse; useStyle = 5; useAnimation = singleShotTime; useTime = singleShotTime; shoot = baseProjType; useAmmo = ammoID; shootSpeed = shotVelocity; noMelee = true; ranged = true;
baseProjType | |
ammoID | |
singleShotTime | |
shotVelocity | |
hasAutoReuse |
T Terraria.Item.GetGlobalItem< T > | ( | bool | exactType = true | ) |
Gets the instance of the specified GlobalItem type. This will throw exceptions on failure.
KeyNotFoundException |
|
T | : | GlobalItem | |
T | : | GlobalType.GetGlobal | |
T | : | Item | |
T | : | GlobalItem | |
T | : | T | |
T | : | globalItems | |
T | : | exactType |
T Terraria.Item.GetGlobalItem< T > | ( | T | baseInstance | ) |
Gets the local instance of the type of the specified GlobalItem instance. This will throw exceptions on failure.
KeyNotFoundException |
|
T | : | GlobalItem | |
T | : | GlobalType.GetGlobal | |
T | : | Item | |
T | : | GlobalItem | |
T | : | T | |
T | : | globalItems | |
T | : | baseInstance |
|
static |
Spawns an item into the game world with the given type and stack size. The X, Y, Width, and Height parameters dictate a rectangle, the item will be spawned centered within that rectangle. Other overloads support passing in a position directly, or just use 0 for Width and Height if the center is passed in a X and Y. This method should not be called on multiplayer clients. If you need to spawn items from client code, use Player.QuickSpawnItem(IEntitySource, int, int) instead, it handles the multiplayer syncing code needed. See the noBroadcast documentation if you need to customize attached ModItem or GlobalItem data prior to syncing. The source represents the entity causing this item to spawn. The return value is the index of the spawned Item within the Main.item array.
source | |
X | |
Y | |
Width | |
Height | |
Type | Either an ItemID entry or ModContent.ItemType<T>, for example ItemID.IronskinPotion or ModContent.ItemType<MyModItem>() |
Stack | Item stack |
noBroadcast | Controls whether an item spawned on a server is synced using NetMessage.SendData and MessageID.SyncItem. If false, the item will be synced. If true, the calling code can modify the item instance and then sync the item with MessageID.SyncItem. Has no effect except on server. NewItem running on multiplayer clients always needs to manually sync, see Player.QuickSpawnItem(IEntitySource, int, int) source code for an example. |
pfix | |
noGrabDelay | |
reverseLookup |
|
static |
This particular overload uses an Item instead of just the item type. All modded data will be preserved.
|
static |
This particular overload uses a Rectangle instead of X, Y, Width, and Height to determine the actual spawn position.
|
static |
This particular overload uses an Item instead of just the item type. All modded data will be preserved.
This particular overload uses a Rectangle instead of X, Y, Width, and Height to determine the actual spawn position.
|
static |
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position.
|
static |
This particular overload uses an Item instead of just the item type. All modded data will be preserved.
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position.
|
static |
This particular overload uses two Vector2 to determine the actual spawn position.
|
static |
This particular overload uses an Item instead of just the item type. All modded data will be preserved.
This particular overload uses a Vector2 instead of X and Y to determine the actual spawn position.
|
static |
This particular overload uses a Vector2 instead of X, Y, Width, and Height to determine the actual spawn position.
|
static |
This particular overload uses an Item instead of just the item type. All modded data will be preserved.
This particular overload uses a Vector2 instead of X, Y, Width, and Height to determine the actual spawn position.
TagCompound Terraria.Item.SerializeData | ( | ) |
Implements Terraria.ModLoader.IO.TagSerializable.
bool Terraria.Item.TryGetGlobalItem< T > | ( | out T | result, |
bool | exactType = true |
||
) |
Gets the instance of the specified GlobalItem type.
T | : | GlobalItem | |
T | : | GlobalType.TryGetGlobal | |
T | : | globalItems | |
T | : | exactType | |
T | : | out | |
T | : | result |
bool Terraria.Item.TryGetGlobalItem< T > | ( | T | baseInstance, |
out T | result | ||
) |
Safely attempts to get the local instance of the type of the specified GlobalItem instance.
T | : | GlobalItem | |
T | : | GlobalType.TryGetGlobal | |
T | : | globalItems | |
T | : | baseInstance | |
T | : | out | |
T | : | result |
bool Terraria.Item.instanced |
If true, then the given item is instanced per-client.
Instanced items only appear on the client they were spawned on and are less likely to be replaced if a new item is spawned.
Instanced items do not exist on servers.
Vanilla uses this field for treasure bags and Defender Medals. tModLoader automatically handles this for modded treasure bags.
If you would like to make an instanced item, see any one of the following for examples:
|
getset |
Dictates whether or not this item should only consume ammo on its first shot of each use.
Defaults to false.
Used in vanilla by the following:
|
getset |
Dictates whether or not this item should only consume ammo on its last shot of each use.
Defaults to false.
Used in vanilla by the following:
|
getset |
Dictates the amount of times a weapon can be used (shot, etc) each time it animates (is swung, clicked, etc).
Defaults to null.
Used in vanilla by the following: