Villagers trades doesn't work!

Discussion in 'Plugin Development' started by BlaSfaiMe, Feb 7, 2021.

  1. Offline

    BlaSfaiMe

    Hi,
    I'm trying to make some custom trades with a villager, but it seems that the trades aren't available (like after a certain amount of trades, they're blocked). I'm working on 1.16.4.

    Could you help me ?
    Thanks!

    there is my code, in case of
    Code:
    public static void addTrade(Villager villager, TradesUtils villagerTrade) {
            EntityVillager entityVillager = ((CraftVillager)villager).getHandle();
            entityVillager.setSilent(true);
            MerchantRecipeList list = entityVillager.getOffers();
            ItemStack item1;
            ItemStack item2;
            if (TradesUtils.hasItem2(villagerTrade)) {
                item1 = CraftItemStack.asNMSCopy(TradesUtils.getItem1(villagerTrade));
                item2 = CraftItemStack.asNMSCopy(TradesUtils.getItem2(villagerTrade));
                ItemStack rewardItem = CraftItemStack.asNMSCopy(TradesUtils.getRewardItem(villagerTrade));
                list.add(new MerchantRecipe(item1, item2, rewardItem, 0, 99999, 0f));
            } else {
                item1 = CraftItemStack.asNMSCopy(TradesUtils.getItem1(villagerTrade));
                item2 = CraftItemStack.asNMSCopy(TradesUtils.getRewardItem(villagerTrade));
                list.add(new MerchantRecipe(item1, item2, 0, 99999, 0f));
            }
        }
     
  2. Offline

    Niv-Mizzet

    Thats normal? Trades normally get blocked after a certain amount of trades
     
    Kars likes this.

Share This Page