Skip to content

Better Combat

BonsUnleashed edited this page Oct 10, 2026 · 5 revisions

Better Combat

Minecraft 1.20.1 / Forge: this page documents that build and its measurements. For the separate 205-control Minecraft 1.21.1 port, see Minecraft 1.21.1 NeoForge.

One control for Better Combat 1.8.6+1.20.1 (Forge) (mod id bettercombat): the two-handed weapon lookups are skipped on every equipment read that is not the offhand. The switch checks the code it would change against the tested build; another build is left untouched with one WARN line (see How the patches are applied).

Key Target Side Since Kind Result
bettercombat_offhand_lookup Better Combat 1.8.6+1.20.1-forge BOTH 1.0.19 opt ~61 → ~6 ns per non-offhand equipment read

bettercombat_offhand_lookup

Since: 1.0.19 · Script (1.0.19 and earlier): furious19-bettercombat-PlayerEntityMixin.js (exact fingerprint) Patched: net.bettercombat.mixin.PlayerEntityMixin, Better Combat's HEAD hook on Player.getItemBySlot (Better Combat 1.8.6+1.20.1-forge) Mixin (since 1.0.20): OffhandLookupMixin

What upstream did. Better Combat hides the offhand item while a two-handed weapon is held. Its hook runs on every Player.getItemBySlot call, for every slot, and looks up the weapon attributes of both hands first (registry key, map lookup and, for items with NBT, a JSON parse); only then does it check whether the slot is the offhand, the only slot it ever changes.

What the patch does. The hook returns at once for every slot other than the offhand. The offhand path is untouched.

What stays the same. Every equipment read. In the fixture a player holding a two-handed weapon with a shield in the offhand, and one holding a one-handed weapon, read every slot the same with the switch on and off: the shield still hidden behind the two-handed weapon, still visible behind the one-handed one.

Measured. Native full-pack server fixture, 2026-09-28: a non-offhand getItemBySlot call took about 6 ns with the switch on and about 61 ns off (10 million calls each). In the 1.0.19 requalification run (2026-09-29) the non-offhand read took 5.1 ns and the untouched offhand path 47.6 ns. Equipment reads happen on every render and tick path that inspects a player's gear, so this is a small constant saving many times per tick, not a frame-time figure.

Bons and Furious

Minecraft 1.20.1 / Forge 1.0.41

Compatibility

Controls by mod

Links

Clone this wiki locally