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

◆ DyeSwap()

static Item Terraria.UI.ItemSlot.DyeSwap ( Item item,
out bool success )
inlinestaticprivate

Definition at line 3074 of file ItemSlot.cs.

3075 {
3076 success = false;
3077 if (item.dye <= 0)
3078 {
3079 return item;
3080 }
3081 Player player = Main.player[Main.myPlayer];
3082 Item item2 = item;
3083 for (int i = 0; i < 10; i++)
3084 {
3085 if (player.dye[i].type == 0)
3086 {
3087 dyeSlotCount = i;
3088 break;
3089 }
3090 }
3091 if (dyeSlotCount >= 10)
3092 {
3094 if (success)
3095 {
3096 return item2;
3097 }
3098 dyeSlotCount = 0;
3099 }
3100 if (dyeSlotCount < 0)
3101 {
3102 dyeSlotCount = 9;
3103 }
3104 item2 = player.dye[dyeSlotCount].Clone();
3105 player.dye[dyeSlotCount] = item.Clone();
3106 dyeSlotCount++;
3107 if (dyeSlotCount >= 10)
3108 {
3109 accSlotToSwapTo = 0;
3110 }
3112 Recipe.FindRecipes();
3113 success = true;
3114 return item2;
3115 }
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 ...
static Item ModSlotDyeSwap(Item item, out bool success)
Alters the ItemSlot.DyeSwap method for modded slots; Unfortunately, I (Solxan) couldn't ever get Item...
Definition ItemSlot.cs:4203
static int accSlotToSwapTo
Definition ItemSlot.cs:165
static int dyeSlotCount
Definition ItemSlot.cs:163

References Terraria.UI.ItemSlot.accSlotToSwapTo, Terraria.Item.Clone(), Terraria.Item.dye, Terraria.Player.dye, Terraria.UI.ItemSlot.dyeSlotCount, Terraria.Recipe.FindRecipes(), Terraria.UI.ItemSlot.ModSlotDyeSwap(), Terraria.Main.myPlayer, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), and Terraria.Item.type.

Referenced by Terraria.UI.ItemSlot.SwapEquip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: