diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-02 02:47:20 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-07-02 02:47:20 +1000 |
commit | 4a9e0f9ded8c4f2ed8a0ba3e1d32724887f6c3be (patch) | |
tree | 017deeced9e1d59e0dd4e4d5d827124272d6a58a /src | |
parent | 81360a320daf83530cc9260068e13111759d2212 (diff) | |
download | GT5-Unofficial-4a9e0f9ded8c4f2ed8a0ba3e1d32724887f6c3be.tar.gz GT5-Unofficial-4a9e0f9ded8c4f2ed8a0ba3e1d32724887f6c3be.tar.bz2 GT5-Unofficial-4a9e0f9ded8c4f2ed8a0ba3e1d32724887f6c3be.zip |
+ Added extra GTNH checks on old circuit features.
- Disabled Sulfuric Chem for the time being.
$ Tried to fix all the recipes I borked.
Diffstat (limited to 'src')
7 files changed, 216 insertions, 69 deletions
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java index 656951fe31..6035bec37d 100644 --- a/src/Java/gtPlusPlus/core/common/CommonProxy.java +++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java @@ -172,8 +172,8 @@ public class CommonProxy { //Compat Handling COMPAT_HANDLER.RemoveRecipesFromOtherMods(); COMPAT_HANDLER.InitialiseHandlerThenAddRecipes(); - COMPAT_HANDLER.runQueuedRecipes(); COMPAT_HANDLER.startLoadingGregAPIBasedRecipes(); + COMPAT_HANDLER.runQueuedRecipes(); COMPAT_IntermodStaging.postInit(); } diff --git a/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java b/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java index 9e310aa767..e5cd4a9bb9 100644 --- a/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java +++ b/src/Java/gtPlusPlus/core/handler/OldCircuitHandler.java @@ -21,7 +21,7 @@ import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechItems; public class OldCircuitHandler { public static void preInit(){ - if (enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + if (enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ removeCircuitRecipeMap(); //Bye shitty recipes. } } diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index 3758025d4a..d329a42dfc 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -239,7 +239,7 @@ public class CI { } public static Object getTieredCircuit(int tier){ - if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ if (tier == 0){ return GregtechItemList.Old_Circuit_Primitive.get(1); } @@ -389,7 +389,7 @@ public class CI { } public static ItemStack getDataOrb(){ - if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ + if (CORE.ConfigSwitches.enableOldGTcircuits && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && !CORE.GTNH){ return GregtechItemList.Old_Tool_DataOrb.get(1); } else { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java index 6eb52b40d2..7fcaf0d73a 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/RecipeUtils.java @@ -11,7 +11,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; @@ -22,7 +21,6 @@ import gtPlusPlus.core.handler.COMPAT_HANDLER; import gtPlusPlus.core.handler.Recipes.LateRegistrationHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.material.Material; import gtPlusPlus.core.recipe.common.CI; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; @@ -120,17 +118,20 @@ public class RecipeUtils { } try { - + int size = COMPAT_HANDLER.mRecipesToGenerate.size(); COMPAT_HANDLER.mRecipesToGenerate.put(new InternalRecipeObject(validSlots.toArray(), resultItem, false)); - + //Utils.LOG_WARNING("Success! Added a recipe for "+resultItem.getDisplayName()); - if (!COMPAT_HANDLER.areInitItemsLoaded){ - RegistrationHandler.recipesSuccess++; - } - else { - LateRegistrationHandler.recipesSuccess++; + if (COMPAT_HANDLER.mRecipesToGenerate.size() > size) { + if (!COMPAT_HANDLER.areInitItemsLoaded){ + RegistrationHandler.recipesSuccess++; + } + else { + LateRegistrationHandler.recipesSuccess++; + } + return true; } - return true; + return false; } catch(RuntimeException k){ //k.getMessage(); @@ -228,35 +229,35 @@ public class RecipeUtils { array[z].toString(); switch(z) { - case 0: - a = array[z]; - break; - case 1: - b = array[z]; - break; - case 2: - c = array[z]; - break; - case 3: - d = array[z]; - break; - case 4: - e = array[z]; - break; - case 5: - f = array[z]; - break; - case 6: - g = array[z]; - break; - case 7: - h = array[z]; - break; - case 8: - i = array[z]; - break; - default: - break; + case 0: + a = array[z]; + break; + case 1: + b = array[z]; + break; + case 2: + c = array[z]; + break; + case 3: + d = array[z]; + break; + case 4: + e = array[z]; + break; + case 5: + f = array[z]; + break; + case 6: + g = array[z]; + break; + case 7: + h = array[z]; + break; + case 8: + i = array[z]; + break; + default: + break; } recipeBuilder(a, b, c, d, e, f, g, h, i, outPut); } @@ -394,11 +395,21 @@ public class RecipeUtils { InputItem4, InputItem5, InputItem6, InputItem7, InputItem8, InputItem9 }; - + int size = COMPAT_HANDLER.mGtRecipesToGenerate.size(); COMPAT_HANDLER.mGtRecipesToGenerate.put(new InternalRecipeObject(o, OutputItem, true)); - return COMPAT_HANDLER.mGtRecipesToGenerate.size() > size; - + + if (COMPAT_HANDLER.mGtRecipesToGenerate.size() > size) { + if (!COMPAT_HANDLER.areInitItemsLoaded){ + RegistrationHandler.recipesSuccess++; + } + else { + LateRegistrationHandler.recipesSuccess++; + } + return true; + } + return false; + } public static boolean addShapedGregtechRecipe(final Object[] inputs, ItemStack output){ @@ -429,10 +440,20 @@ public class RecipeUtils { } } - + int size = COMPAT_HANDLER.mGtRecipesToGenerate.size(); COMPAT_HANDLER.mGtRecipesToGenerate.put(new InternalRecipeObject(inputs, output, true)); - return COMPAT_HANDLER.mGtRecipesToGenerate.size() > size; + + if (COMPAT_HANDLER.mGtRecipesToGenerate.size() > size) { + if (!COMPAT_HANDLER.areInitItemsLoaded){ + RegistrationHandler.recipesSuccess++; + } + else { + LateRegistrationHandler.recipesSuccess++; + } + return true; + } + return false; } public static boolean addShapelessGregtechRecipe(final Object[] inputItems, final ItemStack OutputItem){ @@ -514,23 +535,148 @@ public class RecipeUtils { } return s; } - - + + public static class InternalRecipeObject implements RunnableWithInfo<String> { - final Object[] mInputs; final ItemStack mOutput; - final boolean gtType; - + final ShapedOreRecipe mRecipe; + public final boolean isValid; + public InternalRecipeObject(Object[] aInputs, ItemStack aOutput, boolean gtRecipe) { - mInputs = aInputs; - mOutput = aOutput; - gtType = gtRecipe; + + mOutput = aOutput != null ? aOutput.copy() : null; + String line1 = "", line2 = "", line3 = ""; + String h = "abcdefghi"; + char blank = ' '; + int counter = 0; + char s[] = new char[9]; + ItemStack[] vInputs = new ItemStack[9]; + Object[] tInputs = aInputs.clone(); + + if (tInputs.length >= 8 && aOutput != null) { + + for (Object o : tInputs) { + if (o instanceof String || o instanceof ItemStack) { + s[counter] = h.charAt(counter); + } + else if (o == null) { + s[counter] = blank; + } + counter++; + } + + for (int y=0;y<9;y++){ + if (tInputs.length > y) { + if (tInputs[y] instanceof String) { + vInputs[y] = ItemUtils.getItemStackOfAmountFromOreDict((String) tInputs[y], 1); + } + else if (tInputs[y] instanceof ItemStack) { + vInputs[y] = (ItemStack) tInputs[y]; + } + else { + vInputs[y] = null; + Logger.INFO("[Recipe] Invalid Item in shapped recipe outputting "+mOutput != null ? mOutput.getDisplayName() : "BAD OUTPUT ITEM" + " | Type: "+tInputs[y] != null ? tInputs[y].getClass().getName() : "Unable to determine class of invalid object."); + } + } + else { + vInputs[y] = null; + } + } + } + + for (int i=0;i<3;i++) { + line1 = line1 + s[i]; + } + for (int i=3;i<6;i++) { + line2 = line2 + s[i]; + } + for (int i=6;i<9;i++) { + line3 = line3 + s[i]; + } + + //line1 = StringUtils.join(s, null, 0, 2); + //line2 = StringUtils.join(s, null, 3, 5); + //line3 = StringUtils.join(s, null, 6, 8); + + + Object[] mVarags = new Object[18]; + int mSlotCount = 0; + + for (int i=0;i<9;i++) { + if (s[i] != ' ') { + mVarags[mSlotCount] = String.valueOf(s[i]); + } + if (vInputs[i] != null) { + mVarags[mSlotCount+1] = vInputs[i]; + } + mSlotCount += 2; + } + + int nullCount = 0; + + for (Object m : mVarags){ + if (m == null) { + nullCount++; + } + } + Object[] mVarags2 = new Object[mVarags.length-nullCount]; + for (int i=0;i<(mVarags.length-nullCount);i++) { + mVarags2[i] = mVarags[i]; + } + + ShapedOreRecipe d = new ShapedOreRecipe( + aOutput, + line1, + line2, + line3, + mVarags2); + + + if (mOutput == null || counter < 8 || d == null || (line1 == null || line2 == null || line3 == null) || !ItemUtils.checkForInvalidItems(d.getRecipeOutput())) { + isValid = false; + } + else { + isValid = true; + } + + mRecipe = d != null ? d : null; } - + @Override public void run() { - if (!gtType) { - GameRegistry.addRecipe(new ShapedOreRecipe(((ItemStack) mOutput).copy(), mInputs)); + if (this.isValid) { + GameRegistry.addRecipe(mRecipe); + } + else { + Logger.INFO("[Recipe] Invalid shapped recipe outputting "+mOutput != null ? mOutput.getDisplayName() : "Bad Output Item"); + } + + /*ItemStack[] vInputs = new ItemStack[9]; + if (mOutput != null) { + for (int y=0;y<9;y++){ + if (mInputs.length > y) { + if (mInputs[y] instanceof String) { + vInputs[y] = ItemUtils.getItemStackOfAmountFromOreDict((String) mInputs[y], 1); + } + else if (mInputs[y] instanceof ItemStack) { + vInputs[y] = (ItemStack) mInputs[y]; + } + else { + Logger.INFO("[Recipe] Invalid Item in shapped recipe outputting "+mOutput.getDisplayName() + " | Type: "+mInputs[y].getClass().getName()); + } + } + else { + vInputs[y] = null; + } + } + + GameRegistry.addRecipe(new ShapedOreRecipe(mOutput.copy(), vInputs)); + }*/ + + + + /*if (!gtType) { + } else { if (GT_ModHandler.addCraftingRecipe(mOutput, @@ -554,7 +700,8 @@ public class RecipeUtils { mInputs[0], mInputs[0], mInputs[0], mInputs[0], mInputs[0], mInputs[0], mOutput)){ - + Logger.WARNING("Success! Added a recipe for "+mOutput.getDisplayName()); + RegistrationHandler.recipesSuccess++; } else { if (mOutput != null){ @@ -562,7 +709,7 @@ public class RecipeUtils { } RegistrationHandler.recipesFailed++; } - } + }*/ } @Override @@ -572,9 +719,9 @@ public class RecipeUtils { } return ""; } - + } - - + + } diff --git a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java index 1ff99a3ddb..c125e26016 100644 --- a/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java +++ b/src/Java/gtPlusPlus/plugin/sulfurchem/Core_SulfuricChemistry.java @@ -30,7 +30,7 @@ public class Core_SulfuricChemistry implements IPlugin { @Override public boolean preInit() { - if (/*CORE.ConfigSwitches.enableSulfuricAcidFix || */CORE.DEVENV) { + if (/*CORE.ConfigSwitches.enableSulfuricAcidFix || *//*CORE.DEVENV*/false) { shouldLoad = true; } if (shouldLoad) diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 7d488292f0..f1adca0e82 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -34,7 +34,7 @@ public class HANDLER_GT { GT_Materials.init(mMaterialProperties); } - if (ConfigSwitches.enableOldGTcircuits){ + if (ConfigSwitches.enableOldGTcircuits && !CORE.GTNH){ OldCircuitHandler.preInit(); } @@ -60,7 +60,7 @@ public class HANDLER_GT { new ProcessingToolHeadChoocher().run(); } - if (ConfigSwitches.enableOldGTcircuits){ + if (ConfigSwitches.enableOldGTcircuits && !CORE.GTNH){ OldCircuitHandler.init(); } @@ -75,7 +75,7 @@ public class HANDLER_GT { GregtechNitroDieselFix.run(); } - if (ConfigSwitches.enableOldGTcircuits){ + if (ConfigSwitches.enableOldGTcircuits && !CORE.GTNH){ OldCircuitHandler.postInit(); } diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index bb224f5c9b..e6137b640f 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -1994,7 +1994,7 @@ item.dustImpureTrinium.name=Impure Trinium Dust item.dustPureTrinium.name=Purified Trinium Dust //Added 1/7/18 -entity.VillagerV5.name=Wise Villager +entity.WiseVillager.name=Wise Villager tile.blockMobSpawnerEx.0.name=Monster Spawner tile.blockMobSpawnerEx.1.name=Monster Spawner tile.blockMobSpawnerEx.2.name=Monster Spawner |