use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.
the class FallbackGeneratorData method setup.
/**
*/
public void setup() {
for (final Entry<Integer, Map<MMDMaterial, List<String>>> matMap : materials.entrySet()) {
final Map<MMDMaterial, List<String>> mats = matMap.getValue();
final List<WorldGenMinable> spawnList = spawns.getOrDefault(matMap.getKey(), new ArrayList<>());
final Predicate<IBlockState> pred = getPredicateForDimension(matMap.getKey());
for (final Entry<MMDMaterial, List<String>> matList : mats.entrySet()) {
MMDMaterial mat = matList.getKey();
matList.getValue().stream().forEach(blockName -> spawnList.add(new WorldGenMinable(mat.getBlock(blockName).getDefaultState(), mat.getSpawnSize() > 0 ? mat.getSpawnSize() : 8, pred)));
}
spawns.put(matMap.getKey(), spawnList);
}
}
use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.
the class ShieldUpgradeRecipe method getPlates.
private Map<String, NonNullList<ItemStack>> getPlates() {
final Collection<MMDMaterial> allmats = Materials.getAllMaterials();
final int hardness = ((Float) Materials.getMaterialByName(materialName).getStat(MaterialStats.HARDNESS)).intValue();
final Map<String, NonNullList<ItemStack>> plates = new TreeMap<>();
for (final MMDMaterial mat : allmats) {
if (mat.getStat(MaterialStats.HARDNESS) >= hardness && (!mat.getName().equals(materialName))) {
final NonNullList<ItemStack> mats = OreDictionary.getOres(Oredicts.PLATE + mat.getCapitalizedName());
plates.put(mat.getName(), mats);
}
}
return plates;
}
use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.
the class ShieldUpgradeRecipe method getCost.
/**
* @param inv
* @return
*/
public int getCost(final InventoryCrafting inv) {
final MMDMaterial shieldMat = Materials.getMaterialByName(materialName);
final MMDMaterial upgradeMat = getUpgradeMat(inv);
final float hardDiff = upgradeMat.getStat(MaterialStats.HARDNESS) - shieldMat.getStat(MaterialStats.HARDNESS);
final int enchantCount = getEnchantCount(inv);
final float diffVal = hardDiff * 5;
final float enchantVal = upgradeMat.getStat(MaterialStats.MAGICAFFINITY) * enchantCount;
Float finalVal = diffVal + enchantVal;
if (finalVal < 5.0f) {
finalVal = 5.0f;
}
return finalVal.intValue();
}
use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.
the class ShieldUpgradeRecipe method matches.
@Override
public boolean matches(final InventoryCrafting inv, final World worldIn) {
final NonNullList<ItemStack> upgradeMats = NonNullList.create();
final Collection<MMDMaterial> allmats = Materials.getAllMaterials();
final MMDMaterial input = Materials.getMaterialByName(materialName);
final ItemStack base = new ItemStack(input.getItem(Names.SHIELD), 1, 0);
for (final MMDMaterial mat : allmats) {
if (mat.getStat(MaterialStats.HARDNESS) >= input.getStat(MaterialStats.HARDNESS) && mat.getName().equals(materialName)) {
final NonNullList<ItemStack> mats = OreDictionary.getOres(Oredicts.PLATE + mat.getCapitalizedName());
upgradeMats.addAll(mats);
}
}
boolean[] matches = new boolean[] { false, false };
for (int i = 0; i < inv.getSizeInventory(); i++) {
final ItemStack curItem = inv.getStackInSlot(i);
if (!curItem.isEmpty()) {
final ItemStack comp = new ItemStack(curItem.getItem(), 1, curItem.getItemDamage());
if (OreDictionary.itemMatches(base, comp, false)) {
matches[0] = true;
} else if (OreDictionary.containsMatch(false, upgradeMats, comp)) {
matches[1] = true;
}
}
}
return matches[0] ? matches[1] : false;
}
use of com.mcmoddev.lib.material.MMDMaterial in project BaseMetals by MinecraftModDevelopmentMods.
the class BMeThermalExpansion method regShit.
/**
* @param event The Event.
*/
@SubscribeEvent
public void regShit(final RegistryEvent.Register<IRecipe> event) {
final List<String> materials = Arrays.asList(MaterialNames.ADAMANTINE, MaterialNames.ANTIMONY, MaterialNames.AQUARIUM, MaterialNames.BISMUTH, MaterialNames.BRASS, MaterialNames.COLDIRON, MaterialNames.CUPRONICKEL, MaterialNames.PEWTER, MaterialNames.STARSTEEL, MaterialNames.ZINC, MaterialNames.MERCURY, MaterialNames.REDSTONE);
materials.stream().filter(Materials::hasMaterial).filter(materialName -> !Materials.getMaterialByName(materialName).isEmpty()).forEach(materialName -> {
addFurnace(materialName);
addCrucible(materialName);
addPlatePress(materialName);
addPressStorage(materialName);
addPulverizer(materialName);
});
final MMDMaterial brass = Materials.getMaterialByName(MaterialNames.BRASS);
final MMDMaterial copper = Materials.getMaterialByName(MaterialNames.COPPER);
final MMDMaterial cupronickel = Materials.getMaterialByName(MaterialNames.CUPRONICKEL);
final MMDMaterial nickel = Materials.getMaterialByName(MaterialNames.NICKEL);
final MMDMaterial zinc = Materials.getMaterialByName(MaterialNames.ZINC);
final MMDMaterial tin = Materials.getMaterialByName(MaterialNames.TIN);
final MMDMaterial bronze = Materials.getMaterialByName(MaterialNames.BRONZE);
if (hasMaterials(MaterialNames.COPPER, MaterialNames.ZINC, MaterialNames.BRASS) && materialsHaveItems(Arrays.asList(MaterialNames.COPPER, MaterialNames.ZINC, MaterialNames.BRASS), Names.INGOT.toString())) {
ThermalExpansionHelper.addSmelterRecipe(4000, copper.getItemStack(Names.INGOT, 2), zinc.getItemStack(Names.INGOT, 1), brass.getItemStack(Names.INGOT, 3));
}
if (hasMaterials(MaterialNames.COPPER, MaterialNames.NICKEL, MaterialNames.CUPRONICKEL) && materialsHaveItems(Arrays.asList(MaterialNames.COPPER, MaterialNames.NICKEL, MaterialNames.CUPRONICKEL), Names.INGOT.toString())) {
ThermalExpansionHelper.addSmelterRecipe(4000, copper.getItemStack(Names.INGOT, 3), nickel.getItemStack(Names.INGOT, 1), cupronickel.getItemStack(Names.INGOT, 4));
}
if (hasMaterials(MaterialNames.COPPER, MaterialNames.TIN, MaterialNames.BRONZE) && materialsHaveItems(Arrays.asList(MaterialNames.COPPER, MaterialNames.TIN, MaterialNames.BRONZE), Names.INGOT.toString())) {
ThermalExpansionHelper.addSmelterRecipe(4000, copper.getItemStack(Names.INGOT, 3), tin.getItemStack(Names.INGOT, 1), bronze.getItemStack(Names.INGOT, 3));
}
}
Aggregations