Search in sources :

Example 1 with TradeOffer

use of com.denizenscript.denizen.nms.util.TradeOffer in project Denizen-For-Bukkit by DenizenScript.

the class PacketOutTradeListImpl method setTradeOffers.

@Override
public void setTradeOffers(List<TradeOffer> tradeOffers) {
    MerchantRecipeList list = new MerchantRecipeList();
    for (TradeOffer offer : tradeOffers) {
        MerchantRecipe recipe = new MerchantRecipe(CraftItemStack.asNMSCopy(offer.getFirstCost()), CraftItemStack.asNMSCopy(offer.getSecondCost()), CraftItemStack.asNMSCopy(offer.getProduct()), offer.getCurrentUses(), offer.getMaxUses(), offer.xp, offer.priceMultiplier);
        recipe.rewardExp = offer.rewardExp;
        list.add(recipe);
    }
    try {
        RECIPE_LIST.set(internal, list);
    } catch (IllegalAccessException e) {
        Debug.echoError(e);
    }
}
Also used : MerchantRecipeList(net.minecraft.server.v1_16_R3.MerchantRecipeList) MerchantRecipe(net.minecraft.server.v1_16_R3.MerchantRecipe) TradeOffer(com.denizenscript.denizen.nms.util.TradeOffer)

Example 2 with TradeOffer

use of com.denizenscript.denizen.nms.util.TradeOffer in project Denizen-For-Bukkit by DenizenScript.

the class PacketOutTradeListImpl method setTradeOffers.

@Override
public void setTradeOffers(List<TradeOffer> tradeOffers) {
    MerchantOffers list = new MerchantOffers();
    for (TradeOffer offer : tradeOffers) {
        MerchantOffer recipe = new MerchantOffer(CraftItemStack.asNMSCopy(offer.getFirstCost()), CraftItemStack.asNMSCopy(offer.getSecondCost()), CraftItemStack.asNMSCopy(offer.getProduct()), offer.getCurrentUses(), offer.getMaxUses(), offer.xp, offer.priceMultiplier);
        recipe.rewardExp = offer.rewardExp;
        list.add(recipe);
    }
    try {
        RECIPE_LIST.set(internal, list);
    } catch (IllegalAccessException e) {
        Debug.echoError(e);
    }
}
Also used : MerchantOffer(net.minecraft.world.item.trading.MerchantOffer) MerchantOffers(net.minecraft.world.item.trading.MerchantOffers) TradeOffer(com.denizenscript.denizen.nms.util.TradeOffer)

Aggregations

TradeOffer (com.denizenscript.denizen.nms.util.TradeOffer)2 MerchantRecipe (net.minecraft.server.v1_16_R3.MerchantRecipe)1 MerchantRecipeList (net.minecraft.server.v1_16_R3.MerchantRecipeList)1 MerchantOffer (net.minecraft.world.item.trading.MerchantOffer)1 MerchantOffers (net.minecraft.world.item.trading.MerchantOffers)1