Search in sources :

Example 1 with TradeOffer

use of net.minecraft.village.TradeOffer in project MCDungeonsArmors by chronosacaria.

the class TradesRegistry method registerVillagerOffers.

public static void registerVillagerOffers() {
    TradeOfferHelper.registerVillagerOffers(VillagerProfession.ARMORER, 5, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.CHAMPION).get(EquipmentSlot.HEAD)), 1, 30, 0.2F))));
    TradeOfferHelper.registerVillagerOffers(VillagerProfession.ARMORER, 5, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.CHAMPION).get(EquipmentSlot.CHEST)), 1, 30, 0.2F))));
    TradeOfferHelper.registerVillagerOffers(VillagerProfession.ARMORER, 5, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.CHAMPION).get(EquipmentSlot.LEGS)), 1, 30, 0.2F))));
    TradeOfferHelper.registerVillagerOffers(VillagerProfession.ARMORER, 5, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.CHAMPION).get(EquipmentSlot.FEET)), 1, 30, 0.2F))));
}
Also used : BasicTradeFactory(chronosacaria.mcda.factories.BasicTradeFactory) ItemStack(net.minecraft.item.ItemStack) TradeOffer(net.minecraft.village.TradeOffer)

Example 2 with TradeOffer

use of net.minecraft.village.TradeOffer in project MCDungeonsArmors by chronosacaria.

the class TradesRegistry method registerWanderingTrades.

public static void registerWanderingTrades() {
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.ENTERTAINER).get(EquipmentSlot.HEAD), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.ENTERTAINER).get(EquipmentSlot.CHEST), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.ENTERTAINER).get(EquipmentSlot.LEGS), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 64), new ItemStack(ArmorsRegistry.armorItems.get(ArmorSets.ENTERTAINER).get(EquipmentSlot.FEET), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 16), new ItemStack(ItemsRegistry.items.get(ItemID.FOX_PELT), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 24), new ItemStack(ItemsRegistry.items.get(ItemID.FOX_PELT_ARCTIC), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 16), new ItemStack(ItemsRegistry.items.get(ItemID.OCELOT_PELT), 1), 4, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 24), new ItemStack(ItemsRegistry.items.get(ItemID.OCELOT_PELT_BLACK), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 16), new ItemStack(ItemsRegistry.items.get(ItemID.WOLF_PELT), 1), 4, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 24), new ItemStack(ItemsRegistry.items.get(ItemID.WOLF_PELT_BLACK), 1), 1, 2, 0.0F))));
    TradeOfferHelper.registerWanderingTraderOffers(1, factories -> factories.add(new BasicTradeFactory(new TradeOffer(new ItemStack(Items.EMERALD, 16), new ItemStack(ItemsRegistry.items.get(ItemID.GOAT_PELT), 1), 4, 2, 0.0F))));
}
Also used : BasicTradeFactory(chronosacaria.mcda.factories.BasicTradeFactory) ItemStack(net.minecraft.item.ItemStack) TradeOffer(net.minecraft.village.TradeOffer)

Example 3 with TradeOffer

use of net.minecraft.village.TradeOffer in project tweakermore by Fallen-Breath.

the class MerchantScreenWidgetButtonPageMixin method renderMaxUsesAmount.

@Inject(method = "renderToolTip(II)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/screen/ingame/MerchantScreen$WidgetButtonPage;x:I", ordinal = 0))
private void renderMaxUsesAmount(int mouseX, int mouseY, CallbackInfo ci) {
    if (TweakerMoreConfigs.VILLAGER_OFFER_USES_DISPLAY.getBooleanValue()) {
        if (this.x + 50 <= mouseX && mouseX <= this.x + 65) {
            TradeOffer offer = this.field_19166.getContainer().getRecipes().get(this.index + ((MerchantScreenAccessor) this.field_19166).getIndexStartOffset());
            this.field_19166.renderTooltip(String.format("%d / %d", offer.getUses(), offer.getMaxUses()), mouseX, mouseY);
        }
    }
}
Also used : TradeOffer(net.minecraft.village.TradeOffer) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 4 with TradeOffer

use of net.minecraft.village.TradeOffer in project Biome-Makeover by Lemonszz.

the class MushroomVillagerEntity method fillRecipes.

protected void fillRecipes() {
    TradeOffers.Factory[] tradesCommon = TRADES.get(1);
    TradeOffers.Factory[] tradesRare = TRADES.get(2);
    if (tradesCommon != null && tradesRare != null) {
        TradeOfferList traderOfferList = this.getOffers();
        this.fillRecipesFromPool(traderOfferList, tradesCommon, 5);
        int i = this.random.nextInt(tradesRare.length);
        TradeOffers.Factory factory = tradesRare[i];
        TradeOffer tradeOffer = factory.create(this, this.random);
        if (tradeOffer != null) {
            traderOfferList.add(tradeOffer);
        }
    }
}
Also used : TradeOfferList(net.minecraft.village.TradeOfferList) TradeOffer(net.minecraft.village.TradeOffer) TradeOffers(net.minecraft.village.TradeOffers)

Example 5 with TradeOffer

use of net.minecraft.village.TradeOffer in project Fabric-Course-118 by Kaupenjoe.

the class ModRegistries method registerCustomTrades.

private static void registerCustomTrades() {
    TradeOfferHelper.registerVillagerOffers(VillagerProfession.FARMER, 1, factories -> {
        factories.add((entity, random) -> new TradeOffer(new ItemStack(Items.EMERALD, 2), new ItemStack(ModItems.TURNIP, 12), 6, 2, 0.02f));
    });
    TradeOfferHelper.registerVillagerOffers(VillagerProfession.TOOLSMITH, 3, factories -> {
        factories.add((entity, random) -> new TradeOffer(new ItemStack(Items.EMERALD, 6), new ItemStack(ModItems.ORICHALCUM_PAXEL, 1), 12, 3, 0.08f));
    });
}
Also used : ItemStack(net.minecraft.item.ItemStack) TradeOffer(net.minecraft.village.TradeOffer)

Aggregations

TradeOffer (net.minecraft.village.TradeOffer)8 ItemStack (net.minecraft.item.ItemStack)6 BasicTradeFactory (chronosacaria.mcda.factories.BasicTradeFactory)2 BasicTradeFactory (com.slomaxonical.architectspalette.common.factories.BasicTradeFactory)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 InventoryOverlay (fi.dy.masa.malilib.render.InventoryOverlay)1 Entity (net.minecraft.entity.Entity)1 MerchantEntity (net.minecraft.entity.passive.MerchantEntity)1 SimpleInventory (net.minecraft.inventory.SimpleInventory)1 DyeColor (net.minecraft.util.DyeColor)1 TradeOfferList (net.minecraft.village.TradeOfferList)1 TradeOffers (net.minecraft.village.TradeOffers)1