crwdns20214:0crwdne20214:0

crwdns20215:0:javadoc:crwdnd20215:0:javadoc:crwdnd20215:0:javadoc:crwdne20215:0

crwdns20216:0crwdne20216:0

crwdns20217:0crwdne20217:0

crwdns20218:0:javadoc:crwdne20218:0

crwdns20219:0crwdne20219:0

crwdns20220:0crwdne20220:0

  • crwdns42630:0:javadoc:crwdne42630:0

  • crwdns20222:0crwdne20222:0

  • crwdns20223:0crwdne20223:0

  • crwdns20224:0crwdne20224:0

  • crwdns20225:0crwdne20225:0

  • crwdns20226:0crwdne20226:0

crwdns20227:0:javadoc:crwdne20227:0

crwdns20228:0crwdne20228:0

crwdns20229:0crwdne20229:0

crwdns20230:0crwdne20230:0

TradeOffer offer = TradeOffer.builder()
    .firstBuyingItem(ItemStack.of(ItemTypes.DIRT, 5))
    .sellingItem(ItemStack.of(ItemTypes.GRASS, 3))
    .uses(0)
    .maxUses(4)
    .canGrantExperience(false)
    .build();

crwdns20231:0crwdne20231:0

crwdns42631:0:javadoc:crwdnd42631:0:javadoc:crwdne42631:0

Note

crwdns20233:0crwdne20233:0

crwdns20234:0crwdne20234:0

crwdns20235:0crwdne20235:0

TradeOfferGenerator tradeOfferGenerator = TradeOfferGenerator.builder()
        .setPrimaryItemGenerator(random -> ItemStack.of(ItemTypes.DIRT, random.nextInt(3) + 5))
        .setSellingGenerator(random -> ItemStack.of(ItemTypes.GRASS, 5))
        .startingUses(VariableAmount.baseWithVariance(2, 1))
        .maxUses(VariableAmount.fixed(5))
        .experienceChance(0.5)
        .build();

crwdns20236:0crwdne20236:0

  • crwdns20237:0crwdne20237:0

  • crwdns20238:0crwdne20238:0

  • crwdns20239:0crwdne20239:0

  • crwdns20240:0crwdne20240:0

crwdns20241:0crwdne20241:0

Note

crwdns20242:0crwdne20242:0

crwdns20243:0crwdne20243:0

crwdns42632:0:javadoc:crwdne42632:0

VillagerRegistry villagerRegistry = this.game.getRegistry().getVillagerRegistry();
List<TradeOfferListMutator> generators = new ArrayList<>(villagerRegistry.getMutatorsForCareer(Careers.FARMER, 1));
generators.addAll(additionalFarmerLevel1TradeOffers());
villagerRegistry.setMutators(Careers.FARMER, 1, generators);

crwdns20245:0crwdne20245:0

Note

crwdns20246:0crwdne20246:0