abooban1-ModelReplacementAPIHotfix icon

ModelReplacementAPIHotfix

Hotfix for ModelReplacementAPI 2.4.19: fixes held item slot errors and disables MoreCompany cosmetics on model replacements.

Last updated 4 hours ago
Total downloads 24
Total rating 1 
Categories Client-side Suits Emotes Bug Fixes
Dependency string abooban1-ModelReplacementAPIHotfix-1.0.2
Dependants 0 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100
BunyaPineTree-ModelReplacementAPI-2.4.19 icon
BunyaPineTree-ModelReplacementAPI

API to simplify model replacement

Preferred version: 2.4.19

README

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 IndexOutOfRangeException in LocateHeldObjectsOnModelReplacementPatch.LateUpdatePatch.
  • Adds safer held-item slot handling when currentItemSlot points outside the vanilla ItemSlots array.
  • Prevents repeated NullReferenceException spam from BodyReplacementBase.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