Quiet FMLControlledNamespacedRegistry debug spam by default. Reenable using -Dfml.debugRegistryEntries=true.

This commit is contained in:
Lex Manos 2015-06-09 21:32:40 -07:00
parent b985384fab
commit 847c0246cd
2 changed files with 11 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.functions.GenericIterableFactory; import cpw.mods.fml.common.functions.GenericIterableFactory;
public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced { public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
public static final boolean DEBUG = Boolean.parseBoolean(System.getProperty("fml.debugRegistryEntries", "false"));
private final Class<I> superType; private final Class<I> superType;
private String optionalDefaultName; private String optionalDefaultName;
private I optionalDefaultObject; private I optionalDefaultObject;
@ -396,14 +397,16 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
} }
addObjectRaw(idToUse, name, thing); addObjectRaw(idToUse, name, thing);
FMLLog.finer("Registry add: %s %d %s (req. id %d)", name, idToUse, thing, id); if (DEBUG)
FMLLog.finer("Registry add: %s %d %s (req. id %d)", name, idToUse, thing, id);
return idToUse; return idToUse;
} }
void addAlias(String from, String to) void addAlias(String from, String to)
{ {
aliases.put(from, to); aliases.put(from, to);
FMLLog.finer("Registry alias: %s -> %s", from, to); if (DEBUG)
FMLLog.finer("Registry alias: %s -> %s", from, to);
} }
Map<String,Integer> getEntriesNotIn(FMLControlledNamespacedRegistry<I> registry) Map<String,Integer> getEntriesNotIn(FMLControlledNamespacedRegistry<I> registry)
@ -426,6 +429,9 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
void dump() void dump()
{ {
if (!DEBUG)
return;
List<Integer> ids = new ArrayList<Integer>(); List<Integer> ids = new ArrayList<Integer>();
for (I thing : this.typeSafeIterable()) for (I thing : this.typeSafeIterable())
@ -439,7 +445,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
for (int id : ids) for (int id : ids)
{ {
I thing = getRaw(id); I thing = getRaw(id);
FMLLog.finer("Registry: %s %d %s", getNameForObject(thing), id, thing); FMLLog.finer("Registry: %d %s %s", id, getNameForObject(thing), thing);
} }
} }

View File

@ -834,7 +834,8 @@ public class GameData {
} }
else // ItemBlock after its Block else // ItemBlock after its Block
{ {
FMLLog.fine("Found matching Block %s for ItemBlock %s at id %d, original id requested: %d", block, item, id, idHint); if (FMLControlledNamespacedRegistry.DEBUG)
FMLLog.fine("Found matching Block %s for ItemBlock %s at id %d, original id requested: %d", block, item, id, idHint);
freeSlot(id, item); // temporarily free the slot occupied by the Block for the item registration freeSlot(id, item); // temporarily free the slot occupied by the Block for the item registration
} }