Skip to content

Bens Sharks

BonsUnleashed edited this page Oct 15, 2026 · 2 revisions

Ben's Sharks

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

Four controls for Ben's Sharks 1.3.0 (mod id benssharks): unrelated entity callbacks and idle work are skipped, and repeated prey searches share their results. These are the performance features formerly in Bons Sharks Fix. Despawn and loot changes remain in that separate mod. Each 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
benssharks_item_animation_idle Ben's Sharks 1.3.0 BOTH 1.0.42 opt
benssharks_prey_search_merge Ben's Sharks 1.3.0 (Minecraft 1.20.1) BOTH 1.0.42 opt
benssharks_tick_listeners Ben's Sharks 1.3.0 BOTH 1.0.42 opt
benssharks_work_queue_idle Ben's Sharks 1.3.0 BOTH 1.0.42 opt

benssharks_tick_listeners

Since: 1.0.42 · Target: Ben's Sharks 1.3.0 · Side: BOTH · Kind: opt

Mixins: SharkBaseTickMixin, GreaterAxodileTickMixin, DolphinTickMixin, LivingEffectAddedMixin, BleedingEffectMixin, LevelStateMixin, ServerEntityCallbacksMixin

Ben's Sharks: its creature and world tick handlers run only for its own creatures. Ben's Sharks registers 62 handlers on the per-creature tick event (27 of them do nothing) and runs all of them for every living creature in every world, every tick, on both sides; 6 more world-tick handlers walk every entity of every dimension four extra times per tick looking for a few shark classes and tridents. The switch takes those handlers off the event and runs the original ones, unchanged and in their original order, only for Ben's own creatures, from the start of each creature's own tick. Three handlers that also act on other creatures get narrow hooks: the barracuda's armour check (run from the barracuda's side), dolphins eating sardines (from the dolphin's tick) and Bleeding (only for creatures that bleed). The world-tick code runs over the sharks and tridents the server tracks. Ben's routines now run after other mods' per-creature handlers instead of between them.

Idea: ours

Measured: full-pack server, Forge's per-creature tick event: 4.8 us per living creature per tick with Ben's Sharks, 2.5 us with the switch, the same as without Ben's Sharks; per entity per world tick 147 -> 11 ns. A sealed room with 4,000 entities and no sharks: 58.1 -> 52.8 ms per tick. Ten behaviour checks (flopping on land, sprinting, bleeding, barracuda armour attraction, dolphins eating sardines, smooth turns, seeking tridents, textures, boats, eating) matched stock.


benssharks_work_queue_idle

Since: 1.0.42 · Target: Ben's Sharks 1.3.0 · Side: BOTH (acts on the server, incl. the integrated server) · Kind: opt

Mixin: BenssharksModTickMixin

Ben's Sharks: the server work queue is skipped while it is empty. Every server tick, in both phases, Ben's Sharks ran its work queue handler, which at the end of each tick built a new list and walked the queue even when nothing was queued. With nothing queued it now returns at once; queued work runs exactly as before.

Idea: ours

Measured: not timed on its own; it saves one list and one walk of an empty queue per server tick.


benssharks_item_animation_idle

Since: 1.0.42 · Target: Ben's Sharks 1.3.0 · Side: BOTH · Kind: opt

Mixin: ItemAnimationFactoryMixin

Ben's Sharks: held-item animation work only while a Spetum is held. For every player, twice a tick, Ben's Sharks copied both held item stacks (with all their data) before checking anything, although it only ever animates its Spetum. It now returns at once unless it is the start of the tick and a hand holds a Spetum, the only case in which it did anything.

Idea: ours

Measured: not timed on its own; it saves four item stack copies per player per tick.


benssharks_prey_search_merge

Since: 1.0.42 · Target: Ben's Sharks 1.3.0 (Minecraft 1.20.1) · Side: BOTH (acts on the server, incl. the integrated server) · Kind: opt

Mixins: GoalMergeMixin, MobAccessor, NatgAccessor, TargetGoalAccessor

Ben's Sharks: one entity search for a shark's whole list of prey. Ben's sharks get one target goal per prey type (a bull shark has 39), and each goal runs its own entity search when its random roll comes up. Consecutive plain goals of that kind are merged into one goal: the same random rolls in the same order, one shared search of the same area, and each prey type then picks its target with its own original conditions, so the shark picks exactly the target the separate goals would. Goals that do not fit are left as they are.

Idea: ours

Measured: 7,800 target choices compared with the separate goals' logic: 0 differences. In a scene of 40 hunting sharks and 120 prey most of the tick goes to swimming and path finding (5.59 -> 5.51 ms per tick with all Ben's Sharks switches).

Bons and Furious

Minecraft 1.20.1 / Forge 1.0.42

Compatibility

Controls by mod

Links

Clone this wiki locally