41834 {
41835
41836
41837
41838
41839
41840
41841
41842
41843
41844
41845
41846
41847
41848
41849
41850
41851
41852
41853
41854
41855
41856
41857
41858
41859
41860
41861
41862
41863
41864
41865
41866
41867
41868
41869
41870
41871
41872
41873
41874
41875
41876
41877
41878
41879
41880
41881
41882
41883
41884
41885
41886
41887
41888
41889
41890
41891
41892
41893
41894
41895
41896
41897
41898
41899
41900
41901
41902
41903
41904
41905
41906
41907
41908
41909
41910
41911
41912
41913
41914
41915
41916
41917
41918
41919
41920
41921
41922
41923
41924
41925
41926
41927
41928
41929
41930
41931
41932
41933
41934
41935
41936
41937
41938
41939
41940
41942 {
41945 return;
41946 }
41949 ItemCheckContext context = default(ItemCheckContext);
41951 if (Main.myPlayer ==
whoAmI)
41952 {
41954 {
41957 }
41959 {
41961 if (bait != null)
41962 {
41966 }
41967 }
41969 {
41970 for (int i = 54; i < 58; i++)
41971 {
41973 {
41977 break;
41978 }
41979 }
41981 {
41982 for (
int j = 0;
j < 54;
j++)
41983 {
41985 {
41989 break;
41990 }
41991 }
41992 }
41993 }
41994 }
41996 {
41999 {
42001 }
42002 }
42004 {
42007 {
42008 int type = item.type;
42009 if (type == 65 || type == 724 || type == 989 || type == 1226)
42010 {
42012 }
42013 }
42014 }
42016 {
42021 {
42025 }
42026 }
42032 {
42034 }
42036 {
42038 }
42040 {
42042 }
42045 {
42047 }
42050 {
42052 }
42054 {
42056 {
42058 }
42059 if (item.shoot == 0)
42060 {
42062 }
42064 if (item.potion &&
flag3)
42065 {
42067 }
42068 if (item.mana > 0 &&
flag3 &&
whoAmI == Main.myPlayer && item.buffType != 0 && item.buffTime != 0)
42069 {
42070 AddBuff(item.buffType, item.buffTime);
42071 }
42073 {
42075 }
42077 {
42079 }
42081 {
42083 }
42085 {
42087 }
42088 }
42091 {
42093 }
42095 {
42097 }
42100 compositeFrontArm.enabled = false;
42101 compositeBackArm.enabled = false;
42103 {
42104 if (item.mana > 0)
42105 {
42107 }
42108 if (Main.dedServ)
42109 {
42112 }
42113 else
42114 {
42117 }
42118 }
42122 {
42124 }
42125 else
42126 {
42128 }
42130 {
42138 {
42140 {
42142 }
42143 if (item.hairDye >= 0)
42144 {
42146 if (
whoAmI == Main.myPlayer)
42147 {
42149 NetMessage.SendData(4, -1, -1,
null,
whoAmI);
42150 }
42151 }
42152 if (item.healLife > 0 || item.healMana > 0)
42153 {
42156 if (Main.myPlayer ==
whoAmI && item.type == 126 &&
breath == 0)
42157 {
42159 }
42160 }
42161 if (item.buffType > 0)
42162 {
42163 if (
whoAmI == Main.myPlayer && item.buffType != 90 && item.buffType != 27)
42164 {
42165 AddBuff(item.buffType, item.buffTime);
42166 }
42168 }
42169 if (item.type == 678)
42170 {
42171 if (Main.getGoodWorld)
42172 {
42174 if (
whoAmI == Main.myPlayer)
42175 {
42176 for (
int k = 0;
k < 3;
k++)
42177 {
42180 switch (Main.rand.Next(18))
42181 {
42182 case 0:
42184 break;
42185 case 1:
42187 break;
42188 case 2:
42190 break;
42191 case 3:
42193 break;
42194 case 4:
42196 break;
42197 case 5:
42199 break;
42200 case 6:
42202 break;
42203 case 7:
42205 break;
42206 case 8:
42208 break;
42209 case 9:
42211 break;
42212 case 10:
42214 break;
42215 case 11:
42217 break;
42218 case 12:
42220 break;
42221 case 13:
42223 break;
42224 case 14:
42226 break;
42227 case 15:
42229 break;
42230 case 16:
42232 break;
42233 case 17:
42235 break;
42236 }
42238 }
42239 }
42240 }
42241 else
42242 {
42244 if (
whoAmI == Main.myPlayer)
42245 {
42257 }
42258 }
42259 }
42260 }
42261 if ((item.type == 50 || item.type == 3124 || item.type == 3199 || item.type == 5358) &&
itemAnimation > 0)
42262 {
42263 if (Main.rand.Next(2) == 0)
42264 {
42266 }
42268 {
42270 }
42272 {
42273 for (
int l = 0;
l < 70;
l++)
42274 {
42276 }
42279 for (
int m = 0;
m < 70;
m++)
42280 {
42282 }
42283 }
42284 }
42285 if ((item.type == 4263 || item.type == 5360) &&
itemAnimation > 0)
42286 {
42288 for (
int n = 0;
n < 2;
n++)
42289 {
42290 if (Main.rand.Next(3) == 0)
42291 {
42292 Dust dust = Dust.NewDustPerfect(
base.Bottom +
vector, Dust.dustWater());
42293 dust.velocity.Y *= 0
f;
42294 dust.velocity.Y -= 4.5f;
42295 dust.velocity.X *= 1.5f;
42296 dust.scale = 0.8f;
42297 dust.alpha = 130;
42298 dust.noGravity = true;
42299 dust.fadeIn = 1.1f;
42300 }
42301 }
42303 {
42305 }
42306 else if (
itemTime == item.useTime / 2)
42307 {
42308 if (Main.netMode == 0)
42309 {
42311 }
42312 else if (Main.netMode == 1 &&
whoAmI == Main.myPlayer)
42313 {
42314 NetMessage.SendData(73, -1, -1, null, 1);
42315 }
42316 }
42317 }
42318 if ((item.type == 4819 || item.type == 5361) &&
itemAnimation > 0)
42319 {
42322 {
42323 if (Main.rand.Next(3) == 0)
42324 {
42326 dust2.velocity.Y *= 0
f;
42327 dust2.velocity.Y -= 4.5f;
42328 dust2.velocity.X *= 1.5f;
42329 dust2.scale = 0.8f;
42330 dust2.alpha = 130;
42331 dust2.noGravity = true;
42332 dust2.fadeIn = 1.1f;
42333 }
42334 }
42336 {
42338 }
42339 else if (
itemTime == item.useTime / 2)
42340 {
42341 if (Main.netMode == 0)
42342 {
42344 }
42345 else if (Main.netMode == 1 &&
whoAmI == Main.myPlayer)
42346 {
42347 NetMessage.SendData(73, -1, -1, null, 2);
42348 }
42349 }
42350 }
42352 {
42353 if (Main.rand.Next(2) == 0)
42354 {
42355 int num8 = Main.rand.Next(4);
42356 Color color = Color.Green;
42358 {
42359 case 0:
42360 case 1:
42362 break;
42363 case 2:
42364 color = Color.Yellow;
42365 break;
42366 case 3:
42367 color = Color.White;
42368 break;
42369 }
42370 Dust
dust3 = Dust.NewDustPerfect(Main.rand.NextVector2FromRectangle(
base.Hitbox), 267);
42371 dust3.noGravity = true;
42372 dust3.color = color;
42373 dust3.velocity *= 2
f;
42374 dust3.scale = 0.8f + Main.rand.NextFloat() * 0.6f;
42375 }
42377 {
42379 }
42380 else if (
itemTime == item.useTime / 2)
42381 {
42382 if (Main.netMode == 0)
42383 {
42385 }
42386 else if (Main.netMode == 1 &&
whoAmI == Main.myPlayer)
42387 {
42388 NetMessage.SendData(73, -1, -1, null, 3);
42389 }
42390 }
42391 }
42393 {
42395 {
42399 {
42401 obj.velocity *= 0.5f;
42402 }
42403 }
42405 {
42408 {
42410 obj2.velocity *= 0.5f;
42411 }
42419 {
42421 obj3.velocity *= 0.5f;
42422 }
42424 {
42425 item.stack--;
42426 }
42427 }
42428 }
42430 {
42432 {
42436 {
42438 obj4.velocity *= 0.5f;
42439 }
42440 }
42442 {
42445 {
42447 obj5.velocity *= 0.5f;
42448 }
42449 if (
whoAmI == Main.myPlayer)
42450 {
42452 }
42454 {
42456 obj6.velocity *= 0.5f;
42457 }
42459 {
42460 item.stack--;
42461 }
42462 }
42463 }
42465 {
42467 {
42469 }
42471 {
42472 if (Main.netMode == 0)
42473 {
42475 }
42476 else if (Main.netMode == 1 &&
whoAmI == Main.myPlayer)
42477 {
42478 NetMessage.SendData(73);
42479 }
42481 {
42482 item.stack--;
42483 }
42484 }
42485 }
42487 {
42489 {
42491 }
42493 {
42494 if (
whoAmI == Main.myPlayer)
42495 {
42497 if (Main.netMode == 1)
42498 {
42499 NetMessage.SendData(4, -1, -1,
null,
whoAmI);
42500 }
42501 }
42503 {
42504 item.stack--;
42505 }
42506 }
42507 else
42508 {
42515 Vector2
vector4 =
default(Vector2);
42517 {
42520 {
42523 }
42528 Main.dust[
num6].noGravity =
true;
42529 Main.dust[
num6].velocity = Vector2.Zero;
42530 Main.dust[
num6].scale = 1.3f;
42531 Main.dust[
num6].customData =
this;
42532 }
42533 }
42534 }
42535 if (
whoAmI == Main.myPlayer)
42536 {
42538 {
42540 }
42541 }
42542 else
42543 {
42545 }
42546 if (
whoAmI == Main.myPlayer)
42547 {
42549 {
42552 {
42554 {
42556 {
42558 }
42560 {
42562 }
42563 break;
42564 }
42565 }
42566 }
42568 {
42570 if (item.ranged)
42571 {
42573 {
42575 }
42577 {
42579 }
42581 {
42583 }
42585 {
42587 }
42588 }
42590 {
42592 {
42594 }
42596 {
42598 }
42599 }
42600 if (item.IsACoin)
42601 {
42603 }
42605 if (
flag7.HasValue)
42606 {
42608 }
42610 {
42611 if (item.stack > 0)
42612 {
42613 item.stack--;
42614 }
42615 if (item.stack <= 0)
42616 {
42618 Main.blockMouse = true;
42619 }
42620 }
42621 }
42623 {
42625 }
42627 {
42628 Main.mouseItem = item.Clone();
42629 }
42630 }
42631 }
42633 {
42635 }
42637 {
42639 }
42640 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Vector2 position
The position of this Entity in world coordinates.
int width
The width of this Entity's hitbox, in pixels.
int height
The height of this Entity's hitbox, in pixels.
static void HandleSpecialEvent(Player player, int eventID)
static bool IsPlayerHoldingClub(Player player)
static ? bool[] ForceConsumption
If true for a given item type (F:Terraria.Item.type), then that item will always be consumed on use i...
static bool[] MinionTargettingFeature
If true for a given projectile type (F:Terraria.Projectile.type), then any item that shoots that proj...
static bool[] LightPet
If true for a given projectile type (F:Terraria.Projectile.type), then that projectile is a light pet...
static readonly SoundStyle Item3
SoundStyle? UseSound
The sound this item makes when used. Set this to an existing T:Terraria.ID.SoundID entry or assign to...
int tileWand
The numerical ID of the item this item consumes when used. If greater than 0, this item cannot be us...
int stack
The current stack of the item. F:Terraria.Item.maxStack indicates the max possible stack.
int useAmmo
The Ammo ID this weapon will consume. Ammo items with F:Terraria.Item.ammo set to this same AmmoID wi...
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
static DamageClass Throwing
Class provided for modders who want to coordinate throwing accessories and items. Not used by any van...
T:Terraria.ModLoader.DamageClass is used to determine the application of item effects,...
static void HoldItem(Item item, Player player)
Calls ModItem.HoldItem and all GlobalItem.HoldItem hooks.
static bool ConsumeItem(Item item, Player player)
If ModItem.ConsumeItem or any of the GlobalItem.ConsumeItem hooks returns false, sets consume to fals...
static ? bool UseItem(Item item, Player player)
Returns false if any of ModItem.UseItem or GlobalItem.UseItem return false. Returns true if anything ...
This serves as the central class from which item-related functions are carried out....
bool CanMount(int m, Player mountingPlayer)
void SetMount(int m, Player mountedPlayer, bool faceLeft=false)
void ItemCheck_EmitDrinkParticles(Item sItem)
void ItemCheck_ApplyManaRegenDelay(Item sItem)
bool selectItemOnNextUse
Causes M:Terraria.Player.SmartSelectLookup to run the next time an item animation is finished,...
bool cursorItemIconEnabled
void ItemCheck_HandleMount()
void ApplyPotionDelay(Item sItem)
bool ThrownCost50
If true, player has a 50% chance of not consuming the thrown item. Only applies to consumable items ...
void ApplyLifeAndOrMana(Item item)
Item lastVisualizedSelectedItem
int GetWeaponDamage(Item sItem, bool forTooltip=false)
bool ItemCheck_CheckCanUse(Item sItem)
void UpdatePlacementPreview(Item sItem)
void DoPotionOfReturnTeleportationAndSetTheComebackPoint()
bool ThrownCost33
If true, player has a 33% chance of not consuming the thrown item. Only applies to consumable items ...
void RemoveAllGrapplingHooks()
void TeleportationPotion()
Mount mount
This player's T:Terraria.Mount. Do not overwrite this value. Instead, call M:Terraria....
void ItemCheck_ApplyHoldStyle(float mountOffset, Item sItem, Rectangle heldItemFrame)
void ItemCheck_ApplyUseStyle(float mountOffset, Item sItem, Rectangle heldItemFrame)
void ItemCheck_EmitFoodParticles(Item sItem)
void ItemCheck_HackHoldStyles(Item sItem)
void ApplyItemTime(Item sItem, float multiplier=1f, bool? callUseItem=null)
void ItemCheck_HandleMPItemAnimation(Item sItem)
void FreeUpPetsAndMinions(Item sItem)
void ItemCheck_OwnerOnlyCode(ref ItemCheckContext context, Item sItem, int weaponDamage, Rectangle heldItemFrame)
void ItemCheck_ApplyPetBuffs(Item sItem)
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Gives the player the provided buff. This accounts for if the player is immune to the buff....
float HeightOffsetHitboxCenter
void Spawn(PlayerSpawnContext context)
void ItemCheck_StartActualUse(Item sItem)
bool CCed
Checks if the player is currently "crowd controlled", meaning the player is F:Terraria....
void ItemCheck_EmitHeldItemLight(Item sItem)
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
void Fishing_GetBait(out Item bait)