Skip to content

Mod compatibility

Arjan edited this page Jul 23, 2019 · 9 revisions

Remote fridge storages makes the following changes:

  • Game1.activeClickableMenu is replaced with RemoteFridgeCraftingPage when the cooking menu is opened
  • CraftingRecipe.consumeIngredients is replaced with a modified patched version
  • CraftingRecipe.drawRecipeDescription is replaced with a modfied patched version.

To make your mod compatible you need to to create the following interface:

public interface IRemoteFridgeApi
    {
        IList<Item> Fridge();
        
        void UseCustomCraftingMenu(bool enabled = false);

        void UpdateFridgeContents();

        bool IsFridgeChest(Chest chest);

        bool AddFridgeChest(Chest chest);

        bool RemoveFridgeChest(Chest chest);
    }

You can then receive an instance of the api with:

IRemoteFridgeApi remoteFridgeApi = helper.ModRegistry.GetApi<IRemoteFridgeApi>("EternalSoap.RemoteFridgeStorage");

And in the places where you query the items from the fridge replace it with:

remoteFridgeApi.Fridge()

To disable the custom menu from Remote Fridge Storage you can use:

remoteFridgeApi.UseCustomCraftingMenu(false)
Clone this wiki locally