LostLoot
一个 Minecraft 模组,它会在服务器池中保存消失的物品,以便玩家可以钓出它们或从可疑的沙/砾石中刷出它们。
附带管理工具以及可选的过滤和限制功能。
服务端 / 单人游戏。客户端无需安装此模组。
依赖项:Fabric API。
基于 TreeOfSelf(CC0)开发的 PandaArchaeology。
机制
- 当物品实体消失时,它可能会被存储在持久化池中(世界文件夹中的
LostLoot.dat)。
- 钓鱼(开放水域)和考古(可疑沙/砾石)各自拥有可配置的几率,可以从该池中抽取一项记录,而不是(或作为)正常战利品的一部分。
- 发现事件会伴随一条消息。它会显示物品(悬停可查看附魔/组件)、丢失者(如果已知)以及丢失日期。
配置
文件:config/lost-loot.json(首次启动时创建/更新)。
现成可用的配置文件:lost-loot.json。用于 Kabyle World 服务器。
{
"activeForFishing": true,
"activeForBrushing": true,
"onlyPlayerOwned": true,
"itemLimit": 10,
"globalItemLimit": 256,
"fishingChance": 100,
"brushChance": 10,
"luckMultiplier": 3,
"global_broadcast": false,
"rarity": [],
"item_filter_mode": "exclude",
"item_filter": [
"#minecraft:flowers",
"minecraft:dirt",
"minecraft:cobblestone",
"minecraft:kelp",
"minecraft:egg",
"minecraft:sand",
"minecraft:gravel",
{ "id": "minecraft:iron_axe", "rarity": ["common"] }
]
}
| Key |
Default |
Meaning |
activeForFishing |
true |
允许在钓鱼时发现物品(仅限开放水域) |
activeForBrushing |
true |
允许在清理可疑方块时发现物品 |
onlyPlayerOwned |
true |
仅存储曾有玩家所有者的物品(掉落/死亡) |
itemLimit |
10 |
每种物品类型的最大条目数(0 = 无限)。先进先出:当达到上限时,移除该类型中最旧的条目 |
globalItemLimit |
256 |
整个池中的最大条目数(0 = 无限)。先进先出:当达到上限时,移除所有条目中最旧的一个 |
fishingChance |
100 |
钓鱼捕获的基础几率为 1/N(幸运值可提高掷骰结果) |
brushChance |
10 |
考古战利品投掷后的基础几率为 1/N |
luckMultiplier |
3 |
“海洋之心”附魔和幸运效果对掷骰结果的提升强度 |
global_broadcast |
false |
false:仅向发现者发送消息;true:向全服广播 |
rarity |
[] |
全局允许的稀有度白名单(common / uncommon / rare / epic)。空数组表示无过滤 |
item_filter_mode |
exclude |
none、include、exclude(见下文) |
item_filter |
(见上文) |
字符串(物品 ID:minecraft:dirt,物品标签:#minecraft:flowers) 对象 { "id", "rarity": [] } |
物品过滤、稀有度和全局稀有度
两层结构,顺序如下:
rarity(可选的全局过滤)
item_filter_mode + item_filter(包含 / 排除 / 无)
全局 rarity
"rarity": ["rare", "epic"]
只有稀有和史诗品质的堆叠才能进入池中。
[] 或省略:无全局稀有度门槛。
过滤模式
none:无 ID/标签过滤(仅应用 onlyPlayerOwned)
exclude:存储所有权允许的所有内容,除了列出的物品
include:仅将列出的物品添加到池中(仍受 onlyPlayerOwned 约束)
过滤始终作为 onlyPlayerOwned 的附加条件应用。
item_filter 条目
| Form |
Meaning |
"minecraft:dirt" |
匹配该物品,任何稀有度 |
"#minecraft:flowers" |
匹配该标签,任何稀有度 |
{ "id": "minecraft:iron_axe", "rarity": ["epic"] } |
仅当 ID/标签匹配且堆叠稀有度在列表中时才匹配 |
相同的对象形式适用于包含和排除模式:rarity 数组限制规则何时匹配,它不会因模式而反转。
示例:
- 排除所有花朵,并仅排除普通铁镐:
"item_filter_mode": "exclude",
"item_filter": [
"#minecraft:flowers",
{ "id": "minecraft:iron_axe", "rarity": ["common"] }
]
- 仅包含史诗铁镐和任意钻石:
"item_filter_mode": "include",
"item_filter": [
"minecraft:diamond",
{ "id": "minecraft:iron_axe", "rarity": ["epic"] }
]
带有 "min_rarity" 的旧配置会被迁移。
示例:"rare" 会被迁移为 "rarity": ["rare", "epic"](即该品质及以上)。
几率
掷骰使用 nextInt(N)(值为 0 … N-1)。当满足以下条件时,发现成功:
nextInt(N) ≤ effectiveLuck × luckMultiplier
- 钓鱼:
N = fishingChance,effectiveLuck = 海洋之运等级 + 玩家幸运属性
- 使用毛刷挖掘:
N = brushChance,effectiveLuck = 仅玩家幸运属性(不适用海洋之运)
在默认值(fishingChance = 100,brushChance = 10,luckMultiplier = 3)下:
钓鱼
| 配置 |
effectiveLuck |
成功概率 |
| 无幸运 |
0 |
1 / 100 (1%) |
| 海洋之运 I |
1 |
4 / 100 (4%) |
| 海洋之运 II |
2 |
7 / 100 (7%) |
| 海洋之运 III |
3 |
10 / 100 (10%) |
| 海洋之运 III + 幸运 I |
4 |
13 / 100 (13%) |
使用毛刷挖掘
| 配置 |
effectiveLuck |
成功概率 |
| 无幸运 |
0 |
1 / 10 (10%) |
| 幸运 I |
1 |
4 / 10 (40%) |
| 幸运 II |
2 |
7 / 10 (70%) |
| 幸运 III |
3 |
10 / 10 (100%) |
如果 effectiveLuck × luckMultiplier ≥ N,则必定找到(每次成功的开阔水域捕获/毛刷判定)。
建议
- 优先使用
"onlyPlayerOwned": true。
- 如果使用过滤器,优先使用
"item_filter_mode": "include" 并尽可能使用 物品标签。
- 在启用
"global_broadcast": true 之前,请考虑其社交影响。
- 默认情况下,随着幸运药水的使用,毛刷挖掘的成功率会迅速上升;如果觉得过高,请提高
brushChance 或降低 luckMultiplier。
- 除非你希望设置全局品质门槛,否则请保留
"rarity": [];使用每个条目的 "rarity" 来处理例外情况(例如:仅限稀有斧头)。
管理员命令
权限要求:游戏管理员(等级 2)。
| 命令 |
描述 |
/lostloot list |
列出池中的条目,使用 从 1 开始 的标识符,可悬停显示物品名称、所有者和日期 |
/lostloot delete <id> |
从池中删除一个条目 |
/lostloot clear |
清空池子 |
/lostloot recover <id> |
将该条目给予执行命令的玩家背包(不会掉落;如果背包已满则会失败,因此不会丢失任何来自池子的物品) |
标识符与 /lostloot list 匹配(从 1 开始)。
持久化存储
- 池文件:
<world>/LostLoot.dat(NBT 格式,通过临时文件原子写入)。
- 在原版自动保存、正常关闭以及池发生变异(找到、移除、清空、恢复)后保存。
- 如果在两次自动保存之间发生强制崩溃,可能会丢失尚未刷新的最近消失的条目;而从池中抽取的查找结果会及时保存,以避免双重持有。
致谢
许可证
Apache-2.0
LostLoot
Minecraft mod that saves despawned items in a server pool so players can fish them up or brush them out of suspicious sand/gravel.
With admin tools and optional filters and limits.
Server-side / singleplayer. Clients do not need the mod.
Dependencies: Fabric API.
Based on PandaArchaeology by TreeOfSelf (CC0).
Mechanics
- When an item entity despawns, it may be stored in a persistent pool (
LostLoot.dat in the world folder).
- Fishing (open water) and archaeology (suspicious sand/gravel) each have a configurable chance to pull an entry from that pool instead of (or as) the normal loot.
- A message accompanies a find event. It shows the item (hover for enchants / components), who lost it (if known), and the date it was lost.
Config
File: config/lost-loot.json (created/updated on first launch).
Ready to use config: lost-loot.json. Used on Kabyle World server.
{
"activeForFishing": true,
"activeForBrushing": true,
"onlyPlayerOwned": true,
"itemLimit": 10,
"globalItemLimit": 256,
"fishingChance": 100,
"brushChance": 10,
"luckMultiplier": 3,
"global_broadcast": false,
"rarity": [],
"item_filter_mode": "exclude",
"item_filter": [
"#minecraft:flowers",
"minecraft:dirt",
"minecraft:cobblestone",
"minecraft:kelp",
"minecraft:egg",
"minecraft:sand",
"minecraft:gravel",
{ "id": "minecraft:iron_axe", "rarity": ["common"] }
]
}
| Key |
Default |
Meaning |
activeForFishing |
true |
Allow finds while fishing (open water only) |
activeForBrushing |
true |
Allow finds when brushing suspicious blocks |
onlyPlayerOwned |
true |
Only store items that had a player owner (drops / death) |
itemLimit |
10 |
Max entries per item type (0 = unlimited). FIFO: oldest of that type is removed when full |
globalItemLimit |
256 |
Max entries in the whole pool (0 = unlimited). FIFO: oldest overall is removed when full |
fishingChance |
100 |
1 in N base chance on a fishing catch (luck improves the roll) |
brushChance |
10 |
1 in N base chance after archaeology loot is rolled |
luckMultiplier |
3 |
How strongly Luck of the Sea and the Luck effect improve the roll |
global_broadcast |
false |
false: message to finder only; true: whole server |
rarity |
[] |
Global allow-list of item rarities (common / uncommon / rare / epic). Empty = no filter |
item_filter_mode |
exclude |
none, include, exclude (see below) |
item_filter |
(see above) |
Strings (item id: minecraft:dirt, item tag: #minecraft:flowers) Objects { "id", "rarity": [] } |
Item filter, rarity and global rarity
Two layers, in this order:
rarity (optional global filter)
item_filter_mode + item_filter (include / exclude / none)
Global rarity
"rarity": ["rare", "epic"]
Only rare and epic stacks may enter the pool.
[] or omit: no global rarity gate.
Filter modes
none: no id/tag filter (only onlyPlayerOwned applies)
exclude: store everything allowed by ownership except listed items
include: only listed items are added to the pool (still subject to onlyPlayerOwned)
Filter is always applied in addition to onlyPlayerOwned.
item_filter entries
| Form |
Meaning |
"minecraft:dirt" |
Match that item, any rarity |
"#minecraft:flowers" |
Match that tag, any rarity |
{ "id": "minecraft:iron_axe", "rarity": ["epic"] } |
Match only if id/tag matches and stack rarity is in the list |
The same object form works in include and exclude: the rarity array restricts when the rule matches, it is not inverted by mode.
Examples:
- Exclude all flowers, and exclude only common iron axes:
"item_filter_mode": "exclude",
"item_filter": [
"#minecraft:flowers",
{ "id": "minecraft:iron_axe", "rarity": ["common"] }
]
- Include only epic iron axes and any diamond:
"item_filter_mode": "include",
"item_filter": [
"minecraft:diamond",
{ "id": "minecraft:iron_axe", "rarity": ["epic"] }
]
Old configs with "min_rarity" are migrated.
Example: "rare" is migrated to "rarity": ["rare", "epic"] (that floor and above).
Chances
Rolls use nextInt(N) (values 0 … N-1). A find succeeds when:
nextInt(N) ≤ effectiveLuck × luckMultiplier
- Fishing:
N = fishingChance, effectiveLuck = Luck of the Sea level + player Luck attribute
- Brushing:
N = brushChance, effectiveLuck = player Luck attribute only (Luck of the Sea does not apply)
With defaults (fishingChance = 100, brushChance = 10, luckMultiplier = 3):
Fishing
| Setup |
effectiveLuck |
Success chance |
| No luck |
0 |
1 / 100 (1%) |
| Luck of the Sea I |
1 |
4 / 100 (4%) |
| Luck of the Sea II |
2 |
7 / 100 (7%) |
| Luck of the Sea III |
3 |
10 / 100 (10%) |
| Luck of the Sea III + Luck I |
4 |
13 / 100 (13%) |
Brushing
| Setup |
effectiveLuck |
Success chance |
| No luck |
0 |
1 / 10 (10%) |
| Luck I |
1 |
4 / 10 (40%) |
| Luck II |
2 |
7 / 10 (70%) |
| Luck III |
3 |
10 / 10 (100%) |
If effectiveLuck × luckMultiplier ≥ N, the find is guaranteed (every successful open-water catch / brush roll).
Advice
- Prefer
"onlyPlayerOwned": true.
- If using a filter, prefer
"item_filter_mode": "include" and use item tags as much as possible.
- Consider the social effects of
"global_broadcast": true before enabling it.
- Default brush rates climb quickly with Luck potions; raise
brushChance or lower luckMultiplier if that feels too high.
- Leave
"rarity": [] unless you want a global quality gate; use per-entry "rarity" for exceptions (example: only rare axes).
Admin commands
Permission: game masters (level 2).
| Command |
Description |
/lostloot list |
List the pool with 1-based identifiers, hoverable item names, owner and date |
/lostloot delete <id> |
Delete one entry from the pool |
/lostloot clear |
Empty the pool |
/lostloot recover <id> |
Give that entry to the executing player inventory (does not drop; fails if inventory is full so nothing is lost from the pool) |
Identifiers match /lostloot list (starting at 1).
Persistence
- Pool file:
<world>/LostLoot.dat (NBT, atomic write via temp file).
- Saved on vanilla autosave, clean shutdown, and after pool mutations (find, remove, clear, recover).
- A hard crash between autosaves can lose recently despawned entries not yet flushed; finds that pull from the pool are saved promptly to avoid double-hold.
Credits
License
Apache-2.0
评论 0
登录后参与评分
还没有评论,来抢沙发吧