MiguelCrates

模组

· 作者 Miguel-LFCG

为 MiguelEconomy 注入激情,通过完全可定制且带有动画效果的战利品箱,为您的服务器打造独特的奖励系统!

0 本站下载 0 关注 更新于 6 个月前

最新 1.0.4 · 1.20.1 · Forge

一键开服(送7天)

MiguelCrates

MiguelCrates 将简单的物品发放转变为一种活动体验。它为我的世界添加了完全动画化、令人兴奋的宝箱,并与你的经济系统挂钩,让玩家忍不住想要“再来一次”。


如何创建你自己的自定义宝箱

使用在线宝箱生成器:

或者

  1. 找到文件夹: 进入服务器的配置文件夹 (config/migueleconomy/crates)。
  2. 复制并粘贴: 复制一个现有文件(例如 common.json),并将其重命名为类似 vip_crate.json 的名称。
  3. 编辑详细信息: 使用任何文本编辑器(如记事本)打开它。
    • 将名称更改为 "VIP Crate"。
    • 选择纹理(颜色)以决定其外观。
    • 列出奖励: 只需输入你想要的物品(例如 "minecraft:diamond")、数量以及它们的稀有度。
    • 提示:你甚至可以设置执行命令(带有自定义图标!)或给予金钱。
  4. 重启: 重启服务器,你的新宝箱就可以放置使用了!
完整宝箱指南

创建和编辑宝箱

MiguelCrates 使用 JSON 配置文件来定义宝箱。这允许你轻松地创建新宝箱或修改现有宝箱,而无需更改模组代码。

位置

宝箱配置文件位于你的 Minecraft 实例的 config/migueleconomy/crates/ 目录中。

  • 服务器/客户端: config/migueleconomy/crates/

每个宝箱都是一个独立的 .json 文件。文件名决定了宝箱的唯一 ID(例如 common.json -> common)。

宝箱结构

宝箱 JSON 文件的基本结构如下:

{
  "display_name": "My Custom Crate",
  "description": "A description of what's inside.",
  "icon": "minecraft:chest",
  "texture": "miguelcrates:block/common_crate",
  "rewards": [
    ...
  ],
  "obtain": {
    "sources": [
      ...
    ]
  }
}

字段

字段 类型 描述
display_name String 在 GUI 和物品上显示的名称。
description String 工具提示中显示的描述文本。
icon String 用于代表宝箱的物品 ID(例如 minecraft:chest)。
texture String 自定义渲染器的纹理路径(通常为 miguelcrates:block/<name>)。
rewards List 可能的奖励列表(见下文)。
obtain Object (可选)定义玩家如何获得此宝箱(见下文)。

简化版附魔(推荐)

与其使用复杂的 NBT 字符串,不如使用 enchantments 块来为物品添加附魔。这适用于书和工具。

{
    "item": "minecraft:enchanted_book",
    "quantity": 1,
    "enchantments": {
        "minecraft:sharpness": 5,
        "minecraft:unbreaking": 3
    },
    "weight": 10
}

高级 NBT

对于更复杂的数据(属性、名称等),你仍然可以使用 nbt 字段。

{
    "item": "minecraft:diamond_sword",
    "nbt": "{display:{Name:'{\"text\":\"Excalibur\"}'}}",
    "weight": 5
}

奖励

rewards 列表包含定义玩家可能赢得内容的对象。

"rewards": [
  {
    "item": "minecraft:diamond",
    "quantity": 2,
    "weight": 10
  },
  {
    "command": "give @p minecraft:stone 64",
    "weight": 50
  },
  {
    "item": "minecraft:experience_bottle",
    "command": "xp add @p 5 levels",
    "weight": 10
  },
  {
    "item": "migueleconomy:money",
    "nbt": "{MoneyValue:100L}",
    "weight": 20
  }
]
  • item: 物品的资源位置(例如 minecraft:iron_sword)。如果与 command 一起使用,则作为图标。
  • command: 要执行的命令。使用 @p 指代打开宝箱的玩家。
  • name: (可选)奖励的自定义显示名称(例如 "5 Levels of XP")。
  • quantity: (可选,默认值为 1)要给予的物品数量。
  • nbt: (可选)物品的 NBT 数据字符串。
  • weight: 概率权重。权重越高 = 几率越大。
    • 概率 = weight / total_weight_of_all_rewards

获取方法

obtain 部分定义了宝箱在世界中生成的方式。它包含一个 sources 列表。

1. 合成 (craft)

允许玩家在合成台中合成宝箱。

{
  "type": "craft",
  "recipe": {
    "type": "minecraft:crafting_shaped",
    "category": "misc",
    "pattern": [
      "AAA",
      "ABA",
      "AAA"
    ],
    "key": {
      "A": { "item": "minecraft:planks" },
      "B": { "item": "minecraft:chest" }
    },
    "result": {
      "id": "miguelcrates:crate",
      "count": 1,
      "components": {
        "minecraft:custom_data": { "CrateId": "your_crate_id" }
      }
    }
  }
}

2. 生物掉落 (kill)

当特定实体被击杀时掉落。

{
  "type": "kill",
  "entity": "minecraft:zombie",
  "chance": 0.05
}
  • entity: 实体 ID(例如 minecraft:creeper, minecraft:ender_dragon)。
  • chance: 从 0.0 到 1.0 的概率(0.05 = 5%)。

3. 战利品表 (loot_table)

将宝箱注入原版战利品表(箱子)中。

{
  "type": "loot_table",
  "id": "minecraft:chests/simple_dungeon",
  "chance": 0.1
}
  • id: 要注入的战利品表 ID。
  • chance: 宝箱出现在箱子中的概率。

示例文件 (example.json)

{
  "display_name": "Example Crate",
  "description": "An example configuration.",
  "icon": "minecraft:barrel",
  "texture": "miguelcrates:block/common_crate",
  "rewards": [
    {
      "item": "minecraft:apple",
      "quantity": 5,
      "weight": 50
    },
    {
      "item": "minecraft:golden_apple",
      "weight": 10
    }
  ],
  "obtain": {
    "sources": [
      {
        "type": "kill",
        "entity": "minecraft:skeleton",
        "chance": 0.02
      }
    ]
  }
}

游戏内命令 (管理员)

使用这些命令来管理宝箱。

给予宝箱

/miguelcrates give <player> <crate_id> [amount]

  • 示例 1(给自己一个稀有箱子): /miguelcrates give @p rare
  • 示例 2(给某玩家 5 个普通箱子): /miguelcrates give PlayerName common 5

恢复默认箱子

/miguelcrates default <name|all>

  • 恢复缺失或被删除的默认箱子。
  • 示例:/miguelcrates default all(恢复所有 20 多个主题箱子)
  • 示例:/miguelcrates default miner(仅恢复矿工箱子)

重载配置

/miguelcrates reload

  • 如果在服务器运行时编辑了 JSON 文件,此命令可刷新模组。

打开菜单(快捷键)

/crates, /crate 或 /box

ROADMAP

你是这个资源的作者?登录后可认领此资源。

评论 0

0.0
暂无评分
5 星
0
4 星
0
3 星
0
2 星
0
1 星
0
我的评分

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源