Skip to content

Commit

Permalink
fix an issue caused by the former tight coupling of MMDLib and BaseMe…
Browse files Browse the repository at this point in the history
…tals
  • Loading branch information
dshadowwolf committed May 22, 2019
1 parent 02e0359 commit 913cf58
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/com/mcmoddev/nethermetals/init/NetherBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.mcmoddev.lib.init.Materials;
import com.mcmoddev.lib.material.MMDMaterial;
import com.mcmoddev.lib.util.Oredicts;
import com.mcmoddev.nethermetals.NetherMetals;

import net.minecraft.block.Block;

Expand All @@ -29,15 +30,21 @@ public static void init() {
"nickel", "platinum", "silver", "tin", "zinc", "aluminum", "cadmium", "chromium",
"iridium", "magnesium", "manganese", "osmium", "plutonium", "rutile", "tantalum",
"titanium", "tungsten", "uranium", "zirconium");
Materials.getAllMaterials().stream().map(material -> material.getName())
.filter(knownMaterials::contains).filter(Materials::hasMaterial)
.forEach(NetherBlocks::createOreWrapper);

Materials.getAllMaterials().stream().filter(MMDMaterial::isVanilla)
.map(material -> material.getName())
.filter(knownMaterials::contains)
.forEach(NetherBlocks::createVanillaOreWrapper);
Materials.getAllMaterials().stream().filter(mat -> !mat.isVanilla())
.map(material -> material.getName())
.filter(knownMaterials::contains).filter(Materials::hasMaterial)
.forEach(NetherBlocks::createOreWrapper);
}

private static void createOreWrapper(final String materialName) {
final List<String> vanillaMats = Arrays.asList("coal", "diamond", "emerald", "gold", "iron",
"lapis", "redstone");

NetherMetals.LOGGER.fatal("createOreWrapper(%s)", materialName);
if (vanillaMats.contains(materialName)) {
createVanillaOreWrapper(materialName);
} else {
Expand All @@ -46,6 +53,7 @@ private static void createOreWrapper(final String materialName) {
}

private static void createVanillaOreWrapper(final String materialName) {
NetherMetals.LOGGER.fatal("createVanillaOreWrapper(%s)", materialName);
final MMDMaterial material = Materials.getMaterialByName(materialName);
material.addNewBlock(Names.NETHERORE, addBlock(new BlockMMDNetherOre(material),
Names.NETHERORE.toString(), material, ItemGroups.getTab(SharedStrings.TAB_BLOCKS)));
Expand Down

0 comments on commit 913cf58

Please sign in to comment.