From e87a8e0bd3e330d2ae42af52500f07df979a6a7c Mon Sep 17 00:00:00 2001 From: Justin Aquadro Date: Mon, 14 Nov 2011 22:04:06 -0500 Subject: [PATCH] Added enumerator to Entity/TileEntity factories --- SubstrateCS/Source/EntityFactory.cs | 13 +++++++++++++ SubstrateCS/Source/TileEntityFactory.cs | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/SubstrateCS/Source/EntityFactory.cs b/SubstrateCS/Source/EntityFactory.cs index ac18758..df975db 100644 --- a/SubstrateCS/Source/EntityFactory.cs +++ b/SubstrateCS/Source/EntityFactory.cs @@ -77,6 +77,19 @@ namespace Substrate _registry[id] = subtype; } + /// + /// Gets an enumerator over all registered Entities. + /// + public static IEnumerable> RegisteredEntities + { + get + { + foreach (KeyValuePair kvp in _registry) { + yield return kvp; + } + } + } + static EntityFactory () { _registry[EntityArrow.TypeId] = typeof(EntityArrow); diff --git a/SubstrateCS/Source/TileEntityFactory.cs b/SubstrateCS/Source/TileEntityFactory.cs index a9619eb..48bd00e 100644 --- a/SubstrateCS/Source/TileEntityFactory.cs +++ b/SubstrateCS/Source/TileEntityFactory.cs @@ -75,6 +75,19 @@ namespace Substrate _registry[id] = subtype; } + /// + /// Gets an enumerator over all registered TileEntities. + /// + public static IEnumerable> RegisteredTileEntities + { + get + { + foreach (KeyValuePair kvp in _registry) { + yield return kvp; + } + } + } + static TileEntityFactory () { _registry[TileEntityEndPortal.TypeId] = typeof(TileEntityEndPortal);