Advertisement
Mizzion

Untitled

Dec 11th, 2019
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.51 KB | None | 0 0
  1. private void DoClean()
  2.         {
  3. //Set up the variables we use
  4. Farm farm = Game1.getFarm();
  5.     farm.objects.TryGetValue(_config.ChestLocation, out SObject obj);
  6.             Chest myChest;
  7. //Check to make sure the object isnt null, and that it is my chest.
  8. if (obj != null && obj is Chest c)
  9.                 myChest = c;
  10.             else
  11.             {
  12.                 //If it failed add a new chest.
  13.                 myChest = new Chest(true);
  14.                 farm.objects.Add(_config.ChestLocation, myChest);
  15.             }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement