Files
7d2dXG/Mods/zzz_REBIRTH__Utils/Harmony/Harmony_EntityFactory.cs
Nathaniel Cosford e06f2bd282 Add All Mods
2025-05-29 23:33:28 +09:30

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;
}
}
}