Search in sources :

Example 21 with MMDMaterial

use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.

the class VillagerTrades method registerModSpecificTrades.

protected static void registerModSpecificTrades() {
    if (Materials.hasMaterial(MaterialNames.CHARCOAL)) {
        final MMDMaterial charcoal = Materials.getMaterialByName(MaterialNames.CHARCOAL);
        if (charcoal.hasItem(Names.POWDER)) {
            final Item charcoalPowder = charcoal.getItem(Names.POWDER);
            final ITradeList[] charcoalTrades = makePurchasePalette(1, 10, charcoalPowder);
            VillagerTradeHelper.insertTrades(SMITH_RL, ARMOR_SMITH_ID, 1, charcoalTrades);
            VillagerTradeHelper.insertTrades(SMITH_RL, WEAPON_SMITH_ID, 1, charcoalTrades);
            VillagerTradeHelper.insertTrades(SMITH_RL, TOOL_SMITH_ID, 1, charcoalTrades);
        }
    }
    if (Materials.hasMaterial(MaterialNames.COAL)) {
        final MMDMaterial coal = Materials.getMaterialByName(MaterialNames.COAL);
        if (coal.hasItem(Names.POWDER)) {
            final Item coalPowder = coal.getItem(Names.POWDER);
            final ITradeList[] coalTrades = makePurchasePalette(1, 10, coalPowder);
            VillagerTradeHelper.insertTrades(SMITH_RL, ARMOR_SMITH_ID, 1, coalTrades);
            VillagerTradeHelper.insertTrades(SMITH_RL, WEAPON_SMITH_ID, 1, coalTrades);
            VillagerTradeHelper.insertTrades(SMITH_RL, TOOL_SMITH_ID, 1, coalTrades);
        }
    }
}
Also used : Item(net.minecraft.item.Item) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) ITradeList(net.minecraft.entity.passive.EntityVillager.ITradeList)

Example 22 with MMDMaterial

use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.

the class BMeThaumcraft method makeSpecialMaterial.

private static void makeSpecialMaterial(String name) {
    TCMaterial thisMat = tcMaterials.getOrDefault(name, Thaumcraft.createWithAspects(Materials.getMaterialByName(name)));
    switch(name) {
        case "mithril":
        case "aquarium":
            thisMat.addMaterialAspect(Aspect.MAGIC, 5);
            break;
        case "copper":
            thisMat.addMaterialAspect(Aspect.EXCHANGE, 5);
            break;
        case "tin":
            thisMat.addMaterialAspect(Aspect.CRYSTAL, 5);
            break;
        case "steel":
            thisMat.addMaterialAspect(Aspect.ORDER, 5);
            break;
        case "brass":
        case "bronze":
            thisMat.addMaterialAspect(Aspect.TOOL, 5);
            break;
        case "silver":
        case "diamond":
        case "emerald":
            MMDMaterial mat = thisMat.getMMDMaterial();
            thisMat.addMaterialAspect(Aspect.DESIRE, (m) -> mat.isRare() ? (int) (mat.getStat(MaterialStats.MAGICAFFINITY) * 2 / 45 * m) : 5);
            break;
    }
    tcMaterials.put(name, thisMat);
}
Also used : MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) TCMaterial(com.mcmoddev.lib.integration.plugins.thaumcraft.TCMaterial)

Example 23 with MMDMaterial

use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.

the class Items method registerItems.

/**
 */
