让你的 SMP 服务器上的掠夺结构和地牢更加“公平”。
带有战利品表的箱子或桶会为每位玩家独立进行战利品投骰,每位玩家在每个位置仅有一次机会。
此模组解决的问题
默认情况下,一个战利品箱(在地牢、结构体、远古城市、船中等)仅在首次打开时生成其内容。第一个打开它的玩家从池中抽取战利品;之后的玩家只能找到剩下的东西;如果还有剩下的话。
在多人服务器上,这只会奖励最快到达的人。这可能不太公平;你的服务器,你的规则。
使用 FreshLoot,每个第一次打开箱子的玩家都会获得自己的投骰结果,就像他独自面对一个全新的箱子一样。一旦玩家已经掠夺过该位置,他就不能从该位置再次获取战利品。
机制
- 打开:当玩家打开带有战利品表的箱子或桶时,模组会检查他是否已经掠夺过这个位置。如果他已掠夺过,则拒绝打开(永远不会显示 GUI)。如果没有,则为他正常生成战利品。
- 一次只能开一个箱子:如果玩家打开了一个箱子,其他玩家在同一时间无法打开它。他必须等待第一个玩家关闭其 GUI。
- 轮换:当 GUI 关闭时,箱子被销毁并立即替换为一个新箱子,携带相同的战利品表,准备供下一位玩家使用。这种机制使得模组无需依赖可能丢失的内存状态即可工作:新箱子将其战利品表直接包含在其自身数据中,就像从未打开过的原版箱子一样。
- 破坏而非打开属于 griefing(恶意破坏):破坏仍带有未领取战利品表的箱子(无论是全新的、刚刚重新放入轮换中的,还是当前正由某人打开的,包括破坏者本人)会在方块掉落之前向服务器发送一条公共消息并清空战利品。随后该箱子将不再提供任何物品:既不给破坏它的玩家,也不给之后的任何玩家,因为该位置本身已被摧毁(除非当前正由某人打开,在这种情况下内容会被掉落)。
- 持久性:“哪些玩家已经掠夺了哪些位置”的记录在服务端重启后仍然存在。其他所有内容(例如谁当前打开了一个箱子等)都是故意设置为非持久化状态的。这些状态仅在服务器运行时才有意义。
- 旁观者模式:完全忽略。旁观者可以查看任何箱子,包括当前正由玩家打开的箱子,而不会触发上述任何规则。
已知限制
- 不支持双格箱子。 双格箱子(两个单格箱子连接在一起)保留完整的原版行为。模组完全不干预它,即使它携带战利品表。
- 仅支持箱子和桶。 任何其他携带战利品表的容器(潜影盒持有者、模组桶等)遵循标准的原版行为。
- 轮换会破坏并替换方块。 刷新机制依赖于物理上销毁箱子并重新创建它。在游戏中不可见,但这意味着“处于轮换中的”箱子在每次循环中实际上都改变了方块身份。通过引用跟踪方块实体的第三方模组可能会对此感到不满。
愿望清单
- 支持双格箱子。
- 支持其他携带战利品表的容器(可能)
- 外部配置,而不是硬编码常量(例如能够禁用破坏消息、编辑其文本甚至其行为)。
- 破坏消息的翻译(目前仅英文,未本地化)。
问题反馈
如果你发现 bug、希望添加功能或想要贡献代码,请在 GitHub 上提交 issue 或发起 PR。
Make looting structures and dungeons more "fair" on your SMP server.
A chest or barrel with a loot table gives out an independent loot roll to each player, once per player and per position.
The problem this solves
By default, a loot chest (in a dungeon, a structure, an ancient city, a boat, etc.) generates its contents once, on first open. The first player to open it picks from the pool; everyone after that only finds whatever is left; if anything is left.
On a multiplayer server, that just rewards whoever gets there fastest. This might not be very fair; your server, your rules.
With FreshLoot, every player who opens the chest for the first time gets their own roll, as if he was alone in front of a brand-new chest. Once a player has looted it, he can't pull a second roll from that position.
Mechanics
- Opening: when a player opens a chest or barrel carrying a loot table, the mod checks whether he already has looted this position. If he has, the open is denied (no GUI ever shows up). If not, loot is generated normally for him.
- One chest at a time: if a player has a chest open, no other player can open it at the same time. He has to wait for the first one to close his GUI.
- Rotation: when the GUI closes, the chest is destroyed and immediately replaced with a new one, carrying the same loot table, ready for the next player. This same mechanism is what lets the mod work without depending on in-memory state that could get lost: the new chest carries its loot table directly in its own data, exactly like a vanilla chest that's never been opened.
- Breaking instead of opening is griefing: breaking a chest that still has an unclaimed loot table (whether it's brand-new, freshly put back into rotation, or currently open by someone, including the breaker themselves) sends a public message to the server and empties the loot before the block drops. The chest then gives out nothing: not to the player who broke it, not to anyone after them, since the position itself is destroyed (unless currently open by someone, in case the content is dropped).
- Persistence: the record of "which player has already looted which position" survives a server restart. Everything else (who currently has a chest open, etc.) is deliberately non-persistent state. It only makes sense while the server is running.
- Spectator mode: entirely ignored. A spectator can look inside any chest, including one currently open by a player, without triggering any of the rules above.
Known limitations
- Double chests aren't handled. A double chest (two single chests joined together) is left to full-vanilla behavior. The mod doesn't touch it at all, even if it carries a loot table.
- Only chests and barrels. Any other loot-table-carrying container (shulker box holder, modded barrel, etc.) follows standard vanilla behavior.
- Rotation breaks and replaces the block. The refresh mechanism relies on physically destroying the chest and recreating it identically. It's invisible in-game, but it means a chest "in rotation" literally changes block identity on every cycle. A third-party mod that tracks block entities by reference might not be happy about that.
Wishlist
- Double chest support.
- Support for other loot-table-carrying containers (maybe)
- External configuration, instead of hardcoded constants (e.g. being able to disable the grief message, edit its text, or even its behavior).
- Translation of the grief message (currently English-only, not localized).
Issues
If you find a bug, want a feature added or want to contribute, please open an issue or make a PR on GitHub.
评论 0
登录后参与评分
还没有评论,来抢沙发吧