Search in sources :

Example 6 with Materials

use of com.mcmoddev.lib.init.Materials 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 7 with Materials

use of com.mcmoddev.lib.init.Materials in project BaseMetals by MinecraftModDevelopmentMods.

the class BMeEnderIO method init.

/**
 */
@Override
public void init() {
    if (!Options.isModEnabled(PLUGIN_MODID)) {
        return;
    }
    final List<String> materials = Arrays.asList(MaterialNames.ADAMANTINE, MaterialNames.ANTIMONY, MaterialNames.AQUARIUM, MaterialNames.BISMUTH, MaterialNames.BRASS, MaterialNames.BRONZE, MaterialNames.COLDIRON, MaterialNames.CUPRONICKEL, MaterialNames.ELECTRUM, MaterialNames.INVAR, MaterialNames.MITHRIL, MaterialNames.PEWTER, MaterialNames.PLATINUM, MaterialNames.STARSTEEL, MaterialNames.STEEL, MaterialNames.TIN, MaterialNames.ZINC);
    materials.stream().filter(Materials::hasMaterial).filter(materialName -> !Materials.getMaterialByName(materialName).isEmpty()).forEach(materialName -> addSagMillRecipe(materialName, 3600));
    addSagMillRecipe(MaterialNames.COPPER, 2, MaterialNames.GOLD, 1, 3600);
    addSagMillRecipe(MaterialNames.LEAD, 2, MaterialNames.SILVER, 1, 3600);
    addSagMillRecipe(MaterialNames.NICKEL, 2, MaterialNames.PLATINUM, 1, 3600);
    addSagMillRecipe(MaterialNames.SILVER, 2, MaterialNames.LEAD, 1, 3600);
    addSagMillRecipe(MaterialNames.IRON, 2, MaterialNames.NICKEL, 1, 3600);
    final String COPPER = "Copper";
    final String IRON = "Iron";
    final String NICKEL = "Nickel";
    final String SILVER = "Silver";
    final String TIN = "Tin";
    final String ZINC = "Zinc";
    final List<Pair<Integer, Triple<String, Integer, Object[]>>> alloys = Arrays.asList(Pair.of(3, Triple.of(MaterialNames.AQUARIUM, 20000, new Object[] { Oredicts.INGOT + COPPER, 2, Oredicts.INGOT + ZINC, 1, Oredicts.DUST + "Prismarine", 1 })), Pair.of(3, Triple.of(MaterialNames.BRASS, 2000, new Object[] { Oredicts.INGOT + COPPER, 2, Oredicts.INGOT + ZINC, 1 })), Pair.of(4, Triple.of(MaterialNames.BRONZE, 2000, new Object[] { Oredicts.INGOT + COPPER, 3, Oredicts.INGOT + TIN, 1 })), Pair.of(4, Triple.of(MaterialNames.CUPRONICKEL, 3000, new Object[] { Oredicts.INGOT + COPPER, 3, Oredicts.INGOT + NICKEL, 1 })), Pair.of(3, Triple.of(MaterialNames.INVAR, 3000, new Object[] { Oredicts.INGOT + IRON, 2, Oredicts.INGOT + NICKEL, 1 })), Pair.of(2, Triple.of(MaterialNames.ELECTRUM, 2000, new Object[] { Oredicts.INGOT + "Gold", 1, Oredicts.INGOT + SILVER, 1 })), Pair.of(2, Triple.of(MaterialNames.MITHRIL, 10000, new Object[] { Oredicts.INGOT + SILVER, 2, Oredicts.INGOT + "Coldiron", 1, Oredicts.INGOT + "Mercury", 1 })), Pair.of(3, Triple.of(MaterialNames.PEWTER, 2000, new Object[] { Oredicts.INGOT + TIN, 1, Oredicts.INGOT + COPPER, 1, Oredicts.INGOT + "Lead", 1 })), Pair.of(8, Triple.of(MaterialNames.STEEL, 5000, new Object[] { Oredicts.INGOT + IRON, 8, "itemCoal", 1 })));
    alloys.stream().filter(p -> Materials.hasMaterial(p.getRight().getLeft())).forEach(p -> {
        final String name = p.getRight().getLeft();
        final int count = p.getLeft();
        final int cost = p.getRight().getMiddle();
        final Object[] recipe = p.getRight().getRight();
        final MMDMaterial material = Materials.getMaterialByName(name);
        addAlloySmelterAlloy(material, cost, Oredicts.INGOT + material.getCapitalizedName(), count, recipe);
    });
}
Also used : Arrays(java.util.Arrays) Options(com.mcmoddev.lib.util.Config.Options) Materials(com.mcmoddev.lib.init.Materials) Oredicts(com.mcmoddev.lib.util.Oredicts) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) MaterialNames(com.mcmoddev.basemetals.data.MaterialNames) IIntegration(com.mcmoddev.lib.integration.IIntegration) List(java.util.List) MMDPlugin(com.mcmoddev.lib.integration.MMDPlugin) BaseMetals(com.mcmoddev.basemetals.BaseMetals) Pair(org.apache.commons.lang3.tuple.Pair) Triple(org.apache.commons.lang3.tuple.Triple) EnderIO(com.mcmoddev.lib.integration.plugins.EnderIO) Materials(com.mcmoddev.lib.init.Materials) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) Pair(org.apache.commons.lang3.tuple.Pair)

