TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ UpdateItem()

void Terraria.Item.UpdateItem ( int i)
inline

Definition at line 49933 of file Item.cs.

49934 {
49935 //IL_0125: Unknown result type (might be due to invalid IL or missing references)
49936 //IL_012f: Unknown result type (might be due to invalid IL or missing references)
49937 //IL_0134: Unknown result type (might be due to invalid IL or missing references)
49938 //IL_014a: Unknown result type (might be due to invalid IL or missing references)
49939 //IL_0154: Unknown result type (might be due to invalid IL or missing references)
49940 //IL_0159: Unknown result type (might be due to invalid IL or missing references)
49941 //IL_0171: Unknown result type (might be due to invalid IL or missing references)
49942 //IL_017b: Unknown result type (might be due to invalid IL or missing references)
49943 //IL_0180: Unknown result type (might be due to invalid IL or missing references)
49944 //IL_0358: Unknown result type (might be due to invalid IL or missing references)
49945 //IL_01f6: Unknown result type (might be due to invalid IL or missing references)
49946 //IL_0219: Unknown result type (might be due to invalid IL or missing references)
49947 //IL_021f: Unknown result type (might be due to invalid IL or missing references)
49948 //IL_0297: Unknown result type (might be due to invalid IL or missing references)
49949 //IL_02a1: Unknown result type (might be due to invalid IL or missing references)
49950 //IL_02a6: Unknown result type (might be due to invalid IL or missing references)
49951 //IL_03d8: Unknown result type (might be due to invalid IL or missing references)
49952 //IL_03ec: Unknown result type (might be due to invalid IL or missing references)
49953 //IL_02e4: Unknown result type (might be due to invalid IL or missing references)
49954 //IL_02e9: Unknown result type (might be due to invalid IL or missing references)
49955 //IL_0307: Unknown result type (might be due to invalid IL or missing references)
49956 //IL_030c: Unknown result type (might be due to invalid IL or missing references)
49957 //IL_032a: Unknown result type (might be due to invalid IL or missing references)
49958 //IL_032f: Unknown result type (might be due to invalid IL or missing references)
49959 //IL_0648: Unknown result type (might be due to invalid IL or missing references)
49960 //IL_064e: Unknown result type (might be due to invalid IL or missing references)
49961 //IL_0653: Unknown result type (might be due to invalid IL or missing references)
49962 //IL_0658: Unknown result type (might be due to invalid IL or missing references)
49963 //IL_0634: Unknown result type (might be due to invalid IL or missing references)
49964 //IL_0639: Unknown result type (might be due to invalid IL or missing references)
49965 //IL_063a: Unknown result type (might be due to invalid IL or missing references)
49966 //IL_063f: Unknown result type (might be due to invalid IL or missing references)
49967 //IL_034d: Unknown result type (might be due to invalid IL or missing references)
49968 //IL_0352: Unknown result type (might be due to invalid IL or missing references)
49969 whoAmI = i;
49970 if (Main.timeItemSlotCannotBeReusedFor[i] > 0)
49971 {
49972 if (Main.netMode == 2)
49973 {
49974 Main.timeItemSlotCannotBeReusedFor[i]--;
49975 return;
49976 }
49977 Main.timeItemSlotCannotBeReusedFor[i] = 0;
49978 }
49979 if (!active)
49980 {
49981 return;
49982 }
49983 if (instanced)
49984 {
49985 if (Main.netMode == 2)
49986 {
49987 active = false;
49988 return;
49989 }
49990 keepTime = 6000;
49991 ownTime = 0;
49992 noGrabDelay = 0;
49993 playerIndexTheItemIsReservedFor = Main.myPlayer;
49994 }
49995 if (Main.netMode == 0)
49996 {
49997 playerIndexTheItemIsReservedFor = Main.myPlayer;
49998 }
49999 float gravity = 0.1f;
50000 float maxFallSpeed = 7f;
50001 if (Main.netMode == 1)
50002 {
50003 int num = (int)(position.X + (float)(width / 2)) / 16;
50004 int num2 = (int)(position.Y + (float)(height / 2)) / 16;
50005 if (num >= 0 && num2 >= 0 && num < Main.maxTilesX && num2 < Main.maxTilesY && !Main.sectionManager.TileLoaded(num, num2))
50006 {
50007 gravity = 0f;
50008 velocity.X = 0f;
50009 velocity.Y = 0f;
50010 }
50011 }
50012 Vector2 wetVelocity = velocity * 0.5f;
50013 if (shimmerWet)
50014 {
50015 gravity = 0.065f;
50016 maxFallSpeed = 4f;
50017 wetVelocity = velocity * 0.375f;
50018 }
50019 else if (honeyWet)
50020 {
50021 gravity = 0.05f;
50022 maxFallSpeed = 3f;
50023 wetVelocity = velocity * 0.25f;
50024 }
50025 else if (wet)
50026 {
50027 gravity = 0.08f;
50028 maxFallSpeed = 5f;
50029 }
50030 if (ownTime > 0)
50031 {
50032 ownTime--;
50033 }
50034 else
50035 {
50036 ownIgnore = -1;
50037 }
50038 if (keepTime > 0)
50039 {
50040 keepTime--;
50041 }
50042 if (!beingGrabbed)
50043 {
50044 if (shimmered)
50045 {
50046 if (Main.rand.Next(30) == 0)
50047 {
50048 int num3 = Dust.NewDust(position, width, height, 309);
50049 Main.dust[num3].position.X += Main.rand.Next(-8, 5);
50050 Main.dust[num3].position.Y += Main.rand.Next(-8, 5);
50051 Main.dust[num3].scale *= 1.1f;
50052 Dust obj = Main.dust[num3];
50053 obj.velocity *= 0.3f;
50054 switch (Main.rand.Next(6))
50055 {
50056 case 0:
50057 Main.dust[num3].color = new Color(255, 255, 210);
50058 break;
50059 case 1:
50060 Main.dust[num3].color = new Color(190, 245, 255);
50061 break;
50062 case 2:
50063 Main.dust[num3].color = new Color(255, 150, 255);
50064 break;
50065 default:
50066 Main.dust[num3].color = new Color(190, 175, 255);
50067 break;
50068 }
50069 }
50070 Lighting.AddLight(base.Center, (1f - shimmerTime) * 0.8f, (1f - shimmerTime) * 0.8f, (1f - shimmerTime) * 0.8f);
50071 gravity = 0f;
50072 if (shimmerWet)
50073 {
50074 if (velocity.Y > -4f)
50075 {
50076 velocity.Y -= 0.05f;
50077 }
50078 }
50079 else
50080 {
50081 int num4 = 2;
50082 int num5 = (int)(base.Center.X / 16f);
50083 int num6 = (int)(base.Center.Y / 16f);
50084 bool flag = false;
50085 for (int j = num6; j < num6 + num4; j++)
50086 {
50087 if (WorldGen.InWorld(num5, j) && Main.tile[num5, j] != null && Main.tile[num5, j].shimmer() && Main.tile[num5, j].liquid > 0)
50088 {
50089 flag = true;
50090 break;
50091 }
50092 }
50093 if (flag)
50094 {
50095 if (velocity.Y > -4f)
50096 {
50097 velocity.Y -= 0.05f;
50098 }
50099 }
50100 else
50101 {
50102 velocity.Y *= 0.9f;
50103 }
50104 }
50105 }
50106 if (shimmerWet && !shimmered)
50107 {
50108 Shimmering();
50109 }
50110 else if (shimmerTime > 0f)
50111 {
50112 shimmerTime -= 0.01f;
50113 if (shimmerTime < 0f)
50114 {
50115 shimmerTime = 0f;
50116 }
50117 }
50118 if (shimmerTime == 0f)
50119 {
50121 }
50123 {
50125 }
50126 if (timeLeftInWhichTheItemCannotBeTakenByEnemies == 0 && Main.netMode != 2 && playerIndexTheItemIsReservedFor == Main.myPlayer)
50127 {
50129 if (Main.expertMode && IsACoin)
50130 {
50132 }
50133 }
50134 MoveInWorld(gravity, maxFallSpeed, ref wetVelocity, i);
50135 if (lavaWet)
50136 {
50137 CheckLavaDeath(i);
50138 }
50140 }
50141 else
50142 {
50143 beingGrabbed = false;
50144 }
50146 if (timeSinceItemSpawned < 2147483547)
50147 {
50150 }
50151 ItemLoader.PostUpdate(this);
50152 if (Main.netMode == 2 && playerIndexTheItemIsReservedFor != Main.myPlayer)
50153 {
50156 {
50158 NetMessage.SendData(39, playerIndexTheItemIsReservedFor, -1, null, i);
50160 }
50161 }
50162 if (wet)
50163 {
50165 }
50166 else
50167 {
50168 position += velocity;
50169 }
50170 if (noGrabDelay > 0)
50171 {
50172 noGrabDelay--;
50173 }
50174 }
bool wet
The Entity is currently in water. Projectile: Affects movement speed and some projectiles die when ...
Definition Entity.cs:57
bool honeyWet
Definition Entity.cs:61
bool shimmerWet
Definition Entity.cs:59
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
bool active
If true, the Entity actually exists within the game world. Within the specific entity array,...
Definition Entity.cs:21
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static int[] ItemSpawnDecaySpeed
Determines the decay speed of the given item type (F:Terraria.Item.type). See F:Terraria....
Definition ItemID.cs:1283
int timeSinceTheItemHasBeenReservedForSomeone
Definition Item.cs:649
void CheckLavaDeath(int i)
Definition Item.cs:50280
void MoveInWorld(float gravity, float maxFallSpeed, ref Vector2 wetVelocity, int i)
Definition Item.cs:50360
void DespawnIfMeetingConditions(int i)
Definition Item.cs:50176
void Shimmering()
Definition Item.cs:49585
void TryCombiningIntoNearbyItems(int i)
Definition Item.cs:50252
bool IsACoin
Definition Item.cs:953
bool instanced
If true, then the given item is instanced per-client. Instanced items only appear on the client they...
Definition Item.cs:332
int playerIndexTheItemIsReservedFor
Definition Item.cs:578
int ownTime
Definition Item.cs:336
int timeLeftInWhichTheItemCannotBeTakenByEnemies
Definition Item.cs:340
float shimmerTime
Definition Item.cs:781
int noGrabDelay
The delay, in ticks, before players can pick up this item. Usually set to 100 (approximately 1....
Definition Item.cs:183
int ownIgnore
Definition Item.cs:334
void GetPickedUpByMonsters_Special(int i)
Definition Item.cs:50735
void UpdateItem_VisualEffects()
Definition Item.cs:50947
bool shimmered
Definition Item.cs:779
int keepTime
Definition Item.cs:338
bool beingGrabbed
If true, then this item is currently being grabbed by a player. Items being grabbed by the player ca...
Definition Item.cs:189
void GetPickedUpByMonsters_Money(int i)
Definition Item.cs:50772
int timeSinceItemSpawned
A value that increases every tick an item is in the world. Defaults to the value in F:Terraria....
Definition Item.cs:196
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
static void PostUpdate(Item item)
Calls ModItem.PostUpdate and all GlobalItem.PostUpdate hooks.
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26

References Terraria.Entity.active, Terraria.Lighting.AddLight(), Terraria.Item.beingGrabbed, Terraria.Item.CheckLavaDeath(), Terraria.Item.DespawnIfMeetingConditions(), Terraria.Main.dust, Terraria.Main.expertMode, Terraria.Item.GetPickedUpByMonsters_Money(), Terraria.Item.GetPickedUpByMonsters_Special(), Terraria.Entity.height, Terraria.Entity.honeyWet, Terraria.Item.instanced, Terraria.WorldGen.InWorld(), Terraria.Item.IsACoin, Terraria.ID.ItemID.Sets.ItemSpawnDecaySpeed, Terraria.Item.keepTime, Terraria.Entity.lavaWet, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Item.MoveInWorld(), Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Item.noGrabDelay, Terraria.Item.ownIgnore, Terraria.Item.ownTime, Terraria.Item.playerIndexTheItemIsReservedFor, Terraria.Entity.position, Terraria.ModLoader.ItemLoader.PostUpdate(), Terraria.Main.rand, Terraria.Main.sectionManager, Terraria.NetMessage.SendData(), Terraria.Item.shimmered, Terraria.Item.Shimmering(), Terraria.Item.shimmerTime, Terraria.Entity.shimmerWet, Terraria.Main.tile, Terraria.Main.timeItemSlotCannotBeReusedFor, Terraria.Item.timeLeftInWhichTheItemCannotBeTakenByEnemies, Terraria.Item.timeSinceItemSpawned, Terraria.Item.timeSinceTheItemHasBeenReservedForSomeone, Terraria.Item.TryCombiningIntoNearbyItems(), Terraria.Item.type, Terraria.Item.UpdateItem_VisualEffects(), Terraria.Entity.velocity, Terraria.Entity.wet, Terraria.Entity.whoAmI, and Terraria.Entity.width.

+ Here is the call graph for this function: