p1ut0nium-git / Rough-Mobs-Revamped

Rough Mobs Revamped for Minecraft
https://www.curseforge.com/minecraft/mc-mods/rough-mobs-revamped
4 stars 8 forks source link

Improve Zombie block breaking AI performance. #47

Closed eutro closed 3 years ago

eutro commented 4 years ago

Using Spark to profile a server, we found that RoughAIBreakBlocks was causing significant performance issues.

image This is mainly due to its use of ArrayList.contains, and in part because of path recalculation every tick.

The use of a set instead of a list resolves the first issue, and recalculating the path only once every 40 ticks, as EntityAIMoveToBlock does, helps with the second issue.

This PR implements both changes.