crwdns149711:0crwdne149711:0

crwdns149713:0:javadoc:crwdnd149713:0:javadoc:crwdnd149713:0:javadoc:crwdne149713:0

crwdns149715:0crwdne149715:0

crwdns149717:0crwdne149717:0

crwdns149719:0:javadoc:crwdne149719:0

crwdns149721:0crwdne149721:0

crwdns149723:0crwdne149723:0

  • crwdns149725:0:javadoc:crwdne149725:0

  • crwdns149727:0crwdne149727:0

  • crwdns149729:0crwdne149729:0

  • crwdns149731:0crwdne149731:0

  • crwdns149733:0crwdne149733:0

  • crwdns149735:0crwdne149735:0

crwdns149737:0:javadoc:crwdne149737:0

crwdns149739:0crwdne149739:0

crwdns149741:0crwdne149741:0

crwdns149743:0crwdne149743:0

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

crwdns149745:0crwdne149745:0

crwdns149747:0:javadoc:crwdnd149747:0:javadoc:crwdne149747:0

Note

crwdns149749:0crwdne149749:0

crwdns149751:0crwdne149751:0

crwdns149753:0crwdne149753: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();

crwdns149755:0crwdne149755:0

  • crwdns149757:0crwdne149757:0

  • crwdns149759:0crwdne149759:0

  • crwdns149761:0crwdne149761:0

  • crwdns149763:0crwdne149763:0

crwdns149765:0crwdne149765:0

Note

crwdns149767:0crwdne149767:0

crwdns149769:0crwdne149769:0

crwdns149771:0:javadoc:crwdne149771: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);

crwdns149773:0crwdne149773:0

Note

crwdns149775:0crwdne149775:0