parent
455ddc345f
commit
2dd3d2a4b8
9 changed files with 70 additions and 22 deletions
|
@ -141,7 +141,7 @@ import cpw.mods.fml.relauncher.Side;
|
|||
/**
|
||||
* @author Gregorius Techneticies
|
||||
*/
|
||||
@Mod(modid = "gregtech_addon", name="GregTech-Addon", version="4.15.32", useMetadata=false, dependencies="required-after:IC2; after:Railcraft; after:ThermalExpansion; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; before:RedPowerCore; before:RedPowerBase; before:RedPowerMachine; before:RedPowerCompat; before:RedPowerWiring; before:RedPowerLogic; before:RedPowerLighting; before:RedPowerWorld; before:RedPowerControl;")
|
||||
@Mod(modid = "gregtech_addon", name="GregTech-Addon", version="4.15.35", useMetadata=false, dependencies="required-after:IC2; after:Railcraft; after:ThermalExpansion; after:ThermalExpansion|Transport; after:ThermalExpansion|Energy; after:ThermalExpansion|Factory; before:RedPowerCore; before:RedPowerBase; before:RedPowerMachine; before:RedPowerCompat; before:RedPowerWiring; before:RedPowerLogic; before:RedPowerLighting; before:RedPowerWorld; before:RedPowerControl;")
|
||||
public class GT_Mod implements IGT_Mod {
|
||||
@Instance
|
||||
public static GT_Mod instance;
|
||||
|
@ -268,7 +268,8 @@ public class GT_Mod implements IGT_Mod {
|
|||
GregTech_API.sSpecialFile = new GT_Config(new Configuration(new File(gtDir, "Other.cfg")));
|
||||
GregTech_API.sIDFile = new GT_Config(GT_Config.sConfigFileIDs = new Configuration(new File(gtDir, "IDs.cfg")));
|
||||
|
||||
GregTech_API.sSpecialFile.mConfig.getCategory("enchants").setComment("There you can set allowed enchant IDs to specific GT tools\nIt will let you apply choosen enchant in anvil to GT tool");
|
||||
GregTech_API.sSpecialFile.mConfig.getCategory(GT_ConfigCategories.enchants.toString()).setComment("There you can set allowed enchant IDs to specific GT tools\nIt will let you apply choosen enchant in anvil to GT tool");
|
||||
GregTech_API.sUnification.mConfig.getCategory(GT_ConfigCategories.forceoredict.toString()).setComment("Forced OreDict registration\nAs examples, not any mod devs registering their blocks of ingots to OreDict\nTo disable force name type \"false\" insteadof name");
|
||||
|
||||
mDoNotInit = (!tFile.getAbsolutePath().toLowerCase().contains("voltz")) && (tFile.getAbsolutePath().toLowerCase().contains(".technic") || tFile.getAbsolutePath().toLowerCase().contains("tekkit"));
|
||||
if (mDoNotInit) {
|
||||
|
|
|
@ -4,7 +4,9 @@ public enum GT_ConfigCategories {
|
|||
news,
|
||||
general,
|
||||
machineconfig,
|
||||
specialunificationtargets;
|
||||
specialunificationtargets,
|
||||
enchants,
|
||||
forceoredict;
|
||||
|
||||
public enum Materials {
|
||||
blastfurnacerequirements,
|
||||
|
|
|
@ -834,6 +834,9 @@ public enum Materials {
|
|||
RockSalt .addOreByProduct(Salt );
|
||||
|
||||
Naquadah.mChemicalFormula = "Nq";
|
||||
NetherQuartz.mSmallBlock = true;
|
||||
CertusQuartz.mSmallBlock = true;
|
||||
Amber.mSmallBlock = true;
|
||||
|
||||
ImmutableMap.Builder<String, Materials> builder = new ImmutableMap.Builder<>();
|
||||
|
||||
|
@ -1076,7 +1079,7 @@ public enum Materials {
|
|||
public final short[] mRGBa = new short[] {255, 255, 255, 0};
|
||||
|
||||
public final IIconContainer[] mIconSet;
|
||||
public boolean mBlastFurnaceRequired = false, mTransparent = false;
|
||||
public boolean mBlastFurnaceRequired = false, mTransparent = false, mSmallBlock = false;
|
||||
public GT_SpecialToolEffect mSpecialEffect = null;
|
||||
public byte mEffectLevel = 0;
|
||||
public String mChemicalFormula = "?";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package gregtechmod.api.items;
|
||||
|
||||
import gregtechmod.api.GregTech_API;
|
||||
import gregtechmod.api.enums.GT_ConfigCategories;
|
||||
import gregtechmod.api.util.GT_ModHandler;
|
||||
import gregtechmod.api.util.GT_OreDictUnificator;
|
||||
import gregtechmod.api.util.GT_Utility;
|
||||
|
@ -84,7 +85,7 @@ public class GT_Tool_Item extends GT_Generic_Item {
|
|||
if (item.delegate == null || GT_Utility.isStringInvalid(item.delegate.name()))
|
||||
throw new IllegalArgumentException("Wrong item was supplied! May be it still not registered in GameRegistry");
|
||||
String regName = item.delegate.name();
|
||||
int[] enchantIDs = GregTech_API.sSpecialFile.mConfig.get("enchants", regName, new int[0]).getIntList();
|
||||
int[] enchantIDs = GregTech_API.sSpecialFile.mConfig.get(GT_ConfigCategories.enchants.toString(), regName, new int[0]).getIntList();
|
||||
for (int i : enchantIDs) {
|
||||
toolEnchants.put(regName, Integer.valueOf(i));
|
||||
}
|
||||
|
|
|
@ -70,4 +70,18 @@ public class GT_Config {
|
|||
if (!tProperty.wasRead()) mConfig.save();
|
||||
return rResult;
|
||||
}
|
||||
|
||||
public String get(Object aCategory, ItemStack aStack, String aDefault) {
|
||||
return get(aCategory, getStackConfigName(aStack), aDefault);
|
||||
}
|
||||
|
||||
public String get(Object aCategory, String aName, String aDefault) {
|
||||
if (GT_Utility.isStringInvalid(aName)) return aDefault;
|
||||
Property tProperty = mConfig.get(aCategory.toString().replaceAll("\\|", "_"), aName.replaceAll("\\|", "_"), aDefault);
|
||||
String rResult = tProperty.getString();
|
||||
if (GT_Utility.isStringInvalid(rResult))
|
||||
tProperty.set(aDefault);
|
||||
if (!tProperty.wasRead()) mConfig.save();
|
||||
return rResult;
|
||||
}
|
||||
}
|
|
@ -10,13 +10,16 @@ import gregtechmod.common.RecipeHandler.IRecipeMatcher;
|
|||
import gregtechmod.common.RecipeHandler.InventoryRecipeMatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* Class for Automatic Recipe registering.
|
||||
|
@ -193,6 +196,22 @@ public class GT_RecipeRegistrator {
|
|||
}
|
||||
}
|
||||
|
||||
public static void registerBlockForcibly(OrePrefixes aPrefix, Materials aMaterial, List<ItemStack> unifiedStacks) {
|
||||
String dictName = OrePrefixes.block.get(aMaterial);
|
||||
for (ItemStack a : unifiedStacks) {
|
||||
ItemStack block = aMaterial.mSmallBlock ? GT_ModHandler.getRecipeOutput(a, a, null, a, a, null) : GT_ModHandler.getRecipeOutput(a, a, a, a, a, a, a, a, a);
|
||||
if (block != null) {
|
||||
Optional<String> optional = Arrays.stream(OreDictionary.getOreIDs(block))
|
||||
.mapToObj(i -> OreDictionary.getOreName(i))
|
||||
.filter(name -> name.startsWith(OrePrefixes.block.toString()))
|
||||
.findAny();
|
||||
if (!optional.isPresent() && !GregTech_API.sUnification.get(GT_ConfigCategories.forceoredict, block, dictName).equals("false")) {
|
||||
GT_OreDictUnificator.set(dictName, block);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static final ItemStack sMt1 = new ItemStack(Blocks.air, 1, 0), sMt2 = new ItemStack(Blocks.air, 1, 1);
|
||||
private static final String s_H = "H", s_F = "F", s_I = "I", s_P = "P", s_R = "R", s_W = "W";
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import gregtechmod.api.recipe.RecipeFactory;
|
|||
import gregtechmod.api.util.GT_Log;
|
||||
import gregtechmod.api.util.GT_ModHandler;
|
||||
import gregtechmod.api.util.GT_OreDictUnificator;
|
||||
import gregtechmod.api.util.GT_RecipeRegistrator;
|
||||
import gregtechmod.api.util.GT_Utility;
|
||||
import gregtechmod.api.util.OreDictEntry;
|
||||
|
||||
|
@ -220,10 +221,11 @@ public class ProcessingDust implements IOreRecipeRegistrator {
|
|||
}
|
||||
} else {
|
||||
if (!OrePrefixes.block.isIgnored(aMaterial) && null == GT_OreDictUnificator.get(OrePrefixes.gem, aMaterial, 1L)) {
|
||||
ItemStack dust = GT_OreDictUnificator.get(OrePrefixes.dust, aMaterial);
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(false, dust, dust, dust, dust, dust, dust, dust, dust, dust));
|
||||
GT_RecipeRegistrator.registerBlockForcibly(aPrefix, aMaterial, entry.ores);
|
||||
RecipeHandler.scheduleIC2RecipeToRemove(GT_ModHandler.getCompressorRecipeList(), (in, out) -> in.matches(entry.ores.get(0)));
|
||||
RecipeHandler.executeOnFinish(() -> GT_ModHandler.addCompressionRecipe(entry, 9, GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)));
|
||||
for (ItemStack a : entry.ores)
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(false, a, a, a, a, a, a, a, a, a));
|
||||
}
|
||||
|
||||
if ((OrePrefixes.block.isIgnored(aMaterial)
|
||||
|
|
|
@ -12,6 +12,7 @@ import gregtechmod.api.interfaces.IOreRecipeRegistrator;
|
|||
import gregtechmod.api.recipe.RecipeFactory;
|
||||
import gregtechmod.api.util.GT_ModHandler;
|
||||
import gregtechmod.api.util.GT_OreDictUnificator;
|
||||
import gregtechmod.api.util.GT_RecipeRegistrator;
|
||||
import gregtechmod.api.util.GT_Utility;
|
||||
import gregtechmod.api.util.OreDictEntry;
|
||||
|
||||
|
@ -88,20 +89,26 @@ public class ProcessingGem implements IOreRecipeRegistrator {
|
|||
}
|
||||
|
||||
if (!OrePrefixes.block.isIgnored(aMaterial)) {
|
||||
ItemStack a = entry.ores.get(0);
|
||||
|
||||
GT_RecipeRegistrator.registerBlockForcibly(aPrefix, aMaterial, entry.ores);
|
||||
RecipeHandler.scheduleIC2RecipeToRemove(GT_ModHandler.getCompressorRecipeList(), (in, out) -> in.matches(entry.ores.get(0)));
|
||||
ItemStack block = GT_OreDictUnificator.get(OrePrefixes.block, aMaterial);
|
||||
|
||||
if (GT_ModHandler.getRecipeOutput(a, a, a, a, a, a, a, a, a) != null) {
|
||||
if (!GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.storageblockcrafting, OrePrefixes.block.get(aMaterial), false)) {
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(true, a, a, a, a, a, a, a, a, a));
|
||||
if (block != null) {
|
||||
if (aMaterial.mSmallBlock) {
|
||||
RecipeHandler.executeOnFinish(() -> GT_ModHandler.addCompressionRecipe(entry, 4, block));
|
||||
} else {
|
||||
RecipeHandler.executeOnFinish(() -> GT_ModHandler.addCompressionRecipe(entry, 9, block));
|
||||
}
|
||||
RecipeHandler.executeOnFinish(() -> GT_ModHandler.addCompressionRecipe(entry, 9, GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)));
|
||||
|
||||
} else if (GT_ModHandler.getRecipeOutput(a, a, null, a, a, null) != null) {
|
||||
if (!GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.storageblockcrafting, OrePrefixes.block.get(aMaterial), false))
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(true, a, a, null, a, a, null));
|
||||
RecipeHandler.executeOnFinish(() -> GT_ModHandler.addCompressionRecipe(entry, 4, GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L)));
|
||||
if (!GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.storageblockcrafting, OrePrefixes.block.get(aMaterial), false)) {
|
||||
for (ItemStack b : entry.ores) {
|
||||
if (aMaterial.mSmallBlock) {
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(false, b, b, null, b, b, null));
|
||||
} else {
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(false, b, b, b, b, b, b, b, b, b));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -69,12 +69,11 @@ public class ProcessingIngot1 implements IOreRecipeRegistrator {
|
|||
}
|
||||
|
||||
if (!OrePrefixes.block.isIgnored(aMaterial)) {
|
||||
GT_RecipeRegistrator.registerBlockForcibly(aPrefix, aMaterial, entry.ores);
|
||||
GT_ModHandler.addCompressionRecipe(entry, 9, GT_OreDictUnificator.get(OrePrefixes.block, aMaterial, 1L));
|
||||
|
||||
ItemStack a = entry.ores.get(0);
|
||||
if (GT_ModHandler.getRecipeOutput(a, a, a, a, a, a, a, a, a) != null)
|
||||
if (!GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.storageblockcrafting, OrePrefixes.block.get(aMaterial), false))
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(true, a, a, a, a, a, a, a, a, a));
|
||||
if (!GregTech_API.sRecipeFile.get(GT_ConfigCategories.Recipes.storageblockcrafting, OrePrefixes.block.get(aMaterial), false))
|
||||
for (ItemStack a : entry.ores)
|
||||
RecipeHandler.scheduleCraftingToRemove(new RecipeHandler.InventoryRecipeMatcher(false, a, a, a, a, a, a, a, a, a));
|
||||
}
|
||||
|
||||
if (GT_OreDictUnificator.get(OrePrefixes.stick, aMaterial) != null) {
|
||||
|
|
Loading…
Reference in a new issue