TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches
ItemLoot.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
4
5namespace Terraria.ModLoader;
6
8public readonly struct ItemLoot : ILoot
9{
10 private readonly int itemType;
11
13
15 {
16 this.itemType = itemType;
17 this.itemDropDatabase = itemDropDatabase;
18 }
19
21 {
22 return itemDropDatabase.GetRulesForItemID(itemType);
23 }
24
26 {
27 return itemDropDatabase.RegisterToItem(itemType, entry);
28 }
29
31 {
32 return itemDropDatabase.RemoveFromItem(itemType, entry);
33 }
34
36 {
37 foreach (IItemDropRule entry in Get())
38 {
39 if (predicate(entry))
40 {
41 Remove(entry);
42 }
43 }
44 }
45}
IItemDropRule Add(IItemDropRule entry)
Definition ItemLoot.cs:25
readonly ItemDropDatabase itemDropDatabase
Definition ItemLoot.cs:12
IItemDropRule Remove(IItemDropRule entry)
Definition ItemLoot.cs:30
void RemoveWhere(Predicate< IItemDropRule > predicate, bool includeGlobalDrops=true)
Definition ItemLoot.cs:35
List< IItemDropRule > Get(bool includeGlobalDrops=true)
Definition ItemLoot.cs:20
ItemLoot(int itemType, ItemDropDatabase itemDropDatabase)
Definition ItemLoot.cs:14
This readonly struct is a simple shortcut to T:Terraria.GameContent.ItemDropRules....
Definition ItemLoot.cs:9