Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aws404/SimpleJsonVillagerTrades
As simple as it sounds, a small jij-able library to modify/add/remove Villager trades via datapacks.
https://github.com/aws404/SimpleJsonVillagerTrades
Last synced: 14 days ago
JSON representation
As simple as it sounds, a small jij-able library to modify/add/remove Villager trades via datapacks.
- Host: GitHub
- URL: https://github.com/aws404/SimpleJsonVillagerTrades
- Owner: aws404
- License: cc0-1.0
- Created: 2022-02-02T07:04:59.000Z (almost 3 years ago)
- Default Branch: 1.20
- Last Pushed: 2023-05-15T10:23:39.000Z (over 1 year ago)
- Last Synced: 2024-08-02T06:17:56.021Z (4 months ago)
- Language: Java
- Homepage:
- Size: 136 KB
- Stars: 1
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-fabric - SimpleJsonVillagerTrades - A small jar-in-jar-able or standalone library to modify/add merchant trades via datapacks. ([Wiki](https://github.com/aws404/SimpleJsonVillagerTrades/wiki/Trade-Offer-JSON-Files)) `CC0` (Uncategorized / Uncategorized)
README
# Simple JSON Villager Trades
As simple as it sounds, a small jij-able/standalone library to modify/add merchant trades via datapacks.## For Datapackers
You are able to modify merchant trades through JSON files the `data//trade_offers/` directory.
For example:
```json
{
"__COMMENT": "This adds a ruined portal map to the Cartographer's trades.","profession": "minecraft:cartographer",
"replace": false,
"offers": {
"apprentice": [
{
"type": "minecraft:sell_map",
"price": 5,
"name_key": "filled_map.ruined_portal",
"feature_tag": "minecraft:ruined_portal",
"icon": "target_x",
"max_uses": 10,
"experience": 2
}
]
}
}
```
For more tutorials and more information on modifying merchant trades, see [the wiki](https://github.com/aws404/SimpleJsonVillagerTrades/wiki).## Compatibility
SJVT uses Minecraft's hardcoded trade map as a base for the datapacks to build on top of, so it should work with most mods, even those who add new villager professions.
You can also export the hardcoded map (including non-native support mods) as a datapack by running the `sjvt:build` command.## For Mod Developers
You can include the mod using the following repository and dependency in your `build.gradle` (where `[TAG]` is the latest version):
```gradle
repositories {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
}dependencies {
modImplementation include("maven.modrinth:sjvt:[TAG]") //To include (jij) in your mod
modImplementation "maven.modrinth:sjvt:[TAG]" // To require the mod to be installed seperatly
}
```### Custom Trade Offer Factories
To create a trade offer factory, implement the `SerializableTradeOfferFactory` interface.
Then register the codec to the `TradeOfferFactories.TRADE_OFFER_FACTORY_REGISTRY` registry.
You can also use methods and fields in the `CodecHelper` class to assist in the creation of codecs.Then see 'For Datapackers'