ModelReplacementAPIHotfix
Hotfix for ModelReplacementAPI 2.4.19: fixes held item slot errors and disables MoreCompany cosmetics on model replacements.ModelReplacementAPI Hotfix
A small compatibility hotfix for ModelReplacementAPI 2.4.19 in Lethal Company. Imporved compatibility with MoreCompany cosmetics.
This mod is intended for modpacks where the original BunyaPineTree-ModelReplacementAPI is still required by other model replacement mods, but causes errors on newer Lethal Company versions or with reserved/item slot mods.
What this fixes
This hotfix currently addresses several common issues:
- Fixes
IndexOutOfRangeExceptioninLocateHeldObjectsOnModelReplacementPatch.LateUpdatePatch. - Adds safer held-item slot handling when
currentItemSlotpoints outside the vanillaItemSlotsarray. - Prevents repeated
NullReferenceExceptionspam fromBodyReplacementBase.LateUpdate. - Disables unsafe MoreCompany cosmetic rendering on players using model replacement skins.
- Helps prevent log spam when switching between incompatible model replacement suits.
Why this is needed
The original ModelReplacementAPI 2.4.19 assumes that the player's selected item slot always exists inside the vanilla ItemSlots array.
With newer Lethal Company versions and mods such as reserved hotbar/item slot mods, currentItemSlot may point to a reserved/tool slot outside the normal item slot array. This can cause errors like:
IndexOutOfRangeException
ModelReplacement.Patches.LocateHeldObjectsOnModelReplacementPatch.LateUpdatePatch
