use of org.spongepowered.api.item.merchant.VillagerRegistry in project SpongeCommon by SpongePowered.
the class SpongeVillagerRegistry method registerVanillaTrades.
static void registerVanillaTrades() {
VillagerRegistry instance = getInstance();
for (Career career : CareerRegistryModule.getInstance().getAll()) {
SpongeCareer spongeCareer = (SpongeCareer) career;
EntityVillager.ITradeList[][] careerLevels = EntityVillager.DEFAULT_TRADE_LIST_MAP[((SpongeProfession) spongeCareer.getProfession()).type][spongeCareer.type];
for (int level = 0; level < careerLevels.length; level++) {
EntityVillager.ITradeList[] offers = careerLevels[level];
ImmutableList.Builder<TradeOfferListMutator> builder = ImmutableList.builder();
for (int i = 0; i < offers.length; i++) {
builder.add(generatorFor(offers[i]));
}
instance.setMutators(career, level + 1, builder.build());
}
}
}
Aggregations