crwdns40139:0crwdne40139:0

crwdns40140:0:javadoc:crwdnd40140:0:javadoc:crwdnd40140:0:javadoc:crwdne40140:0

crwdns40141:0crwdne40141:0

crwdns40142:0crwdne40142:0

crwdns40143:0:javadoc:crwdne40143:0

crwdns40144:0crwdne40144:0

crwdns40145:0crwdne40145:0

  • crwdns40146:0:javadoc:crwdne40146:0

  • crwdns40147:0crwdne40147:0

  • crwdns40148:0crwdne40148:0

  • crwdns40149:0crwdne40149:0

  • crwdns40150:0crwdne40150:0

  • crwdns40151:0crwdne40151:0

crwdns40152:0:javadoc:crwdne40152:0

crwdns40153:0crwdne40153:0

crwdns40154:0crwdne40154:0

crwdns40155:0crwdne40155:0

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

crwdns40156:0crwdne40156:0

crwdns40157:0:javadoc:crwdnd40157:0:javadoc:crwdne40157:0

Note

crwdns40158:0crwdne40158:0

crwdns40159:0crwdne40159:0

crwdns40160:0crwdne40160: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();

crwdns40161:0crwdne40161:0

  • crwdns40162:0crwdne40162:0

  • crwdns40163:0crwdne40163:0

  • crwdns40164:0crwdne40164:0

  • crwdns40165:0crwdne40165:0

crwdns40166:0crwdne40166:0

Note

crwdns40167:0crwdne40167:0

crwdns40168:0crwdne40168:0

crwdns40169:0:javadoc:crwdne40169: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);

crwdns40170:0crwdne40170:0

Note

crwdns40171:0crwdne40171:0