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

◆ DropCache()

static void Terraria.Item.DropCache ( IEntitySource reason,
Vector2 pos,
Vector2 spread,
int t,
bool stopCaching = true )
inlinestatic

Drops a cache previously created using M:Terraria.Item.StartCachingType(System.Int32).
If no cache of t exists, nothing happens.

Parameters
reasonThe source of the dropped cache.
posThe position to drop the cache in world coordinates.
spreadThe random spread of the dropped items in world coordinates.
tThe item type (F:Terraria.Item.type) to drop.
stopCachingIf true, then t will no longer be cached, allowing future drops to spawn as normal.

Definition at line 1198 of file Item.cs.

1199 {
1200 //IL_003f: Unknown result type (might be due to invalid IL or missing references)
1201 //IL_0046: Unknown result type (might be due to invalid IL or missing references)
1202 //IL_004d: Unknown result type (might be due to invalid IL or missing references)
1203 //IL_0054: Unknown result type (might be due to invalid IL or missing references)
1204 if (cachedItemSpawnsByType[t] == -1)
1205 {
1206 return;
1207 }
1208 int num = cachedItemSpawnsByType[t];
1209 cachedItemSpawnsByType[t] = (stopCaching ? (-1) : 0);
1210 Item item = new Item();
1211 item.SetDefaults(t);
1212 while (num > 0)
1213 {
1214 int num2 = item.maxStack;
1215 if (num < num2)
1216 {
1217 num2 = num;
1218 }
1219 NewItem(reason, (int)pos.X, (int)pos.Y, (int)spread.X, (int)spread.Y, t, num2);
1220 num -= num2;
1221 }
1222 }
static int[] cachedItemSpawnsByType
The number of cached item spawns by type. A value of -1 means that an item type is not being cached....
Definition Item.cs:102
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.
Definition Item.cs:51478

References Terraria.Item.Item(), Terraria.Item.cachedItemSpawnsByType, Terraria.Item.maxStack, Terraria.Item.NewItem(), and Terraria.Item.SetDefaults().

Referenced by Terraria.Wiring.MassWireOperationInner().

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