Setting up some accountability in who does what with the various systems (the API now logs what mod does what when for most of the major systems). Enable TRACE level logging to see

This commit is contained in:
Pahimar 2015-05-07 15:11:23 -04:00
parent a653c47a72
commit 61ebb7d15f
5 changed files with 48 additions and 8 deletions

View File

@ -2,6 +2,9 @@ package com.pahimar.ee3.array;
import com.google.common.collect.ImmutableSortedSet;
import com.pahimar.ee3.api.array.AlchemyArray;
import com.pahimar.ee3.util.LoaderHelper;
import com.pahimar.ee3.util.LogHelper;
import cpw.mods.fml.common.Loader;
import java.util.SortedSet;
import java.util.TreeSet;
@ -56,6 +59,7 @@ public class AlchemyArrayRegistry
{
if (!registeredAlchemyArrays.contains(alchemyArray))
{
LogHelper.trace(String.format("AbilityRegistry[%s]: Mod with ID '%s' added alchemy array %s", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), alchemyArray));
return registeredAlchemyArrays.add(alchemyArray);
}

View File

@ -76,13 +76,13 @@ public class EnergyValueRegistry implements JsonSerializer<EnergyValueRegistry>,
{
if (factoredEnergyValue.compareTo(preAssignedMappings.get(factoredWrappedStack)) < 0)
{
LogHelper.trace(String.format("Mod with ID '%s' added a pre-assignment energy value of %s for object %s during %s", Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack, LoaderHelper.getLoaderState())); // TODO Localize?
LogHelper.trace(String.format("EnergyValueRegistry[%s]: Mod with ID '%s' added a pre-assignment energy value of %s for object %s", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack));
preAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
}
}
else
{
LogHelper.trace(String.format("Mod with ID '%s' added a pre-assignment energy value of %s for object %s during %s", Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack, LoaderHelper.getLoaderState())); // TODO Localize?
LogHelper.trace(String.format("EnergyValueRegistry[%s]: Mod with ID '%s' added a pre-assignment energy value of %s for object %s", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack));
preAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
}
}
@ -110,8 +110,8 @@ public class EnergyValueRegistry implements JsonSerializer<EnergyValueRegistry>,
WrappedStack factoredWrappedStack = WrappedStack.wrap(wrappedStack, 1);
EnergyValue factoredEnergyValue = EnergyValueHelper.factorEnergyValue(energyValue, wrappedStack.getStackSize());
LogHelper.trace(String.format("Mod with ID '%s' added a post-assignment energy value of %s for object %s during %s", Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack, LoaderHelper.getLoaderState()));
postAssignedMappings.put(factoredWrappedStack, factoredEnergyValue); // TODO Localize?
LogHelper.trace(String.format("EnergyValueRegistry[%s]: Mod with ID '%s' added a post-assignment energy value of %s for object %s", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), energyValue, wrappedStack));
postAssignedMappings.put(factoredWrappedStack, factoredEnergyValue);
}
}
}

View File

