Estecka / mc-Shifting-Wares

Villagers will occasionally reroll their trade offers
https://modrinth.com/mod/shifting-wares
GNU Affero General Public License v3.0
1 stars 0 forks source link

[Supplementaries] Trades resulting in air should not be displayed #14

Open BIG-Viljo opened 1 week ago

BIG-Viljo commented 1 week ago

Supplementaries has this feature, where cartographers sell maps to random locations, including structures from end and nether. Sometimes, when a fortress is attempted to be located in the overworld for example, it obviously fails. Without shifting wares such trade isn't generated, but when it is present a trade costing a compass and a couple of emeralds, that results in air can be generated when restocking. Of course, players are unable to "take" the air from the result, so no resources can be accidentally wasted, but it certainly doesn't look right.

Estecka commented 1 week ago

This is partially intended, as this situation can happen in vanilla. (Cartographers in worlds with structures disabled). However, it's supposed to look different from what you describe. Depending on your version of minecraft, the failed trade should either be all-air, or all-emeralds, and permanently disabled in all cases.

A trade's position in the list is the only indicator to its level. When a trade fails to generate, I need some kind of placeholder to keep the trades below it at the right position, else they they may not be rerolled with a trade of equivalent level.

Do you happen to have Villager-Config installed ? This behaviour ressembles what I've observed with map-trades generated by this mod; it doesn't "fail" to generate trades in the same way vanilla does.

Estecka commented 1 week ago

Supplementaries turns out to have its own custom trade system, so I assume you don't have Villager Config installed.

After testing it out on 1.20.1, I've found that supplementaries will still generate the trades you describe, even without Shifting-Wares installed; as far as I can tell, this is issue does not come from my end. You should take this issue to them instead, and request they handle their map trades more like vanilla.

When a vanilla trade-factory fails to generate a trade, it will return null instead of returning a partial trade. Vanilla picks up on that, and attempts to fall-back onto a different trade of the same level, so-on so-forth, until a valid trade is generated. If all options are exhausted, and no valid trade were found, then null is returned for this trade slot, and no new trade is given to the villager.

My mod handles null trades in the same way as vanilla, with the exception of falling back to a custom placeholder trade at the very end. Because null is a valid return values for failed trades, I prefer to assume that any "valid" trade passed to my mod was intended by whomever generated it, so I won't make an exception for those that sell air.