50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
namespace Harmony.EntityFactoryPatches
|
|
{
|
|
[HarmonyPatch(typeof(EntityFactory))]
|
|
[HarmonyPatch("GetEntityType")]
|
|
public class GetEntityTypePatch
|
|
{
|
|
public static bool Prefix(EntityFactory __instance, ref System.Type __result, string _className)
|
|
{
|
|
switch (_className)
|
|
{
|
|
case "EntityAnimal":
|
|
__result = typeof(EntityAnimal);
|
|
return false;
|
|
case "EntityAnimalRabbit":
|
|
__result = typeof(EntityAnimalRabbit);
|
|
return false;
|
|
case "EntityAnimalStag":
|
|
__result = typeof(EntityAnimalStag);
|
|
return false;
|
|
case "EntityBandit":
|
|
__result = typeof(EntityBandit);
|
|
return false;
|
|
case "EntityEnemyAnimal":
|
|
__result = typeof(EntityEnemyAnimal);
|
|
return false;
|
|
case "EntityHuman":
|
|
__result = typeof(EntityHuman);
|
|
return false;
|
|
case "EntityNPC":
|
|
__result = typeof(EntityNPC);
|
|
return false;
|
|
case "EntityPlayer":
|
|
__result = typeof(EntityPlayer);
|
|
return false;
|
|
case "EntityZombie":
|
|
__result = typeof(EntityZombie);
|
|
return false;
|
|
case "EntityAlive":
|
|
__result = typeof(EntityAlive);
|
|
return false;
|
|
default:
|
|
Log.Warning("GetEntityType slow lookup for {0}", (object)_className);
|
|
__result = System.Type.GetType(_className);
|
|
return false;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
}
|