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 上获取。
Tyco
Tyco adds a full player-driven currency system to Minecraft. It includes ore/log generators that consume coins to produce resources, a seller block that converts items into coins, a banker block for converting between coin tiers, and a shop block where players can browse and buy items using coins.
Why you'd want this: almost every mechanic in Tyco is data-driven and modular, so modpack developers can freely add, remove, or override recipes, prices, and categories through datapacks or KubeJS without touching any Java code. This makes Tyco a flexible base economy system rather than a fixed, one-size-fits-all mod.
Before downloading: Tyco ships with a working default economy (vanilla ore/log recipes, a six-tier coin system, and sample shop items) so it functions immediately with no setup. Everything described below is optional customization for modpack developers who want to change that default behavior.
Recipe Types Overview
Every recipe type below works identically whether defined as a JSON file in a datapack (data/tyco/recipe/<type>/*.json) or added through KubeJS's ServerEvents.recipes.
| Type |
Used by |
Purpose |
tyco:generating |
Miner, Lumberjack |
Defines what a generator produces from a block below it, and its coin cost |
tyco:selling |
Seller |
Defines what the Seller converts an item into (coins) |
tyco:banking |
Banker |
Defines custom currency conversions (the built-in Coal to Netherite tiers are config-driven, not recipe-driven — see the Config section below) |
tyco:shop_entry |
Shop |
Defines an item for sale, its price, and which category tab it belongs to |
tyco:shop_category |
Shop |
Defines a category tab's display (text or item icon) |
tyco:generating (Miner / Lumberjack)
ServerEvents.recipes(event => {
event.custom({
type: 'tyco:generating',
machine: 'miner', // 'miner' or 'lumberjack' - which block this applies to
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, // optional, default 1
max_count: 1, // optional, default 1
bonus_chance: 0.05, // optional, default 0 - chance to override with bonus_count instead
bonus_count: 2, // optional, default 0
interval: 20 // ticks between production cycles (20 = 1 second)
})
})
Weighted output pool (multiple possible results, for example a "mystery ore" block)
Use outputs instead of output/min_count/max_count/bonus_chance/bonus_count. If outputs is present, it takes priority entirely:
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
})
})
Weights are relative and do not need to sum to 100.
tyco:selling (Seller)
Direction is always item in, coins out.
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 — custom currencies only)
The built-in Coal to Netherite coin tier conversion is not driven by this recipe type. It is handled directly by the Banker block using live config values (see the Config section below), so it can be adjusted instantly without a recipe reload.
Use tyco:banking only for currencies other than Tyco's own six coins, such as a modpack's own custom currency item:
ServerEvents.recipes(event => {
event.custom({
type: 'tyco:banking',
direction: 'up', // 'up' or 'down' - which Banker mode this applies to
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, // always denominated in Coal Coin value
category: 'Ores' // optional, defaults to "Misc"
})
})
Players can pay with any mix of coin tiers. The Shop automatically converts using the live Banker config ratios and gives change back in the largest denominations that fit.
tyco:shop_category (Shop tab display)
Optional. Any category referenced by a shop_entry automatically gets a plain text tab. Define this only if you want a category to show an item icon instead:
ServerEvents.recipes(event => {
event.custom({
type: 'tyco:shop_category',
category: 'Ores',
icon: 'minecraft:diamond' // optional - omit entirely for a plain text tab
})
})
Removing or Overriding Shipped Defaults
Every recipe Tyco ships has a predictable ID in the form tyco:<recipe_type>/<file_name>. To replace one, remove it first, then add your own version:
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
})
})
Wiping an entire category of defaults
ServerEvents.recipes(event => {
event.remove({ type: 'tyco:generating' }) // removes ALL default Miner/Lumberjack recipes
event.remove({ type: 'tyco:selling' }) // removes ALL default Seller recipes
event.remove({ type: 'tyco:shop_entry' }) // removes ALL default Shop items
})
tyco:banking recipes are unaffected by any of the above, since the built-in tier conversion does not use them.
Config File (config/tyco-common.toml)
Generated automatically on first launch.
[banker]
# How many Coal Coins are needed to convert into 1 Copper Coin
coalToCopperRatio = 10
# How many Copper Coins are needed to convert into 1 Iron Coin
copperToIronRatio = 10
# How many Iron Coins are needed to convert into 1 Gold Coin
ironToGoldRatio = 10
# How many Gold Coins are needed to convert into 1 Diamond Coin
goldToDiamondRatio = 10
# How many Diamond Coins are needed to convert into 1 Netherite Coin
diamondToNetheriteRatio = 10
# How many ticks the Banker takes to perform one coin tier conversion (20 ticks = 1 second)
conversionIntervalTicks = 20
The Banker ratios above are also what the Shop uses to calculate change when a player pays with a higher-tier coin than an item's price requires.
Item Tags
Coins belong to the tyco:coins tag (data/tyco/tags/item/coins.json), which controls what the Miner, Lumberjack, Seller, and Banker input slots accept. Custom currencies added by a modpack are not accepted by Tyco's own machines unless added to this tag, but they can still be used through the tyco:banking and tyco:shop_entry recipe types above, which check the specific item ID directly rather than the tag.
Full source, build instructions, and further documentation are available on GitHub.
评论 0
登录后参与评分
还没有评论,来抢沙发吧