COWMODSКаталог модов

Data Trades

Allows easy customization of villager trades using datapacks

Автор: possible_triangle35 тыс.45обновлён 20 авг. 2024 г.
ЭкономикаУправлениеУтилиты

Описание

Data Trades

This mod adds the ability for players, serverowners or modpack creators to overwrite villager trades using datapacks. The amount of trades per level and the actual items traded can be customized using json files. A command for development purposes called /villagers refresh will manually trigger a re-asign of trades to all loaded villagers.

Folder Structure

Using a datapack, the trades of a specific villager profession can be overwritten by creating a JSON file following this pattern:

data/[namespace]/villager/professions/[path].json

[namespace] and [path] should be overwritten by the specific villager professions ID. For example, to create trades for the minecraft:fletcher profession, a file under data/minecraft/villager/professions/fletcher.json should be created. It's content should follow the Profession Schema

Similar, the wandering trader can be overwritten by adding a file at

data/minecraft/villager/traders/wandering.json

following the Trader Schema

Examples

Datapacks with examples can be found here.

JSON Schema

The JSON file should contain an object with these properties:

Profession

PropertyTypeDefaultDescription
levelsmap<int,TradeLevel>{}see below

The levels object takes the form of a map with numeric keys and object values. The keys represent the actual villagers level with 1 being Novice until 5 being Master.

Trader

PropertyTypeDefaultDescription
genericTradeLevelnullgeneric trades
rareTradeLevelnullrare trades

In vanilla minecraft, each wandering trader chooses 5 generic and 1 rare trades once it spawns. Both the trades themselves and their count can be overwritten using the same format as the one used for a villager's level.

TradeLevel

PropertyTypeDefaultDescription
takeNumberProvidernullamount of trades added by this level
trades(Trade | string)[][]list of trades from which the taken ones are randomly choosen

Trade

PropertyTypeDefaultDescription
disabledbooleanfalsedisabled trades will be ignored
sellsTradeIngredient[]item sold to the player
wantsTradeIngredient[][]maximum of two items the player has to pay
usesint0
maxUsesint10
xpint1
priceMultiplierfloat2.0
demandint0

TradeIngredient

Extension of the vanilla Ingredient with a few extra properties. They can take the form of an item or tag and specify all properties of the vanilla Ingredient JSON. Since Villager trades are ItemStack based that does not mean that a player can pay a #minecraft:stone_tool_materials with any stone type, but only the one that is randomly selected from the tag each time the trade is used.

PropertyTypeDefault
functionsLootFunction[][]
countintnull

The levels object takes the form of a map with numeric keys and object values. The keys represent the actual villagers level with 1 being Novice until 5 being Master.

Advanced Usage

Instead of a Trade object, the TradeLevel trades property can also contain string IDs referencing an external trade. These trades can be saved under the path below to organize & reuse them.

data/[namespace]/villager/trades/[path].json

Последние версии

Все версии →
beta

Neoforge 3.0.1

3.0.1
20 авг. 2024 г.1,1 тыс.Minecraft: 1.21.1neoforge
Скачать
Что нового
- catch exceptions from decoding loot conditions & functions again - provide registry context to codecs
beta

Fabric 3.0.1

3.0.1
20 авг. 2024 г.748Minecraft: 1.21.1fabric
Скачать
Что нового
- catch exceptions from decoding loot conditions & functions again - provide registry context to codecs
beta

Neoforge 3.0.0

3.0.0
19 авг. 2024 г.78Minecraft: 1.21.1neoforge
Скачать
Что нового
- Initial port to 1.21.1 - Switched from forge to neoforge (fabric still supported)
beta

Fabric 3.0.0

3.0.0
19 авг. 2024 г.106Minecraft: 1.21.1fabric
Скачать
Что нового
- Initial port to 1.21.1 - Switched from forge to neoforge (fabric still supported)
release

Forge 2.1.1

2.1.1
27 сент. 2023 г.29,5 тыс.Minecraft: 1.20.1forge
Скачать
Что нового
## What's Changed * fixed rare trade amount * added optional selector to `villager refresh` command * full fabric support
release

Fabric 2.1.1

2.1.1
27 сент. 2023 г.932Minecraft: 1.20.1fabric
Скачать
Что нового
## What's Changed * fixed rare trade amount * added optional selector to `villager refresh` command * full fabric support
release

Forge 1.1.1

1.1.1
27 сент. 2023 г.286Minecraft: 1.19.2forge
Скачать
Что нового
## What's Changed * fixed rare trade amount * added optional selector to `villager refresh` command * full fabric support
release

Fabric 1.1.1

1.1.1
27 сент. 2023 г.182Minecraft: 1.19.2fabric
Скачать
Что нового
## What's Changed * fixed rare trade amount * added optional selector to `villager refresh` command * full fabric support
release

Forge 2.1.0

2.1.0
22 сент. 2023 г.118Minecraft: 1.20.1forge
Скачать
Что нового
## What's Changed * add ability to overwrite wandering trader offers * added an optional loot condition to trades
release

Fabric 2.1.0

2.1.0
22 сент. 2023 г.119Minecraft: 1.20.1fabric
Скачать
Что нового
## What's Changed * add ability to overwrite wandering trader offers * added an optional loot condition to trades