Flan's Mod servers fix

Fixed the bug that prevented guns from being used on the server.

Flans Gun Server Fix

A one-purpose fix for Flan's Mod on 1.20.1: on a server, guns stop firing after a reload, and nothing you do in game brings them back except dropping the gun and picking it up again. That single bug is enough to make the mod's weapons unusable in multiplayer. This addon repairs it and nothing else - no new items, no new guns, no settings to learn.

Why this matters

For a server, this is not a small glitch. A player reloads, the magazine shows loaded, the round is deducted from their ammo, and the next shot does nothing. It happens again after the following reload. On a busy server every player hits it within a few minutes of fighting, and the usual workaround - drop the gun on the ground and pick it up - is both awkward under fire and easy to forget.

In practice: without this fix, Flan's guns are not usable in server play.

What actually goes wrong

The client and the server disagree about whether a reload is still running.

  1. The player reloads. The client plays the reload, sees the magazine fill and considers the reload finished.
  2. On the server one of the reload stages never reaches its end: the corresponding action group is never removed from ActionStack.ActiveActionGroups.
  3. ActionStack.IsReloading() answers "yes" as long as any reload group is active and started:
IsReloading() -> true
ShootAction.CanStart() -> EActionResult.TryNextAction    // the shot is silently discarded
  1. The client has already spent the round, so the player loses ammo and hits nothing. Re-equipping the gun rebuilds the action stack, which is why dropping and picking it up "fixes" it - until the next reload.

What this mod does

On the server, before that question is answered, reload action groups that have been running far longer than any reload can be are dropped. Everything else - the animation, the client side state, otheraction groups - is left exactly as it is.

  • Threshold: 200 ticks (10 seconds) of an unfinished reload group.
  • Ten seconds is longer than any legitimate reload (multi-stage and high capacity guns included), so a real reload is never interrupted.
  • The check is cheap: it only walks the small list of active action groups of that player's gun.

Requirements

  • Minecraft 1.20.1
  • Forge 47.x
  • Flan's Mod 0.4.316 or newer (the only dependency)

Works on client and server. Installing it on the server alone is enough for the fix to take effect; having it on clients as well does no harm and is recommended for modpacks.

Compatibility

  • Adds, removes and changes no gun, item, recipe or model.
  • Does not touch other mods' action groups.
  • Safe to add to an existing world and safe to remove: nothing is stored.

Notes

  • If a server runs a custom Flan's build with much longer reload animations, tell me and the threshold can be raised.
  • Flan's Mod is MIT licensed. This addon contains no Flan's code; it patches behaviour at runtime and depends on the original mod. Credits to the Flan's Mod authors.

Flan's Mod servers fix Team

profile avatar
  • 7
    Followers
  • 4
    Projects
  • 27.5K
    Downloads

More from ELMO_SYG