@FunctionalInterface public interface TradeOfferGenerator extends Function<Random,TradeOffer>, TradeOfferListMutator
TradeOffers with a bit of
randomization based on ItemStackGenerators for populating
ItemStacks and finally generating a TradeOffer.
The primary use of this, and why the Random must be provided as
part of the Function signature is that during multiple world
instances, there's different Random instances instantiated, and more
can be provided without the necessity to change the generator. One advantage
to using a generator is the ability to provide some "randomization" or
"chance" on the various aspects of the generated TradeOffer versus
creating a static non-changing offer. Normally, the vanilla
TradeOffers are using a similar generator with limited scopes of
what the ItemStack can be customized as.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
TradeOfferGenerator.Builder
A simple builder to create a
TradeOfferGenerator. |
| Modifier and Type | Method and Description |
|---|---|
default void |
accept(Merchant owner,
List<TradeOffer> tradeOffers,
Random random)
Mutates the provided
list of TradeOffers
with the provided Merchant and Random to provide
possible contextualized information. |
static TradeOfferGenerator.Builder |
builder()
Gets a new
TradeOfferGenerator.Builder to create a new TradeOfferGenerator. |
static TradeOfferGenerator.Builder builder()
TradeOfferGenerator.Builder to create a new TradeOfferGenerator.default void accept(Merchant owner, List<TradeOffer> tradeOffers, Random random)
TradeOfferListMutatorlist of TradeOffers
with the provided Merchant and Random to provide
possible contextualized information.accept in interface TradeOfferListMutatorowner - The owner of the listtradeOffers - The trade offers currentlyrandom - The random to use for random number generation