@SubscribeEvent
public static void registerItems(MMDLibRegisterItems ev) {
    final List<String> materials = Arrays.asList(MaterialNames.ADAMANTINE, MaterialNames.ANTIMONY, MaterialNames.AQUARIUM, MaterialNames.BISMUTH, MaterialNames.BRASS, MaterialNames.BRONZE, MaterialNames.COLDIRON, MaterialNames.COPPER, MaterialNames.CUPRONICKEL, MaterialNames.ELECTRUM, MaterialNames.INVAR, MaterialNames.LEAD, MaterialNames.MITHRIL, MaterialNames.NICKEL, MaterialNames.PEWTER, MaterialNames.PLATINUM, MaterialNames.SILVER, MaterialNames.STARSTEEL, MaterialNames.STEEL, MaterialNames.TIN, MaterialNames.ZINC);
    // create and register modded stuffs
    final List<String> materialsModSupport = Arrays.asList(MaterialNames.ADAMANTINE, MaterialNames.ANTIMONY, MaterialNames.BISMUTH, MaterialNames.COLDIRON, MaterialNames.PLATINUM, MaterialNames.NICKEL, MaterialNames.STARSTEEL, MaterialNames.ZINC);
    materials.stream().filter(Materials::hasMaterial).filter(materialName -> !Materials.getMaterialByName(materialName).isEmpty()).forEach(materialName -> {
        final MMDMaterial material = Materials.getMaterialByName(materialName);
        create(Names.BLEND, material);
        create(Names.INGOT, material);
        create(Names.NUGGET, material);
        create(Names.POWDER, material);
        create(Names.SMALLBLEND, material);
        create(Names.SMALLPOWDER, material);
        create(Names.ARROW, material);
        create(Names.AXE, material);
        create(Names.BOLT, material);
        create(Names.BOOTS, material);
        create(Names.BOW, material);
        create(Names.CHESTPLATE, material);
        create(Names.CRACKHAMMER, material);
        create(Names.CROSSBOW, material);
        create(Names.DOOR, material);
        create(Names.FISHING_ROD, material);
        create(Names.HELMET, material);
        create(Names.HOE, material);
        create(Names.HORSE_ARMOR, material);
        create(Names.LEGGINGS, material);
        create(Names.PICKAXE, material);
        create(Names.SHEARS, material);
        create(Names.SHIELD, material);
        create(Names.SHOVEL, material);
        create(Names.SCYTHE, material);
        create(Names.SLAB, material);
        create(Names.SWORD, material);
        create(Names.ROD, material);
        create(Names.GEAR, material);
    });
    materials.stream().filter(Materials::hasMaterial).map(Materials::getMaterialByName).forEach(com.mcmoddev.basemetals.init.Items::setBurnTimes);
    materialsModSupport.stream().filter(Materials::hasMaterial).filter(materialName -> !Materials.getMaterialByName(materialName).isEmpty()).forEach(materialName -> {
        final MMDMaterial material = Materials.getMaterialByName(materialName);
        create(Names.CASING, material);
        create(Names.DENSE_PLATE, material);
        if (material.hasOre()) {
            create(Names.CRUSHED, material);
            create(Names.CRUSHED_PURIFIED, material);
            createMekCrystal(material, ItemGroups.getTab(SharedStrings.TAB_ITEMS));
            create(Names.SHARD, material);
            create(Names.CLUMP, material);
            create(Names.POWDER_DIRTY, material);
            create(Names.CRYSTAL, material);
        }
    });
    if (Materials.hasMaterial(MaterialNames.MERCURY)) {
        final MMDMaterial mercury = Materials.getMaterialByName(MaterialNames.MERCURY);
        create(Names.INGOT, mercury);
        create(Names.NUGGET, mercury);
        create(Names.POWDER, mercury);
        create(Names.SMALLPOWDER, mercury);
    }
    Arrays.asList(MaterialNames.STONE, MaterialNames.STEEL, MaterialNames.ADAMANTINE).stream().filter(Materials::hasMaterial).forEach(materialName -> create(Names.ANVIL, Materials.getMaterialByName(materialName)));
    addToMetList();
    MinecraftForge.EVENT_BUS.register(Items.class);
}
Also used : MMDLibRegisterItems(com.mcmoddev.lib.events.MMDLibRegisterItems) Arrays(java.util.Arrays) ItemGroups(com.mcmoddev.lib.init.ItemGroups) Materials(com.mcmoddev.lib.init.Materials) Item(net.minecraft.item.Item) Oredicts(com.mcmoddev.lib.util.Oredicts) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) MaterialNames(com.mcmoddev.basemetals.data.MaterialNames) SharedStrings(com.mcmoddev.lib.data.SharedStrings) IForgeRegistry(net.minecraftforge.registries.IForgeRegistry) Names(com.mcmoddev.lib.data.Names) IMMDBurnableObject(com.mcmoddev.lib.material.IMMDBurnableObject) ItemStack(net.minecraft.item.ItemStack) List(java.util.List) MinecraftForge(net.minecraftforge.common.MinecraftForge) BaseMetals(com.mcmoddev.basemetals.BaseMetals) ImmutableList(com.google.common.collect.ImmutableList) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) RegistryEvent(net.minecraftforge.event.RegistryEvent) Mod(net.minecraftforge.fml.common.Mod) Nonnull(javax.annotation.Nonnull) Materials(com.mcmoddev.lib.init.Materials) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) MMDLibRegisterItems(com.mcmoddev.lib.events.MMDLibRegisterItems) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 24 with MMDMaterial

use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.

the class VanillaBlocks method registerVanilla.

