Paper icon indicating copy to clipboard operation
Paper copied to clipboard

Cache the climbing check in activation range

Open Toffikk opened this issue 6 months ago • 3 comments

This pr aims to reduce the overhead of checking multiple times per tick if an entity is climbing. It does it by caching the last climbing block pos and checking if its the same as the current pos and returning early.

In my testing it helps to reduce the tick time spent on entities and the climbing related logic such as setClimbing now taking 0.02% of the tick time instead of 0.06%

Before: https://spark.lucko.me/cV9CmdEmwJ

After: https://spark.lucko.me/7PDoTbgYhA

Entities on which these sparks were conducted are spiders

note: a version of this patch was also used in forks such as Pufferfish and Airplane and provided great results when paired with huge entity numbers

Toffikk avatar Jun 29 '25 18:06 Toffikk

rebased to .7

Toffikk avatar Jun 30 '25 15:06 Toffikk

rebased for 1.21.9))

Toffikk avatar Oct 03 '25 13:10 Toffikk

rebased this for 1.21.11

Toffikk avatar Dec 07 '25 22:12 Toffikk