PlugNPlay-StationAutoPopper icon

StationAutoPopper

A plug and play mod to automatically eject (pop) cooked food from Valheim cooking stations the moment it finishes, no more manual clicks! Affects anything that uses the CookingStation component.

Last updated 5 hours ago
Total downloads 54
Total rating 3 
Categories Mods Tweaks Client-side Utility Hildir's Request Update Ashlands Update Bog Witch Update
Dependency string PlugNPlay-StationAutoPopper-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

denikson-BepInExPack_Valheim-5.4.2202 icon
denikson-BepInExPack_Valheim

BepInEx pack for Valheim. Preconfigured and includes unstripped Unity DLLs.

Preferred version: 5.4.2202

README

StationAutoPopper

A plug and play mod to automatically eject (pop) cooked food from Valheim cooking stations the moment it finishes, no more manual clicks! Affects anything that uses the CookingStation component.


Description

StationAutoPopper watches each CookingStation.UpdateCooking cycle and, as soon as any food reaches the Done state, immediately spawns it into the world and clears the slot. This gives you truly “hot” cooking: food pops out the instant it’s done.

Client side mod, not needed on server.

No configuration required.


Features

  • Auto-Pop Cooked Food
    Instantly ejects finished food items from any cooking station.

  • Zero Clicks Required
    Never click a cooking station again to retrieve done food. (Unless you want to?)


Performance Improvements

This implementation is significantly more performant than the patches in the re-uploaded mods or the original mod by * aedenthorn*, thanks to:

  1. No Reflection or Harmony.Traverse
  • aedenthorn’s code used Traverse.Create(...) and repeated val.Method(...).GetValue<>() calls for IsFireLit(), GetFuel(), GetItemConversion(), and SpawnItem().
  • StationAutoPopper calls the concrete methods directly (__instance.GetSlot(), nview.InvokeRPC(…)) with zero reflection overhead.
  1. Minimized ZDO Reads/Writes
  • aedenthorn’s code performed three separate GetZDO().Get* calls per slot plus multiple Set calls when popping.
  • StationAutoPopper uses the built-in GetSlot(slot, out name, out time, out status) once per slot, and relies on the existing RPC_RemoveDoneItem RPC to clear the slot—one network message handles spawn, clear, and visuals.
  1. Single RPC vs. Multiple Operations
  • aedenthorn’s code manually called SpawnItem(), then two ZDO Set(...), then a "SetSlotVisual" RPC.
  • StationAutoPopper invokes one "RPC_RemoveDoneItem" RPC which internally spawns the item, clears the ZDO data, and broadcasts the visual update.
  1. Reduced GC Pressure & Allocations
  • aedenthorn’s code concatenated slot‐index strings ("slot" + i) each iteration, allocating multiple small strings.
  • StationAutoPopper avoids per-frame allocations aside from a small, thread‐static int[] buffer to track which slots have already popped.
  1. Thread-Static Pop Tracking
    Prevents “double-pop” in the unlikely event of re-entrance or overlapping patches, without any per-frame new allocations.

  2. Owner-Only Execution
    Ensures only the network owner of each station runs the pop logic other clients do zero extra work.


Current Vanilla Pieces with CookingStation Component this mod affects

  • piece_cookingstation
  • piece_cookingstation_iron
  • piece_oven



Massive thank you to Azumatt who helped me code this mod.