@SubscribeEvent
public static void registerVanilla(MMDLibRegisterBlocks ev) {
    // Vanilla Materials get their Ore and Block always
    final MMDMaterial charcoal = Materials.getMaterialByName(MaterialNames.CHARCOAL);
    final MMDMaterial gold = Materials.getMaterialByName(MaterialNames.GOLD);
    final MMDMaterial iron = Materials.getMaterialByName(MaterialNames.IRON);
    final MMDMaterial quartz = Materials.getMaterialByName(MaterialNames.QUARTZ);
    if (Materials.hasMaterial(MaterialNames.CHARCOAL)) {
        create(Names.BLOCK, charcoal);
    }
    Arrays.stream(new String[] { MaterialNames.DIAMOND, MaterialNames.EMERALD, MaterialNames.GOLD, MaterialNames.OBSIDIAN }).filter(n -> Options.isMaterialEnabled(n.toString())).filter(Materials::hasMaterial).map(Materials::getMaterialByName).forEach(mat -> {
        Arrays.stream(new Names[] { Names.BARS, Names.DOOR, Names.TRAPDOOR, Names.BUTTON, Names.SLAB, Names.DOUBLE_SLAB, Names.LEVER, Names.PRESSURE_PLATE, Names.STAIRS, Names.WALL }).forEach(n -> create(n, mat));
    });
    if (Materials.hasMaterial(MaterialNames.GOLD) && Options.isMaterialEnabled(MaterialNames.GOLD)) {
        create(Names.PLATE, gold);
    }
    if (Materials.hasMaterial(MaterialNames.IRON) && Options.isMaterialEnabled(MaterialNames.IRON)) {
        create(Names.PLATE, iron);
        create(Names.BUTTON, iron);
        create(Names.SLAB, iron);
        create(Names.DOUBLE_SLAB, iron);
        create(Names.LEVER, iron);
        create(Names.PRESSURE_PLATE, iron);
        create(Names.STAIRS, iron);
        create(Names.WALL, iron);
    }
    if (Materials.hasMaterial(MaterialNames.QUARTZ) && Options.isMaterialEnabled(MaterialNames.QUARTZ)) {
        create(Names.BARS, quartz);
        create(Names.DOOR, quartz);
        create(Names.TRAPDOOR, quartz);
        create(Names.BUTTON, quartz);
        create(Names.LEVER, quartz);
        create(Names.PRESSURE_PLATE, quartz);
        create(Names.WALL, quartz);
    }
}
Also used : Arrays(java.util.Arrays) BaseMetals(com.mcmoddev.basemetals.BaseMetals) Options(com.mcmoddev.lib.util.Config.Options) Materials(com.mcmoddev.lib.init.Materials) MaterialNames(com.mcmoddev.lib.data.MaterialNames) MMDLibRegisterBlocks(com.mcmoddev.lib.events.MMDLibRegisterBlocks) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) Blocks(com.mcmoddev.lib.init.Blocks) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) Mod(net.minecraftforge.fml.common.Mod) Names(com.mcmoddev.lib.data.Names) MaterialNames(com.mcmoddev.lib.data.MaterialNames) Names(com.mcmoddev.lib.data.Names) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) Materials(com.mcmoddev.lib.init.Materials) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 25 with MMDMaterial

use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.

the class VanillaItems method addStoneBits.

private static void addStoneBits() {
    final MMDMaterial stone = Materials.getMaterialByName(MaterialNames.STONE);
    if (Materials.hasMaterial(MaterialNames.STONE)) {
        create(Names.CRACKHAMMER, stone);
        create(Names.ROD, stone);
        create(Names.GEAR, stone);
        create(Names.SCYTHE, stone);
    }
}
Also used : MMDMaterial(com.mcmoddev.lib.material.MMDMaterial)

Aggregations

MMDMaterial (com.mcmoddev.lib.material.MMDMaterial)45 List (java.util.List)9 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)9 BaseMetals (com.mcmoddev.basemetals.BaseMetals)8 Arrays (java.util.Arrays)8 MaterialNames (com.mcmoddev.basemetals.data.MaterialNames)7 Names (com.mcmoddev.lib.data.Names)7 Materials (com.mcmoddev.lib.init.Materials)7 ItemStack (net.minecraft.item.ItemStack)6 RegistryEvent (net.minecraftforge.event.RegistryEvent)6 IIntegration (com.mcmoddev.lib.integration.IIntegration)5 MMDPlugin (com.mcmoddev.lib.integration.MMDPlugin)5 IMMDObject (com.mcmoddev.lib.material.IMMDObject)5 Oredicts (com.mcmoddev.lib.util.Oredicts)5 MinecraftForge (net.minecraftforge.common.MinecraftForge)5 ImmutableList (com.google.common.collect.ImmutableList)4 Options (com.mcmoddev.lib.util.Config.Options)4 Item (net.minecraft.item.Item)4 IRecipe (net.minecraft.item.crafting.IRecipe)4 ThermalExpansionHelper (cofh.api.util.ThermalExpansionHelper)2