Example 8 with Materials

use of com.mcmoddev.lib.init.Materials in project BaseMetals by MinecraftModDevelopmentMods.

the class BMeThaumcraft method preInit.

@SubscribeEvent
public static void preInit(IntegrationPreInitEvent ev) {
    List<String> materials = Arrays.asList(MaterialNames.COPPER, MaterialNames.SILVER, MaterialNames.DIAMOND, MaterialNames.EMERALD, MaterialNames.STEEL, MaterialNames.BRASS, MaterialNames.BRONZE, MaterialNames.TIN, MaterialNames.MITHRIL, MaterialNames.AQUARIUM);
    Materials.getAllMaterials().stream().filter(mat -> !mat.isVanilla()).filter(mat -> !mat.isEmpty()).forEach(mat -> {
        String mn = mat.getName();
        TCMaterial tcm = Thaumcraft.createWithAspects(mat);
        tcMaterials.put(mn, tcm);
    });
    Materials.getAllMaterials().stream().filter(mat -> mat.isVanilla()).filter(mat -> !mat.isEmpty()).filter(mat -> mat.getType() == MMDMaterialType.MaterialType.MINERAL || mat.getType() == MMDMaterialType.MaterialType.ROCK).forEach(mat -> {
        String mn = mat.getName();
        TCMaterial tcm = Thaumcraft.createVanillaIngotWithAspects(mat);
        tcMaterials.put(mn, tcm);
    });
    materials.stream().filter(Materials::hasMaterial).forEach(BMeThaumcraft::makeSpecialMaterial);
    tcMaterials.entrySet().stream().map(ent -> ent.getValue()).forEach(tc -> tc.update());
}
Also used : Arrays(java.util.Arrays) Materials(com.mcmoddev.lib.init.Materials) HashMap(java.util.HashMap) TCMaterial(com.mcmoddev.lib.integration.plugins.thaumcraft.TCMaterial) MMDMaterial(com.mcmoddev.lib.material.MMDMaterial) TCSyncEvent(com.mcmoddev.lib.integration.plugins.thaumcraft.TCSyncEvent) MaterialNames(com.mcmoddev.basemetals.data.MaterialNames) Config(com.mcmoddev.lib.util.Config) IIntegration(com.mcmoddev.lib.integration.IIntegration) MMDMaterialType(com.mcmoddev.lib.material.MMDMaterialType) IntegrationPreInitEvent(com.mcmoddev.lib.integration.IntegrationPreInitEvent) List(java.util.List) MaterialStats(com.mcmoddev.lib.data.MaterialStats) MMDPlugin(com.mcmoddev.lib.integration.MMDPlugin) MinecraftForge(net.minecraftforge.common.MinecraftForge) BaseMetals(com.mcmoddev.basemetals.BaseMetals) Map(java.util.Map) Thaumcraft(com.mcmoddev.lib.integration.plugins.Thaumcraft) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) Aspect(thaumcraft.api.aspects.Aspect) TCMaterial(com.mcmoddev.lib.integration.plugins.thaumcraft.TCMaterial) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

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