Tyco

模组

· 作者 CaptainLuckyBang

挖矿、出售、存储和购物,拥有完全可模组化的硬币经济系统。

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

最新 0.3.0 · 1.21.1 · NeoForge

一键开服(送7天)

Tyco

Tyco 为 Minecraft 添加了一套完整的玩家驱动货币系统。它包括消耗硬币以产出资源的矿石/原木生成器、将物品转换为硬币的卖家方块、用于在不同硬币层级间进行转换的银行家方块,以及允许玩家浏览并使用硬币购买物品的商店方块。

为什么你需要这个模组: Tyco 中的几乎所有机制都是基于数据且模块化的,因此整合包开发者可以通过数据包或 KubeJS 自由地添加、移除或覆盖配方、价格和分类,而无需触碰任何 Java 代码。这使得 Tyco 成为一个灵活的基础经济系统,而非一个固定不变的“一刀切”模组。

下载前须知: Tyco 自带一套可正常运行的默认经济系统(包含原版矿石/原木配方、六级硬币系统以及示例商店商品),因此无需任何设置即可立即运行。以下所有内容均为可选定制项,供希望更改默认行为的整合包开发者使用。


配方类型概览

无论是在数据包中以 JSON 文件定义(data/tyco/recipe/<type>/*.json),还是通过 KubeJS 的 ServerEvents.recipes 添加,以下每种配方类型的工作方式均相同。

类型 由...使用 用途
tyco:generating Miner, Lumberjack 定义生成器从其下方的方块产出的内容及其硬币成本
tyco:selling Seller 定义 Seller 将什么物品转换为(硬币)
tyco:banking Banker 定义自定义货币转换(内置的煤炭到下界合金层级转换是由配置驱动的,而非配方驱动——请参阅下方的配置部分)
tyco:shop_entry Shop 定义待售物品、其价格以及所属的分类标签页
tyco:shop_category Shop 定义分类标签页的显示方式(文本或物品图标)

tyco:generating (Miner / Lumberjack)

ServerEvents.recipes(event => {
  event.custom({
    type: 'tyco:generating',
    machine: 'miner',                  // 'miner' 或 'lumberjack' - 此配方适用于哪个方块
    blocks: ['minecraft:iron_ore', 'minecraft:deepslate_iron_ore'],
    coin_input: { item: 'tyco:coal_coin' },
    coin_count: 4,
    output: { id: 'minecraft:raw_iron' },
    min_count: 1,                      // 可选,默认为 1
    max_count: 1,                      // 可选,默认为 1
    bonus_chance: 0.05,                // 可选,默认为 0 - 触发时以 bonus_count 覆盖产出的几率
    bonus_count: 2,                    // 可选,默认为 0
    interval: 20                       // 生产周期之间的间隔刻数(20 = 1 秒)
  })
})

加权输出池(多种可能的结果,例如“神秘矿石”方块)

使用 outputs 替代 output/min_count/max_count/bonus_chance/bonus_count。如果存在 outputs,它将完全优先:

ServerEvents.recipes(event => {
  event.custom({
    type: 'tyco:generating',
    machine: 'miner',
    blocks: ['modid:mystery_ore'],
    coin_input: { item: 'tyco:coal_coin' },
    coin_count: 6,
    outputs: [
      { item: 'minecraft:raw_iron', weight: 50, min_count: 1, max_count: 1 },
      { item: 'minecraft:raw_copper', weight: 30, min_count: 1, max_count: 2 },
      { item: 'minecraft:raw_gold', weight: 15, min_count: 1, max_count: 1 },
      { item: 'minecraft:diamond', weight: 5, min_count: 1, max_count: 1, bonus_chance: 0.05, bonus_count: 2 }
    ],
    interval: 30
  })
})

权重是相对的,不需要总和为 100。


tyco:selling (Seller)

方向始终是物品进入,硬币流出。

ServerEvents.recipes(event => {
  event.custom({
    type: 'tyco:selling',
    input: { item: 'minecraft:iron_ingot' },
    input_count: 1,
    output: { id: 'tyco:coal_coin', count: 5 },
    interval: 20
  })
})

tyco:banking (Banker — 仅限自定义货币)

内置的煤炭到下界合金硬币层级转换不由这种配方类型驱动。它直接由 Banker 方块使用实时配置值处理(请参阅下方的配置部分),因此可以在不重新加载配方的情况下即时调整。

仅对 Tyco 自身六种硬币以外的货币使用 tyco:banking,例如整合包自己的自定义货币物品:

ServerEvents.recipes(event => {
  event.custom({
    type: 'tyco:banking',
    direction: 'up',                  // 'up' 或 'down' - 此配方适用于哪种 Banker 模式
    input: { item: 'modid:custom_token' },
    input_count: 10,
    output: { id: 'modid:custom_token_gold' },
    interval: 20
  })
})

tyco:shop_entry (Shop)

ServerEvents.recipes(event => {
  event.custom({
    type: 'tyco:shop_entry',
    item: { id: 'minecraft:diamond', count: 1 },
    price: 50,                        // 始终以 Coal Coin 价值计价
    category: 'Ores'                  // 可选,默认为 "Misc"
  })
})

玩家可以使用任意组合的硬币层级进行支付。Shop 会自动使用实时的 Banker 配置比率进行转换,并以能凑整的最大面额找零。


tyco:shop_category (Shop 标签页显示)

可选。任何被 shop_entry 引用到的分类都会自动获得一个纯文本标签页。仅当你希望某个分类显示物品图标而非纯文本时,才定义此项:

ServerEvents.recipes(event => {
  event.custom({
    type: 'tyco:shop_category',
    category: 'Ores',
    icon: 'minecraft:diamond'         // 可选 - 省略此项以获得纯文本标签页
  })
})

移除或覆盖随附的默认值

Tyco 随附的每个配方都有一个可预测的 ID,格式为 tyco:<recipe_type>/<file_name>。要替换其中一个,请先将其移除,然后添加你自己的版本:

ServerEvents.recipes(event => {
  event.remove({ id: 'tyco:generating/iron' })

  event.custom({
    type: 'tyco:generating',
    machine: 'miner',
    blocks: ['minecraft:iron_ore', 'minecraft:deepslate_iron_ore'],
    coin_input: { item: 'tyco:coal_coin' },
    coin_count: 8,
    output: { id: 'minecraft:raw_iron', count: 2 },
    interval: 100
  })
})

清除整个类别的默认值

ServerEvents.recipes(event => {
  event.remove({ type: 'tyco:generating' })   // 移除所有默认的矿工/伐木工配方
  event.remove({ type: 'tyco:selling' })      // 移除所有默认的销售员配方
  event.remove({ type: 'tyco:shop_entry' })   // 移除所有默认的商店物品
})

tyco:banking 配方不受上述任何操作的影响,因为内置的等级转换并不使用它们。


配置文件 (config/tyco-common.toml)

在首次启动时自动生成。

[banker]
    # 需要多少煤炭币才能兑换 1 枚铜币
    coalToCopperRatio = 10
    # 需要多少铜币才能兑换 1 枚银币
    copperToIronRatio = 10
    # 需要多少银币才能兑换 1 枚金币
    ironToGoldRatio = 10
    # 需要多少金币才能兑换 1 枚钻石币
    goldToDiamondRatio = 10
    # 需要多少钻石币才能兑换 1 枚下界合金币
    diamondToNetheriteRatio = 10
    # 银行家执行一次货币等级转换所需的刻数(20 刻 = 1 秒)
    conversionIntervalTicks = 20

上述银行家的汇率比率也是商店用来计算找零的依据,当玩家使用比商品价格更高面额的货币支付时使用。


物品标签

所有硬币都属于 tyco:coins 标签 (data/tyco/tags/item/coins.json),该标签控制着矿工、伐木工、销售员和银行家输入槽所接受的内容。整合包添加的自定义货币除非加入此标签,否则 Tyco 自带的机器不会接受。但它们仍可通过上述 tyco:banking 和 tyco:shop_entry 配方类型使用,因为这些类型直接检查具体的物品 ID,而不是依赖标签。


完整的源代码、构建说明以及更多文档可在 GitHub 上获取。

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

评论 0

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

登录后参与评分

还没有评论,来抢沙发吧

评论配图

相似资源