-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathVaultSystem.cs
More file actions
42 lines (36 loc) · 1.26 KB
/
VaultSystem.cs
File metadata and controls
42 lines (36 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using InnoVault.GameSystem;
using System;
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
namespace InnoVault
{
internal class VaultSystem : ModSystem
{
public override void PostAddRecipes() {
foreach (var loader in VaultMod.Loaders) {
loader.AddRecipesData();
}
//遍历所有配方,执行对应的配方修改,这个应该执行在最前,防止覆盖后续的修改操作
for (int i = 0; i < Recipe.numRecipes; i++) {
Recipe recipe = Main.recipe[i];
if (!ItemOverride.TryFetchByID(recipe.createItem.type, out Dictionary<Type, ItemOverride> values)) {
continue;
}
foreach (var value in values.Values) {
value.ModifyRecipe(recipe);
}
}
}
public override void AddRecipes() {
for (int i = 0; i < ItemLoader.ItemCount; i++) {
if (!ItemOverride.TryFetchByID(i, out Dictionary<Type, ItemOverride> values)) {
continue;
}
foreach (var value in values.Values) {
value.AddRecipe();
}
}
}
}
}