use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class RecipeMap method setFoundInvalidRecipe.
public static void setFoundInvalidRecipe(boolean foundInvalidRecipe) {
RecipeMap.foundInvalidRecipe |= foundInvalidRecipe;
OrePrefix currentOrePrefix = OrePrefix.getCurrentProcessingPrefix();
if (currentOrePrefix != null) {
Material currentMaterial = OrePrefix.getCurrentMaterial();
GTLog.logger.error("Error happened during processing ore registration of prefix {} and material {}. " + "Seems like cross-mod compatibility issue. Report to GTCEu github.", currentOrePrefix, currentMaterial);
}
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class ModHandler method removeSmeltingEBFMetals.
/* Note: If a Furnace recipe is added through CT that is the exact same as one of the recipes that will be removed
then this recipe will not be added. Forge will prevent the duplicate smelting recipe from being added before we
remove the recipe added by another mod, therefore the CT recipe will fail. At this point, disable the config and
remove the recipes manually
*/
public static void removeSmeltingEBFMetals() {
boolean isCTLoaded = Loader.isModLoaded(GTValues.MODID_CT);
Field actionAddFurnaceRecipe$output = null;
Map<ItemStack, ItemStack> furnaceList = FurnaceRecipes.instance().getSmeltingList();
Iterator<Map.Entry<ItemStack, ItemStack>> recipeIterator = furnaceList.entrySet().iterator();
outer: while (recipeIterator.hasNext()) {
Map.Entry<ItemStack, ItemStack> recipe = recipeIterator.next();
ItemStack output = recipe.getValue();
ItemStack input = recipe.getKey();
MaterialStack ms = OreDictUnifier.getMaterial(output);
if (ms != null) {
Material material = ms.material;
if (material.hasProperty(PropertyKey.BLAST)) {
ItemStack dust = OreDictUnifier.get(OrePrefix.dust, material);
ItemStack ingot = OreDictUnifier.get(OrePrefix.ingot, material);
// Check if the inputs are actually dust -> ingot
if (ingot.isItemEqual(output) && dust.isItemEqual(input)) {
if (isCTLoaded) {
if (actionAddFurnaceRecipe$output == null) {
try {
actionAddFurnaceRecipe$output = ActionAddFurnaceRecipe.class.getDeclaredField("output");
actionAddFurnaceRecipe$output.setAccessible(true);
} catch (NoSuchFieldException e) {
e.printStackTrace();
}
}
for (ActionAddFurnaceRecipe aafr : MCFurnaceManager.recipesToAdd) {
try {
// ..was a cached stack in an existing ActionAddFurnaceRecipe as well
if (actionAddFurnaceRecipe$output.get(aafr) == output) {
if (ConfigHolder.misc.debug) {
GTLog.logger.info("Not removing Smelting Recipe for EBF material {} as it is added via CT", LocalizationUtils.format(material.getUnlocalizedName()));
}
continue outer;
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
recipeIterator.remove();
if (ConfigHolder.misc.debug) {
GTLog.logger.info("Removing Smelting Recipe for EBF material {}", LocalizationUtils.format(material.getUnlocalizedName()));
}
}
}
}
}
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class OreConfigUtils method getOreForMaterial.
public static Map<StoneType, IBlockState> getOreForMaterial(Material material) {
List<BlockOre> oreBlocks = MetaBlocks.ORES.stream().filter(ore -> ore.material == material).collect(Collectors.toList());
HashMap<StoneType, IBlockState> stoneTypeMap = new HashMap<>();
for (BlockOre blockOre : oreBlocks) {
for (StoneType stoneType : blockOre.STONE_TYPE.getAllowedValues()) {
IBlockState blockState = blockOre.getOreBlock(stoneType);
stoneTypeMap.put(stoneType, blockState);
}
}
if (stoneTypeMap.isEmpty()) {
throw new IllegalArgumentException("There is no ore generated for material " + material);
}
return stoneTypeMap;
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class OreConfigUtils method getOreStateMap.
public static Map<StoneType, IBlockState> getOreStateMap(String stringDeclaration) {
String materialName;
if (stringDeclaration.startsWith("ore:")) {
materialName = stringDeclaration.substring(4);
} else {
throw new IllegalArgumentException("Invalid string ore declaration: " + stringDeclaration);
}
Material material = getMaterialByName(materialName);
return getOreForMaterial(material);
}
use of gregtech.api.unification.material.Material in project GregTech by GregTechCEu.
the class CommonProxy method createOreBlock.
private static void createOreBlock(Material material, StoneType[] stoneTypes, int index) {
BlockOre block = new BlockOre(material, stoneTypes);
block.setRegistryName("ore_" + material + "_" + index);
for (StoneType stoneType : stoneTypes) {
GregTechAPI.oreBlockTable.computeIfAbsent(material, m -> new HashMap<>()).put(stoneType, block);
}
ORES.add(block);
}
Aggregations