@ -9,8 +9,10 @@ import com.pahimar.ee3.exchange.OreStack;
import com.pahimar.ee3.exchange.WrappedStack;
import com.pahimar.ee3.reference.Comparators;
import com.pahimar.ee3.reference.Files;
import com.pahimar.ee3.util.LoaderHelper;
import com.pahimar.ee3.util.LogHelper;
import com.pahimar.ee3.util.SerializationHelper;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
@ -103,7 +105,13 @@ public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDes
{
if (WrappedStack.canBeWrapped(object))
{
hasBeenModified = notLearnableSet.remove(WrappedStack.wrap(object));
WrappedStack wrappedStack = WrappedStack.wrap(object);
if (wrappedStack != null && notLearnableSet.remove(wrappedStack))
{
hasBeenModified = true;
LogHelper.trace(String.format("AbilityRegistry[%s]: Mod with ID '%s' set object %s as LEARNABLE", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack));
}
}
}
@ -111,7 +119,13 @@ public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDes
{
if (WrappedStack.canBeWrapped(object))
{
hasBeenModified = notLearnableSet.add(WrappedStack.wrap(object));
WrappedStack wrappedStack = WrappedStack.wrap(object);
if (wrappedStack != null && notLearnableSet.add(wrappedStack))
{
hasBeenModified = true;
LogHelper.trace(String.format("AbilityRegistry[%s]: Mod with ID '%s' set object %s as NOT LEARNABLE", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack));
}
}
}
@ -135,7 +149,13 @@ public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDes
{
if (WrappedStack.canBeWrapped(object))
{
hasBeenModified = notRecoverableSet.remove(WrappedStack.wrap(object));
WrappedStack wrappedStack = WrappedStack.wrap(object);
if (wrappedStack != null && notRecoverableSet.remove(wrappedStack))
{
hasBeenModified = true;
LogHelper.trace(String.format("AbilityRegistry[%s]: Mod with ID '%s' set object %s as RECOVERABLE", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack));
}
}
}
@ -143,7 +163,13 @@ public class AbilityRegistry implements JsonSerializer<AbilityRegistry>, JsonDes
{
if (WrappedStack.canBeWrapped(object))
{
hasBeenModified = notRecoverableSet.add(WrappedStack.wrap(object));
WrappedStack wrappedStack = WrappedStack.wrap(object);
if (wrappedStack != null && notRecoverableSet.add(wrappedStack))
{
hasBeenModified = true;
LogHelper.trace(String.format("AbilityRegistry[%s]: Mod with ID '%s' set object %s as NOT RECOVERABLE", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedStack));
}
}
}

View File

@ -3,6 +3,9 @@ package com.pahimar.ee3.recipe;
import com.google.common.collect.ImmutableList;
import com.pahimar.ee3.api.exchange.RecipeRegistryProxy;
import com.pahimar.ee3.item.crafting.RecipeAludel;
import com.pahimar.ee3.util.LoaderHelper;
import com.pahimar.ee3.util.LogHelper;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
@ -38,6 +41,7 @@ public class AludelRecipeManager
{
if (!aludelRecipes.contains(recipeAludel))
{
LogHelper.trace(String.format("AludelRecipeManager[%s]: Mod with ID '%s' added Aludel recipe '%s'", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), recipeAludel));
aludelRecipes.add(recipeAludel);
}
}

View File

@ -4,7 +4,9 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import com.pahimar.ee3.exchange.WrappedStack;
import com.pahimar.ee3.util.LoaderHelper;
import com.pahimar.ee3.util.LogHelper;
import cpw.mods.fml.common.Loader;
import java.util.ArrayList;
import java.util.List;
@ -41,12 +43,15 @@ public class RecipeRegistry
}
List<WrappedStack> wrappedRecipeInputList = new ArrayList<WrappedStack>();
StringBuilder stringBuilder = new StringBuilder();
for (Object recipeInputObject : recipeInputList)
{
WrappedStack wrappedInputObject = WrappedStack.wrap(recipeInputObject);
if (wrappedInputObject != null)
{
wrappedRecipeInputList.add(wrappedInputObject);
stringBuilder.append(wrappedInputObject);
stringBuilder.append(" ");
}
else
{
@ -57,6 +62,7 @@ public class RecipeRegistry
// Add the recipe mapping only if we don't already have it
if (!recipeMap.get(wrappedRecipeOutput).contains(wrappedRecipeInputList))
{
LogHelper.trace(String.format("RecipeRegistry[%s]: Mod with ID '%s' added recipe (Output: %s, Inputs: %s)", LoaderHelper.getLoaderState(), Loader.instance().activeModContainer().getModId(), wrappedRecipeOutput, stringBuilder.toString().trim()));
recipeMap.put(wrappedRecipeOutput, wrappedRecipeInputList);
}
}