Add signed general cache destinations

This commit is contained in:
Tanner committed 2026-11-14 23:12:50 +00:00
1 parent 11c1bad0c4
commit 86fbf911a5
7 files changed
+305 -114

No files matched your search

+37 -20
View File
@@ -1,28 +1,45 @@
# Mosfet Minecraft Bot
# How to Cache Items
## How to Cache Items
Caching normally starts when the bot has at least 27 occupied inventory slots.
Jobs can run cache passes automatically; `1cache` requests a pass directly.
![a single trapped chest with three normal double chests under it](media/cache_items.png)
## Destination priority
Mosfet will automatically dump items into the closest [trapped
chest](https://minecraft.fandom.com/wiki/Trapped_Chest#Crafting) once his
inventory gets full enough. Normally this is when the number of used inventory
slots is >= 27.
A cache pass handles destinations in this order:
If Mosfet can't find a trapped chest nearby, he will place down a normal chest
if he has one in his inventory. Then he will store the items in it.
1. **Throw signs** — addressed `throw` directives drop matching inventory stacks
near their signs.
2. **Item-specific chests** — signs labeled `Seeds`, `Wheat`, `Logs`, `Saplings`,
or a tree family such as `Oak Logs` direct matching items to nearby chests.
3. **General cache chests** — a normal chest marked with a bot-addressed `cache`
sign accepts any otherwise-cacheable items. These are lower priority than
all item-specific chests, regardless of distance.
4. **Placed chest** — if no signed chest destination is usable, the bot places a
normal chest from its inventory when it has one.
Mosfet won't cache items related to his current job. For example, if he's
farming wood, he will keep axes, beds, chests, and food.
Unmarked trapped chests are no longer searched for or used as cache destinations.
### Advanced Details
See the [Signs section in the main README](../README.md#signs) for sign syntax,
addresses, category contents, and examples. General cache signs look like:
The global `g.minimum_cache_slots` in `bot.py` controls the minimum amount of
used slots needed to trigger item caching.
```
mosfet cache
```
In `jobs.py`, each job calls `items.set_wanted()` and `items.set_needed()` to
control which items Mosfet shouldn't cache. No items in the "needed" list will
be cached and all items in the "wanted" list—except for one stack of each—will
be cached. The "needed" list is meant for essentials like tools, food, and beds,
while the "wanted" list is for stuff that's good to have a stack of like seeds
and saplings.
or, for one bot only:
```
mosfet1 cache
```
The bot searches for signed cache chests within 105 blocks. Chest attachment,
side-over-top priority, double-chest handling, and bot-group addressing follow
the same rules as other signs described in the README.
## Items kept
Items in the current job's `NEEDED_ITEMS` set are kept in general cache passes.
For `WANTED_ITEMS`, the bot keeps one stack of each type and may cache extras.
Item-specific chests only accept their labeled item IDs, while general cache
chests accept all otherwise-cacheable items. The normal cache threshold is
controlled by `g.minimum_cache_slots` in `mosfet.py` (default 27).