Skip to content

Commit

Permalink
Updated doc.
Browse files Browse the repository at this point in the history
  • Loading branch information
Estecka committed Nov 7, 2024
1 parent 0a49137 commit 80a5974
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Shifting Wares

Causes villager to occasionally re-roll their trade offers, up to three times a day.
This effect is the most noticeable on professions that can sell enchanted items; a single one of these villagers will be able to offer a much greater variety of wares over time.
Causes villager to re-roll their trade offers on their own accord, up to three times a day.
The effect of thiswill be most noticeable on professions that can sell enchanted or coloured items; a single one of these villagers will be able to offer a much greater variety of wares over time.

This aims to reduce the benefits of exploitative playstyle, while increasing the viability of more serendipitous playstyles.
This aims to reduce the benefits of exploitative playstyle, while making serendipitous playstyles more viable.

While it's still possible to get the trade you want by repeatedly breaking a villager's workstation, the benefits of doing so become *very* short lived. Waiting for a natural reroll is probably a better use of your time.

Because trades no longer make the identity of a villager, they become much easier to replace if they die, so you don't need to care as much about their safety. You can let them roam around freely with little risk.
Because all trades eventually expire, villagers become much easier to replace if they die, so you don't need to care as much about their safety. You can let them roam around freely with little risk.

## Triggers

There are two gamerules that control when trades can be re-rolled. Both are enabled by default.
There are two gamerules that control when trades can be re-rolled. Both are enabled by default.
Disabling all rules effectively disables the mod.
- `shiftingWares.dailyReroll`:
Causes villagers to re-roll **all** their offers once per day, the first time they restock at their job station.
Expand All @@ -37,5 +37,5 @@ Placeholder trades will never take the place of a valid trade; they will only sh
## For developpers
By default, shifting-Wares assumes 2 trades per level, and pulls its trade pools from the same place as Vanilla. Mods can override this by using the `shifting-wares` entry-point, and implementing [`ITradeLayoutProvider`](./src/main/java/fr/estecka/shiftingwares/api/ITradeLayoutProvider.java).

If your mod contains custom implementation of map trade factories, or other similar items, you can communicate extra data to Shifting-Wares by implementing the same methods defined in [`IShiftingTradeFactory`](./src/main/java/fr/estecka/shiftingwares/api/IShiftingTradeFactory.java).
No dependency on Shifting-Wares is required, you only need to provide methods with the appropriate prototypes in your factories.
If your mod contains custom implementation of map trade factories, or produces other items attached with with permanent data, you can communicate to Shifting-Wares that they should be persistent, by implementing the same methods defined in [`IShiftingTradeFactory`](./src/main/java/fr/estecka/shiftingwares/api/IShiftingTradeFactory.java).
No dependency on Shifting-Wares is required for this, you only need to provide methods with matching names and prototypes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ static public IShiftingTradeFactory Of(TradeOffers.Factory factory){
}

/**
* Prevents the trades from being be rerolled, until its item has been sold
* at least once. This is, for example, relevant to Exploration Maps, whose
* mere creation leaves a permanent impact on the world.
* Prevents the generated trades from being be rerolled, until its item has
* been sold at least once. This is, for example, relevant to Exploration
* Maps, whose mere creation leaves a permanent impact on the world.
*/
public default boolean shiftingwares$IsItemPersistent(){
return false;
}

/**
* This will be used to associate a trade offer to its factory, and avoid
* trade duplicata when rerolling. This should be set for persistent trades,
* else the villager's offers may get clogged up whith repeated copies of
* the same trades. Using this on non-persistent trades will also help
* preventing duplicatas from being generated during depleted-rerolls.
* This will be used to associate existsing trade offers to their factories,
* and avoid trade duplicata when rerolling. This should be set for
* persistent trades, else the villager's offers may get clogged up whith
* repeated copies of the same trades. This may still be used on non-
* persistent trades, since those can also generate duplicatas during
* depleted rerolls.
*/
public default @Nullable Identifier shiftingwares$GetTradeId(){
return null;
Expand Down

0 comments on commit 80a5974

Please sign in to comment.