forked from TyoAtrosa/TreeShaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModEntry.cs
50 lines (46 loc) · 1.51 KB
/
ModEntry.cs
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
43
44
45
46
47
48
49
50
using System;
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewModdingAPI.Utilities;
using StardewValley;
namespace TreeShaker
{
/// <summary>The mod entry point.</summary>
public class ModEntry : Mod
{
public override void Entry(IModHelper helper)
{
TimeEvents.AfterDayStarted += this.DayStarted;
}
private void DayStarted()
{
foreach (Farm location in Game1.Locations.OfType<Farm>())
{
foreach (Tree tree in location.terrainFeatures.Values.OfType<Tree>())
{
if (!tree.hasSeed)
continue;
bool added = false;
switch (tree.Type.Value)
{
case 1:
added = Game1.player.addItemToInventoryBool(309);
break;
case 2:
added = Game1.player.addItemToInventoryBool(310);
break;
case 3:
added = Game1.player.addItemToInventoryBool(311);
break;
case 6:
added = Game1.player.addItemToInventoryBool(88);
break;
}
if (added)
Tree.hasSeed = false;
}
}
}
}
}