Valheim
Install with App

Details

Latest version
1.0.0
Last Updated
First Uploaded
Downloads
328
Likes
2
Size
87KB
Dependants
ADDatHost Valheim hosting
30% off

CraftFromChestOptimized

Craft, build and cook using the materials in your nearby chests, not only your backpack, and turn it on or off with a key while you play.

This is a rework of Teflon Ted's Craft From Chests. It keeps what the original does and changes how it finds and counts the chests. See Credits and What changed in this rework below.

(Versión en español más abajo.)

What it does

  • Crafting, building with the hammer and cooking count the chests within 20 m of you as ingredients.
  • Your inventory is used first, then the chests.
  • Only chests you can open count: locked chests and chests inside someone else's ward are skipped.
  • Next to each required amount you see needed (in chests), for example 10 (42).
  • It does not move items, open chests for you or change recipes.
  • Press F6 to turn it on or off. A message appears at the top left (in Spanish if the game is in Spanish). It always starts turned on. The key is ignored while you type in the chat, the console or a text box.
  • Turned off, the game goes back to its normal behaviour: chest items are not counted or spent and the (chests) label disappears.

What changed in this rework

The original asks the physics engine for everything within 20 m each time a craft or build requirement is checked, and the game checks all the time while the hammer or the crafting panel is open. This version keeps the same rules for which chests count, but:

Original This rework
A physics scan of the area for each requirement check A list of the chests in the world, kept up to date as they appear (patch to Container.Awake); finding the nearby ones is a loop over that list
Component lookups on every collider the scan touches Done once, when the chest is created
The chest list is built whenever a check starts Built at most once per frame, and only if something needs it
Every item count walks the inventory of every chest Counts are remembered per (item, quality) during the frame and forgotten when something is spent
If the game throws in the middle of a check, the chest mode stays open It always closes, and a safety net resets it at the start of the next frame
Chests are used in whatever order the physics query returns them The closest chest is used first
(no on/off switch) F6 toggle with an on-screen message

If a Valheim update changes a method this mod patches, the mod turns itself off and writes the reason in BepInEx/LogOutput.log, instead of counting chest items it can no longer spend.

Installation

It cannot run together with the original. Both patch the same game methods and the chests would be counted twice, so this mod is marked as incompatible: if Teflon Ted's Craft From Chests is enabled, this one does not load. Disable or uninstall it in your mod manager first.

Install it with the mod manager (it needs BepInExPack_Valheim). LogOutput.log shows CraftFromChestOptimized 1.0.0 loaded when it starts.

Configuration

BepInEx/config/com.despr0grammer.craftfromchestoptimized.cfg

Option Default What it does
ToggleKey F6 Turns crafting from chests on/off while playing

Compatibility

  • Made for Valheim 1.0.x with BepInEx 5 (BepInExPack_Valheim).
  • Client-side: it works on any server, because it only changes what your own game counts and spends.
  • If something looks wrong, send the CraftFromChestOptimized lines of LogOutput.log.

Credits

The idea and the original mod are Teflon Ted's: Craft From Chests on Thunderstore · source on GitHub. All credit for them goes to him. This package only adds the rework described above.


CraftFromChestOptimized (español)

Craftea, construye y cocina usando los materiales de los cofres cercanos, no solo los de tu mochila, y actívalo o desactívalo con una tecla mientras juegas.

Es un rework de Craft From Chests de Teflon Ted. Mantiene lo que hace el original y cambia cómo encuentra y cuenta los cofres. Mira Créditos y Qué cambia en este rework más abajo.

Qué hace

  • Al craftear, construir con el martillo o cocinar, los cofres a menos de 20 m cuentan como ingredientes.
  • Primero se usa tu inventario y después los cofres.
  • Solo cuentan los cofres que puedes abrir: se saltan los cerrados con llave y los que están dentro del ward de otro.
  • Junto a cada cantidad requerida ves necesario (en cofres), por ejemplo 10 (42).
  • No mueve objetos, no abre cofres por ti ni cambia recetas.
  • Pulsa F6 para activarlo o desactivarlo. Aparece un mensaje arriba a la izquierda (en español si el juego está en español). Siempre arranca activado. La tecla se ignora mientras escribes en el chat, la consola o un cuadro de texto.
  • Desactivado, el juego vuelve a su comportamiento normal: no se cuentan ni se gastan objetos de los cofres y desaparece el (cofres).

Qué cambia en este rework

El original le pide al motor de físicas todo lo que hay a 20 m cada vez que se comprueba un requisito de crafteo o construcción, y el juego lo comprueba continuamente con el martillo o el panel de crafteo abiertos. Esta versión mantiene las mismas reglas sobre qué cofres cuentan, pero:

Original Este rework
Un escaneo físico de la zona por cada comprobación de requisitos Una lista de los cofres del mundo, al día a medida que aparecen (parche a Container.Awake); encontrar los cercanos es recorrer esa lista
Búsqueda de componentes en cada collider que toca el escaneo Se hace una sola vez, al crearse el cofre
La lista de cofres se arma cada vez que empieza una comprobación Se arma como mucho una vez por frame, y solo si algo la necesita
Cada recuento de un objeto recorre el inventario de todos los cofres Los recuentos se recuerdan por (objeto, calidad) durante el frame y se olvidan al gastar algo
Si el juego lanza una excepción en mitad de una comprobación, el modo cofres queda abierto Siempre se cierra, y un seguro lo reinicia al empezar el siguiente frame
Se usan los cofres en el orden que devuelva la consulta de físicas Se usa primero el cofre más cercano
(sin interruptor) Tecla F6 con mensaje en pantalla

Si una actualización de Valheim cambia un método que el mod parchea, el mod se apaga solo y deja el motivo en BepInEx/LogOutput.log, en lugar de contar objetos de cofres que ya no puede gastar.

Instalación

No puede funcionar junto al original. Los dos parchean los mismos métodos y los cofres se contarían dos veces, así que este mod está marcado como incompatible: si Teflon Ted's Craft From Chests está activado, este no carga. Desactívalo o desinstálalo antes en tu gestor de mods.

Instálalo con el gestor de mods (necesita BepInExPack_Valheim). LogOutput.log muestra CraftFromChestOptimized 1.0.0 loaded al arrancar.

Configuración

BepInEx/config/com.despr0grammer.craftfromchestoptimized.cfg

Opción Por defecto Qué hace
ToggleKey F6 Activa/desactiva craftear desde cofres mientras juegas

Compatibilidad

  • Hecho para Valheim 1.0.x con BepInEx 5 (BepInExPack_Valheim).
  • Solo del lado del cliente: funciona en cualquier servidor, porque solo cambia lo que tu propio juego cuenta y gasta.
  • Si algo se ve mal, envía las líneas de CraftFromChestOptimized de LogOutput.log.

Créditos

La idea y el mod original son de Teflon Ted: Craft From Chests en Thunderstore · código en GitHub. Todo el mérito de ambos es suyo. Este paquete solo añade el rework descrito arriba.

Thunderstore development is made possible with ads. Please consider making an exception to your adblock.