From 5715a32d2901922503fd850f3a68503fb77467c3 Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Wed, 20 Dec 2017 23:39:49 +1000 Subject: - Disabled some logging. % Minor Project Clean-up, added missing Override annotations to 100+ methods & removed pointless casts. % Moved Logging to it's own class. $ Fixed Multi-block handling of Pollution. $ Fixed the GT 5.09 material enabler system. (From My Side, it's still borked on GTs). + Added a Dynamic Proxy invocation for IMaterialHandler. + Added an AutoMap data type, which is a Auto-incremental ID'd Hashmap wrapper. --- src/Java/gregtech/api/util/CustomRecipeMap.java | 48 ++++++++++---------- .../api/util/MultiblockRecipeMapHandler.java | 18 ++++---- src/Java/gregtech/api/util/Recipe_GT.java | 52 +++++++++++----------- 3 files changed, 59 insertions(+), 59 deletions(-) (limited to 'src/Java/gregtech/api') diff --git a/src/Java/gregtech/api/util/CustomRecipeMap.java b/src/Java/gregtech/api/util/CustomRecipeMap.java index a4a1b0b061..5096947886 100644 --- a/src/Java/gregtech/api/util/CustomRecipeMap.java +++ b/src/Java/gregtech/api/util/CustomRecipeMap.java @@ -7,7 +7,7 @@ import java.util.*; import gregtech.api.GregTech_API; import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; import gregtech.api.objects.GT_ItemStack; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.api.objects.Logger; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidStack; @@ -214,7 +214,7 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ public GT_Recipe findRecipe(final IHasWorldObjectAndCoords aTileEntity, final GT_Recipe aRecipe, final boolean aNotUnificated, final long aVoltage, final FluidStack[] aFluids, final ItemStack aSpecialSlot, ItemStack... aInputs) { // No Recipes? Well, nothing to be found then. if (this.mRecipeList.isEmpty()) { - Utils.LOG_WARNING("BAD RECIPE"); + Logger.WARNING("BAD RECIPE"); return null; } @@ -223,7 +223,7 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ if (GregTech_API.sPostloadFinished) { if (this.mMinimalInputFluids > 0) { if (aFluids == null) { - Utils.LOG_WARNING("BAD RECIPE [1]"); + Logger.WARNING("BAD RECIPE [1]"); return null; } int tAmount = 0; @@ -233,13 +233,13 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ } } if (tAmount < this.mMinimalInputFluids) { - Utils.LOG_WARNING("BAD RECIPE [2]"); + Logger.WARNING("BAD RECIPE [2]"); return null; } } if (this.mMinimalInputItems > 0) { if (aInputs == null) { - Utils.LOG_WARNING("BAD RECIPE [3]"); + Logger.WARNING("BAD RECIPE [3]"); return null; } int tAmount = 0; @@ -249,7 +249,7 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ } } if (tAmount < this.mMinimalInputItems) { - Utils.LOG_WARNING("BAD RECIPE [4]"); + Logger.WARNING("BAD RECIPE [4]"); return null; } } @@ -263,38 +263,38 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ // Check the Recipe which has been used last time in order to not have to search for it again, if possible. if (aRecipe != null) { if (!aRecipe.mFakeRecipe && aRecipe.mCanBeBuffered && aRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { - Utils.LOG_WARNING("BAD RECIPE [a]"); + Logger.WARNING("BAD RECIPE [a]"); return aRecipe.mEnabled && ((aVoltage * this.mAmperage) >= aRecipe.mEUt) ? aRecipe : null; } } // Now look for the Recipes inside the Item HashMaps, but only when the Recipes usually have Items. if ((this.mUsualInputCount > 0) && (aInputs != null)) { - Utils.LOG_WARNING("BAD RECIPE [b0]"); + Logger.WARNING("BAD RECIPE [b0]"); for (final ItemStack tStack : aInputs) { - Utils.LOG_WARNING("BAD RECIPE [b1]"); + Logger.WARNING("BAD RECIPE [b1]"); if (tStack != null) { - Utils.LOG_WARNING("BAD RECIPE [b2] | "+tStack.getDisplayName()); + Logger.WARNING("BAD RECIPE [b2] | "+tStack.getDisplayName()); Collection tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(tStack)); if (tRecipes != null) { - Utils.LOG_WARNING("BAD RECIPE [b3]"); + Logger.WARNING("BAD RECIPE [b3]"); for (final GT_Recipe tRecipe : tRecipes) { - Utils.LOG_WARNING("BAD RECIPE [b4]"); + Logger.WARNING("BAD RECIPE [b4]"); if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { - Utils.LOG_WARNING("BAD RECIPE [b5]"); + Logger.WARNING("BAD RECIPE [b5]"); return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; } } } - Utils.LOG_WARNING("BAD RECIPE [b6]"); + Logger.WARNING("BAD RECIPE [b6]"); tRecipes = this.mRecipeItemMap.get(new GT_ItemStack(GT_Utility.copyMetaData(W, tStack))); if (tRecipes != null) { - Utils.LOG_WARNING("BAD RECIPE [b7]"); + Logger.WARNING("BAD RECIPE [b7]"); for (final GT_Recipe tRecipe : tRecipes) { - Utils.LOG_WARNING("BAD RECIPE [b8]"); + Logger.WARNING("BAD RECIPE [b8]"); if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { - Utils.LOG_WARNING("BAD RECIPE [b9]"); + Logger.WARNING("BAD RECIPE [b9]"); return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; } } @@ -305,19 +305,19 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ // If the minimal Amount of Items for the Recipe is 0, then it could be a Fluid-Only Recipe, so check that Map too. if ((this.mMinimalInputItems == 0) && (aFluids != null && aFluids.length > 0)) { - Utils.LOG_WARNING("BAD RECIPE [c0] "+aFluids.length); + Logger.WARNING("BAD RECIPE [c0] "+aFluids.length); for (final FluidStack aFluid : aFluids) { - Utils.LOG_WARNING("BAD RECIPE [c1]"); + Logger.WARNING("BAD RECIPE [c1]"); if (aFluid != null) { - Utils.LOG_WARNING("BAD RECIPE [c2]"); + Logger.WARNING("BAD RECIPE [c2]"); final Collection tRecipes = this.mRecipeFluidMap.get(aFluid.getFluid()); if (tRecipes != null) { - Utils.LOG_WARNING("BAD RECIPE [c3]"); + Logger.WARNING("BAD RECIPE [c3]"); for (final GT_Recipe tRecipe : tRecipes) { - Utils.LOG_WARNING("BAD RECIPE [c4]"); + Logger.WARNING("BAD RECIPE [c4]"); if (!tRecipe.mFakeRecipe && tRecipe.isRecipeInputEqual(false, true, aFluids, aInputs)) { - Utils.LOG_WARNING("BAD RECIPE [c5]"); + Logger.WARNING("BAD RECIPE [c5]"); return tRecipe.mEnabled && ((aVoltage * this.mAmperage) >= tRecipe.mEUt) ? tRecipe : null; } } @@ -327,7 +327,7 @@ public class CustomRecipeMap/* extends GT_Recipe_Map*/{ } // And nothing has been found. - Utils.LOG_WARNING("BAD RECIPE [5]"); + Logger.WARNING("BAD RECIPE [5]"); return null; } diff --git a/src/Java/gregtech/api/util/MultiblockRecipeMapHandler.java b/src/Java/gregtech/api/util/MultiblockRecipeMapHandler.java index 7a4e1a533a..a93748390b 100644 --- a/src/Java/gregtech/api/util/MultiblockRecipeMapHandler.java +++ b/src/Java/gregtech/api/util/MultiblockRecipeMapHandler.java @@ -5,8 +5,8 @@ import java.util.Collection; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.math.MathUtils; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidContainerRegistry; @@ -139,10 +139,10 @@ public class MultiblockRecipeMapHandler{ for (final GT_Recipe newBo : x) { int duration = MathUtils.findPercentageOfInt(newBo.mDuration, 80); if (newMap.addRecipe(new GT_Recipe(true, newBo.mInputs, newBo.mOutputs, newBo.mSpecialItems, newBo.mChances, newBo.mFluidInputs, newBo.mFluidOutputs, duration, newBo.mEUt, newBo.mSpecialValue), false, true, true) != null){ - Utils.LOG_INFO("Successfully added a simple recipe to the "+newMap.mNEIName+" map."); + Logger.INFO("Successfully added a simple recipe to the "+newMap.mNEIName+" map."); } else { - Utils.LOG_INFO("Failed adding a simple recipe to the "+newMap.mNEIName+" map."); + Logger.INFO("Failed adding a simple recipe to the "+newMap.mNEIName+" map."); } } } @@ -162,29 +162,29 @@ public class MultiblockRecipeMapHandler{ if (newBo.mChances != null){ outputChances = newBo.mChances.clone(); for (int g=0;g 0) && (aSpecialValue > 0)) { switch (aType) { // Diesel Generator case 0: - Utils.LOG_INFO("Added fuel "+aInput1.getDisplayName()+" is ROCKET FUEL - continuing"); + Logger.INFO("Added fuel "+aInput1.getDisplayName()+" is ROCKET FUEL - continuing"); Gregtech_Recipe_Map.sRocketFuels.addRecipe(this); break; // Gas Turbine @@ -374,23 +374,23 @@ public class Recipe_GT extends GT_Recipe{ }*/ public GT_Recipe addRecipe(final GT_Recipe aRecipe) { - Utils.LOG_INFO("Adding Recipe Method 1"); + Logger.INFO("Adding Recipe Method 1"); return this.addRecipe(aRecipe, true, false, false); } protected GT_Recipe addRecipe(final GT_Recipe aRecipe, final boolean aCheckForCollisions, final boolean aFakeRecipe, final boolean aHidden) { - Utils.LOG_INFO("Adding Recipe Method 2 - This Checks if hidden, fake or if duplicate recipes exists, I think."); + Logger.INFO("Adding Recipe Method 2 - This Checks if hidden, fake or if duplicate recipes exists, I think."); aRecipe.mHidden = aHidden; aRecipe.mFakeRecipe = aFakeRecipe; - Utils.LOG_INFO("Logging some data about this method: GregtechRecipe["+aRecipe.toString()+"] | aCheckForCollisions["+aCheckForCollisions+"] | aFakeRecipe["+aFakeRecipe+"] | aHidden["+aHidden+"]"); - Utils.LOG_INFO("Logging some data about this method: mMinimalInputFluids["+this.mMinimalInputFluids+"] | mMinimalInputItems["+this.mMinimalInputItems+"] | aRecipe.mFluidInputs.length["+aRecipe.mFluidInputs.length+"] | aRecipe.mInputs.length["+aRecipe.mInputs.length+"]"); + Logger.INFO("Logging some data about this method: GregtechRecipe["+aRecipe.toString()+"] | aCheckForCollisions["+aCheckForCollisions+"] | aFakeRecipe["+aFakeRecipe+"] | aHidden["+aHidden+"]"); + Logger.INFO("Logging some data about this method: mMinimalInputFluids["+this.mMinimalInputFluids+"] | mMinimalInputItems["+this.mMinimalInputItems+"] | aRecipe.mFluidInputs.length["+aRecipe.mFluidInputs.length+"] | aRecipe.mInputs.length["+aRecipe.mInputs.length+"]"); if ((aRecipe.mFluidInputs.length < this.mMinimalInputFluids) && (aRecipe.mInputs.length < this.mMinimalInputItems)){ - Utils.LOG_INFO("Step 2 failed"); + Logger.INFO("Step 2 failed"); return null;} - Utils.LOG_INFO("Logging some data about this method: aCheckForCollisions["+aCheckForCollisions+"] | findRecipe != null ["+(this.findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null)+"]"); + Logger.INFO("Logging some data about this method: aCheckForCollisions["+aCheckForCollisions+"] | findRecipe != null ["+(this.findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null)+"]"); if (aCheckForCollisions && (this.findRecipe(null, false, Long.MAX_VALUE, aRecipe.mFluidInputs, aRecipe.mInputs) != null)){ - Utils.LOG_INFO("Step 2 failed - 2"); + Logger.INFO("Step 2 failed - 2"); return null; } return this.add(aRecipe); @@ -420,11 +420,11 @@ public class Recipe_GT extends GT_Recipe{ } public GT_Recipe add(final GT_Recipe aRecipe) { - Utils.LOG_INFO("Adding Recipe Method 3"); + Logger.INFO("Adding Recipe Method 3"); this.mRecipeList.add(aRecipe); for (final FluidStack aFluid : aRecipe.mFluidInputs) { if (aFluid != null) { - Utils.LOG_INFO("Fluid is valid - getting some kind of fluid instance to add to the recipe hashmap."); + Logger.INFO("Fluid is valid - getting some kind of fluid instance to add to the recipe hashmap."); Collection tList = this.mRecipeFluidMap.get(aFluid.getFluid()); if (tList == null) { this.mRecipeFluidMap.put(aFluid.getFluid(), tList = new HashSet<>(1)); @@ -588,28 +588,28 @@ public class Recipe_GT extends GT_Recipe{ } protected GT_Recipe addToItemMap(final GT_Recipe aRecipe) { - Utils.LOG_INFO("Adding Recipe Method 4"); + Logger.INFO("Adding Recipe Method 4"); for (final ItemStack aStack : aRecipe.mInputs) { if (aStack != null) { - Utils.LOG_INFO("Method 4 - Manipulating "+aStack.getDisplayName()); + Logger.INFO("Method 4 - Manipulating "+aStack.getDisplayName()); final GT_ItemStack tStack = new GT_ItemStack(aStack); - Utils.LOG_INFO("Method 4 - Made gt stack of item "+tStack.toStack().getDisplayName()); + Logger.INFO("Method 4 - Made gt stack of item "+tStack.toStack().getDisplayName()); Collection tList = this.mRecipeItemMap.get(tStack); if (tList != null){ - Utils.LOG_INFO("Method 4 - Gt Recipe Hashmap: "+tList.toString()); + Logger.INFO("Method 4 - Gt Recipe Hashmap: "+tList.toString()); } if (tList == null){ - Utils.LOG_INFO("Method 4 - brrr list was NUll"); + Logger.INFO("Method 4 - brrr list was NUll"); this.mRecipeItemMap.put(tStack, tList = new HashSet<>(1)); - Utils.LOG_INFO("Method 4 - Attemping backup method for Gt Recipe Hashmap:"); + Logger.INFO("Method 4 - Attemping backup method for Gt Recipe Hashmap:"); while (tList.iterator().hasNext()){ - Utils.LOG_INFO(tList.iterator().next().toString()); + Logger.INFO(tList.iterator().next().toString()); } } tList.add(aRecipe); - Utils.LOG_INFO("Method 4 - Added recipe to map? I think."); + Logger.INFO("Method 4 - Added recipe to map? I think."); } } return aRecipe; @@ -796,27 +796,27 @@ public class Recipe_GT extends GT_Recipe{ } public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final int aFuelValueInEU) { - Utils.LOG_INFO("Adding Fuel using method 1"); + Logger.INFO("Adding Fuel using method 1"); return this.addFuel(aInput, aOutput, null, null, 10000, aFuelValueInEU); } public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final int aChance, final int aFuelValueInEU) { - Utils.LOG_INFO("Adding Fuel using method 2"); + Logger.INFO("Adding Fuel using method 2"); return this.addFuel(aInput, aOutput, null, null, aChance, aFuelValueInEU); } public GT_Recipe addFuel(final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aFuelValueInEU) { - Utils.LOG_INFO("Adding Fuel using method 3"); + Logger.INFO("Adding Fuel using method 3"); return this.addFuel(null, null, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); } public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aFuelValueInEU) { - Utils.LOG_INFO("Adding Fuel using method 4"); + Logger.INFO("Adding Fuel using method 4"); return this.addFuel(aInput, aOutput, aFluidInput, aFluidOutput, 10000, aFuelValueInEU); } public GT_Recipe addFuel(final ItemStack aInput, final ItemStack aOutput, final FluidStack aFluidInput, final FluidStack aFluidOutput, final int aChance, final int aFuelValueInEU) { - Utils.LOG_INFO("Adding Fuel using method 5"); + Logger.INFO("Adding Fuel using method 5"); return this.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput}, null, new int[]{aChance}, new FluidStack[]{aFluidInput}, new FluidStack[]{aFluidOutput}, 0, 0, aFuelValueInEU); } } -- cgit