diff --git a/src/main/java/cpw/mods/fml/common/functions/CollectionWrapperFactory.java b/src/main/java/cpw/mods/fml/common/functions/CollectionWrapperFactory.java new file mode 100644 index 0000000..5d026c2 --- /dev/null +++ b/src/main/java/cpw/mods/fml/common/functions/CollectionWrapperFactory.java @@ -0,0 +1,32 @@ +package cpw.mods.fml.common.functions; + +import java.util.Collection; +import java.util.List; +import com.google.common.collect.Collections2; +import com.google.common.collect.Lists; + +public class CollectionWrapperFactory { + /** + * Return a read only cast view of the supplied ungeneric collection, based on the element type given + * @param coll The collection to cast + * @param elementType the supertype contained in the collection + * @return a collection asserting that type relationship + */ + public static Collection wrap(@SuppressWarnings("rawtypes") Collection coll, Class elementType) + { + Collection asGeneric = coll; + return Collections2.transform(asGeneric, new TypeCastFunction(elementType)); + } + + /** + * Return a read only cast view of the supplied ungeneric list, based on the element type given + * @param list The list to cast + * @param elementType the supertype contained in the list + * @return a list asserting that type relationship + */ + public static List wrap(@SuppressWarnings("rawtypes") List list, Class elementType) + { + List asGeneric = list; + return Lists.transform(asGeneric, new TypeCastFunction(elementType)); + } +} \ No newline at end of file diff --git a/src/main/java/cpw/mods/fml/common/registry/FMLControlledNamespacedRegistry.java b/src/main/java/cpw/mods/fml/common/registry/FMLControlledNamespacedRegistry.java index 28bdbac..a00c2ec 100644 --- a/src/main/java/cpw/mods/fml/common/registry/FMLControlledNamespacedRegistry.java +++ b/src/main/java/cpw/mods/fml/common/registry/FMLControlledNamespacedRegistry.java @@ -356,7 +356,9 @@ } if (getId(thing) >= 0) // duplicate object { - throw new IllegalArgumentException(String.format("The object %s has been registered twice, using the names %s and %s.", thing, getNameForObject(thing), name)); + int foundId = getId(thing); + Object otherThing = getRaw(foundId); + throw new IllegalArgumentException(String.format("The object %s{%x} has been registered twice, using the names %s and %s. (Other object at this id is %s{%x})", thing, System.identityHashCode(thing), getNameForObject(thing), name, otherThing, System.identityHashCode(otherThing))); } if (GameData.isFrozen(this)) { diff --git a/src/main/resources/fmlversion.properties b/src/main/resources/fmlversion.properties index 517da03..1ea4e66 100644 --- a/src/main/resources/fmlversion.properties +++ b/src/main/resources/fmlversion.properties @@ -1,6 +1,6 @@ fmlbuild.major.number=7 fmlbuild.minor.number=2 -fmlbuild.revision.number=188 -fmlbuild.build.number=34 +fmlbuild.revision.number=190 +fmlbuild.build.number=35 fmlbuild.mcversion=1.7.2 fmlbuild.mcpversion=9.03