EconomyMod
概览
EconomyMod 是一款基于 NeoForge 的 Minecraft 模组,旨在引入一个轻量级的游戏内经济系统,以绿宝石作为主要货币。它允许玩家通过直观的命令管理虚拟余额,并采用持久化数据存储机制,确保在服务器重启或玩家会话切换时进度得以保留。该模组兼容 Minecraft 1.21.1,并能无缝集成到 NeoForge 的模组生态中。
核心功能
1. 货币与余额管理
- 绿宝石作为货币:使用 Minecraft 原版绿宝石(
Items.EMERALD)作为基础货币,将游戏内物品与虚拟余额相连接。
- 虚拟余额:玩家可以将绿宝石存储在独立的持久化虚拟余额中,与背包分离,从而避免背包杂乱。
2. 游戏内命令
所有与经济系统的交互均通过聊天命令完成:
| 命令 |
语法 |
描述 |
| 存款 |
/deposit <amount> |
将玩家背包中的 <amount> 个绿宝石转换为虚拟余额。如果玩家绿宝石不足则操作失败。 |
| 取款 |
/withdraw <amount> |
将虚拟余额中的 <amount> 个绿宝石转换回玩家背包。如果余额不足或背包已满则操作失败。 |
| 查看余额 |
/balance |
显示玩家当前的虚拟余额。 |
| 查看他人余额 |
/balance <player> |
(仅限管理员,需要权限等级 2)显示指定玩家的虚拟余额。 |
| 转账 |
/pay <target> <amount> |
从发送者的虚拟余额向目标玩家转移 <amount> 个绿宝石。如果发送者余额不足则操作失败。 |
| 设置余额 |
/setbalance <player> <amount> |
设置玩家绿宝石数量的命令(管理员专用) |
3. 持久化数据存储
- 玩家余额保存在
economy_data/ 目录(自动创建)下的 .dat 文件中,使用 Minecraft 的 NBT(Named Binary Tag,命名二进制标签)格式进行可靠的序列化。
- 数据在玩家登录时加载,登出时保存,确保余额在服务器重启或玩家会话之间保持持久。
EconomyMod
Overview
EconomyMod is a NeoForge-based Minecraft mod designed to introduce a lightweight in-game economy system, using emeralds as the primary currency. It enables players to manage virtual balances through intuitive commands, with persistent data storage to maintain progress across server restarts or player sessions. The mod is compatible with Minecraft 1.21.1 and integrates seamlessly with NeoForge's modding ecosystem.
Core Features
1. Currency & Balance Management
- Emeralds as Currency: Uses Minecraft's vanilla emeralds (
Items.EMERALD) as the base currency, bridging in-game items with virtual balances.
- Virtual Balance: Players can store emeralds in a persistent virtual balance, separate from their inventory, to avoid inventory clutter.
2. In-Game Commands
All interactions with the economy system are handled via chat commands:
| Command |
Syntax |
Description |
| Deposit |
/deposit <amount> |
Converts <amount> emeralds from the player’s inventory to virtual balance. Fails if the player has insufficient emeralds. |
| Withdraw |
/withdraw <amount> |
Converts <amount> emeralds from virtual balance to the player’s inventory. Fails if balance is insufficient or inventory is full. |
| Check Balance |
/balance |
Shows the player’s current virtual balance. |
| Check Others’ Balance |
/balance <player> |
(Admin-only, requires permission level 2) Shows the virtual balance of a specified player. |
| Transfer |
/pay <target> <amount> |
Transfers <amount> emeralds from the sender’s virtual balance to the target player’s balance. Fails if the sender’s balance is insufficient. |
| Settings |
/setbalance <player> <amount> |
command to set a player's emerald amount (admin) |
3. Persistent Data Storage
- Player balances are saved locally in the
economy_data/ directory (created automatically) as .dat files, using Minecraft’s NBT (Named Binary Tag) format for reliable serialization.
- Data is loaded when a player logs in and saved when they log out, ensuring balances persist across server restarts or player sessions.
评论 0
登录后参与评分
还没有评论,来抢沙发吧