
Re:Animal Performance Fix
A small server-side fix mod for Minecraft 1.21.1 / NeoForge. It targets two specific performance problems caused by Re:Animal 0.6.0. It adds no items, no blocks and no entities — it only stops work that is being done for nothing.
Install it on the server only. Clients do not need it, and its absence on the client will not block anyone from joining: the mod registers no network payloads and no registry entries, so there is nothing to negotiate at connection time. Single-player and LAN worlds run an integrated server, so there it does need to be in the client instance.
Problem 1 — pathfinding debug packets in production
In vanilla Minecraft, DebugPackets.sendPathFindingPacket is an empty stub. It is called from
PathNavigation.tick(), which means once per tick for every mob that currently has a path — but the
body does nothing, because debug rendering is a development-only feature.
Re:Animal injects into that method and implements a real send. For every call it walks the level's
entire entity list to find players, then serializes the mob's full Path and sends it to each
one. On a populated server this is the single most expensive method on the tick loop.
Nothing consumes the result: Re:Animal's own client-side handler for the packet is an empty method, so every path is encoded, pushed through the network stack, decoded by the client and discarded.
This mod cancels the call before any of that happens.
In a profile taken from a live server, that one method accounted for roughly 15% of the server
thread, of which about 4% was the write(2) syscall on the Netty event loop. Outgoing bandwidth
drops accordingly.
Problem 2 — Brain AI on decorative mobs
Re:Animal's starfish and sea urchin are near-stationary decorative animals, but each one runs a full
Brain AI — the same system villagers and piglins use — plus a WaterBoundPathNavigation, every
single tick. In the same profile the starfish alone cost more than every zombie, skeleton, creeper
and spider in the world combined.
This mod can run that decision-making once every N ticks instead (default: every 4th tick, offset by
entity id so they do not all land on the same tick). Only Mob.serverAiStep() is skipped. Physics,
movement, collisions, damage, air supply, breeding timers and despawn checks all still run every
tick, so the mobs behave normally — they just re-decide less often.
Problem 3 — there are simply too many of them
Re:Animal registers starfish and sea urchin as MobCategory.CREATURE with a spawn weight of 25 and
a pack size of 5–15, in every ocean and beach biome. That combination is worse than it looks:
CREATUREis the category Minecraft uses when populating freshly generated chunks, so a pack is placed in every new ocean chunk at world-gen time;- vanilla oceans have almost no
CREATUREspawns to compete with, so weight 25 dominates the roll; Animalnever despawns, so the population only ever grows as players explore.
Two things address this:
- A spawn-weight datapack is provided as a separate download. Drop it in
<world>/datapacks/and restart the server. It lowers the weights and pack sizes to values comparable with vanilla ocean fauna. Note that this only affects newly generated chunks. despawnFarAway(on by default) lets starfish and sea urchins despawn like normal wild mobs when they are more than 128 blocks from every player. Named, leashed and otherwise persistence-required mobs are never touched. This is what cleans up a world that is already overpopulated.
Configuration
Everything is configurable and every fix can be switched off individually. The config is a NeoForge
SERVER config, generated on first launch.
[pathfinding_debug]
disablePathfindingDebugPackets = true
[ai_throttle]
aiThrottleInterval = 4 # 0 or 1 disables the throttle
aiThrottleEntities = ["reanimal:starfish", "reanimal:sea_urchin", "reanimal:pigeon"]
skipAiWhenNoPlayerNearby = false
playerRadius = 24
[despawn]
despawnFarAway = true
despawnFarAwayEntities = ["reanimal:starfish", "reanimal:sea_urchin"]
aiThrottleEntities is a plain list of entity ids, so the throttle is not actually tied to
Re:Animal — you can point it at any decorative mob whose behaviour nobody watches closely. Do not
point it at hostiles, pets or mounts.
Compatibility
All three mixins target vanilla classes (DebugPackets, Mob, Animal), not Re:Animal's own
classes, so a Re:Animal update cannot break them. If Re:Animal is not installed, the DebugPackets
mixin is not applied at all.
One known interaction: Moonlight Lib also injects into sendPathFindingPacket, for its
/moonlight debug pathfinding renderer. That renderer does nothing unless an operator explicitly
enables it, but while disablePathfindingDebugPackets is true it will show nothing. Set the option
to false if you need it.
License
MIT. This mod contains no Re:Animal code.

