Summary
Creating any custom S1API.Entities.NPC on the Mono beta emits one Harmony warning per wrapper instance:
[WARNING] AccessTools.Field: Could not find field for type ScheduleOne.NPCs.NPC and name RequiresRegionUnlocked
Environment
- S1API: 3.1.15 (
S1API.dll)
- Game: 0.4.6f12 Alternate
- Runtime: MonoBleedingEdge x64
- MelonLoader: 0.7.1
Reproduction
- Define and register one or more physical custom NPCs derived from
S1API.Entities.NPC.
- Load a save and allow S1API to construct the wrappers.
- Observe one warning for every NPC wrapper constructed.
The warning originates from the instance field initializer in Entities/NPC.cs:
private readonly FieldInfo _requiresRegionUnlockedField =
AccessTools.Field(typeof(S1NPCs.NPC), "RequiresRegionUnlocked");
The current Mono ScheduleOne.NPCs.NPC type no longer exposes that field. Harmony logs whenever AccessTools.Field misses, so even mods that never use RequiresRegionUnlocked receive repeated warnings.
Suggested compatibility fix
Resolve the optional member without warning (plain reflection or the existing tolerant field/property helper), cache it once per runtime type, and keep the property as a safe fallback/no-op when unavailable. This should remain a separate S1API compatibility fix; downstream mods cannot prevent the initializer warning.
Summary
Creating any custom
S1API.Entities.NPCon the Mono beta emits one Harmony warning per wrapper instance:Environment
S1API.dll)Reproduction
S1API.Entities.NPC.The warning originates from the instance field initializer in
Entities/NPC.cs:The current Mono
ScheduleOne.NPCs.NPCtype no longer exposes that field. Harmony logs wheneverAccessTools.Fieldmisses, so even mods that never useRequiresRegionUnlockedreceive repeated warnings.Suggested compatibility fix
Resolve the optional member without warning (plain reflection or the existing tolerant field/property helper), cache it once per runtime type, and keep the property as a safe fallback/no-op when unavailable. This should remain a separate S1API compatibility fix; downstream mods cannot prevent the initializer warning.