use of net.minecraft.entity.passive.EntityVillager.PriceInfo in project BaseMetals by MinecraftModDevelopmentMods.
the class VillagerTrades method registerCommonTrades.
protected static void registerCommonTrades() {
final String modid = Loader.instance().activeModContainer().getModId();
final Map<Integer, List<ITradeList>> tradesTable = new HashMap<>();
Materials.getMaterialsByMod(modid).stream().filter(material -> !material.isEmpty()).filter(material -> !material.isRare()).filter(material -> {
final float val = material.getStat(MaterialStats.HARDNESS) + material.getStat(MaterialStats.STRENGTH) + material.getStat(MaterialStats.MAGICAFFINITY) + material.getToolHarvestLevel();
return emeraldPurchaseValue(val) < 65 && emeraldSaleValue(val) < 65;
}).forEach(material -> {
makeArmorTrades(material);
makeToolTrades(material);
makeWeaponTrades(material);
makeIngotTrades(material);
if (material.getStat(MaterialStats.MAGICAFFINITY) > 5) {
final float val = material.getStat(MaterialStats.HARDNESS) + material.getStat(MaterialStats.STRENGTH) + material.getStat(MaterialStats.MAGICAFFINITY) + material.getToolHarvestLevel();
int tradeLevel = tradeLevel(val);
int armorSmithKey = ARMOR_SMITH | (tradeLevel + 1);
int weaponSmithKey = WEAPON_SMITH | (tradeLevel + 1);
int toolSmithKeyOne = TOOL_SMITH | (tradeLevel + 1);
int toolSmithKeyTwo = TOOL_SMITH | (tradeLevel + 2);
int armorMod = (int) (material.getStat(MaterialStats.HARDNESS) / 2);
int weaponMod = (int) (material.getBaseAttackDamage() / 2);
int emeraldPurchaseValueBase = emeraldPurchaseValue(val);
Arrays.asList(Names.SWORD, Names.CROSSBOW, Names.BOW).stream().filter(material::hasItem).forEach(name -> tradesTable.computeIfAbsent(weaponSmithKey, (Integer key) -> new ArrayList<>()).addAll(Collections.singletonList(new ListEnchantedItemForEmeralds(material.getItem(name), new PriceInfo(emeraldPurchaseValueBase + 7 + weaponMod - 1, emeraldPurchaseValueBase + 12 + weaponMod - 1)))));
Arrays.asList(Names.HELMET, Names.CHESTPLATE, Names.LEGGINGS, Names.BOOTS).stream().filter(material::hasItem).forEach(name -> tradesTable.computeIfAbsent(armorSmithKey, (Integer key) -> new ArrayList<>()).addAll(Collections.singletonList(new ListEnchantedItemForEmeralds(material.getItem(name), new PriceInfo(emeraldPurchaseValueBase + 7 + armorMod, emeraldPurchaseValueBase + 12 + armorMod)))));
Arrays.asList(Names.AXE, Names.HOE, Names.SHOVEL, Names.PICKAXE).stream().filter(material::hasItem).forEach(name -> tradesTable.computeIfAbsent(toolSmithKeyOne, (Integer key) -> new ArrayList<>()).addAll(Collections.singletonList(new ListEnchantedItemForEmeralds(material.getItem(name), new PriceInfo(emeraldPurchaseValueBase + 7, emeraldPurchaseValueBase + 12)))));
tradesTable.computeIfAbsent(toolSmithKeyTwo, (Integer key) -> new ArrayList<>()).addAll(Collections.singletonList(new ListEnchantedItemForEmeralds(material.getItem(Names.CRACKHAMMER), new PriceInfo(emeraldPurchaseValueBase + 7, emeraldPurchaseValueBase + 12))));
}
});
commitTrades(tradesTable);
}
use of net.minecraft.entity.passive.EntityVillager.PriceInfo in project pnc-repressurized by TeamPneumatic.
the class VillagerHandler method init.
public static void init() {
mechanicProfession = new VillagerProfession(Names.MOD_ID + ":mechanic", Textures.VILLAGER_MECHANIC, "minecraft:textures/entity/zombie_villager/zombie_villager.png");
VillagerCareer career = new VillagerCareer(mechanicProfession, Names.MOD_ID + ".mechanic");
career.addTrade(1, new ListItemForEmeralds(Itemss.PCB_BLUEPRINT, new PriceInfo(10, 19)), new ListItemForEmeralds(Itemss.NUKE_VIRUS, new PriceInfo(1, 5)), new ListItemForEmeralds(Itemss.STOP_WORM, new PriceInfo(1, 5)));
for (int i = 0; i < ItemAssemblyProgram.PROGRAMS_AMOUNT; i++) {
career.addTrade(1, new ListItemForEmeralds(new ItemStack(Itemss.ASSEMBLY_PROGRAM, 1, i), new PriceInfo(5, 11)));
}
}
Aggregations