The Path object creates an array of 1024 PathPoint objects as the backing
for a sorted queue but testing shows we tend to get only 80 or so entries
in the array at most. To save memory this changes the default size of the
array to 128. Changing it to 64 was considered but that triggered too many
resizes which is detremental to performance.
When trying to execute stty to get terminal properties an
InterruptedException can be triggered even though we've read all of the
output from stty that we need. Instead of printing a warning and returning
-1 in this case try to parse what data we do have and reset the cache timer.
May also address BUKKIT-1627 and BUKKIT-1686.
The amount of food gained when eating is used for calculating the food
saturation value so capping it at 20 at this point causes us to get
incorrect results. FoodMetaData.eat caps it at 20 anyway so we're safe to
not do so here.
Also readds a line from mc-dev that was mistakenly removed.
TextWrapper used to try to ensure a message would wrap correctly on the
client by counting the width of the characters in pixels and wrapping
before hitting that limit. This was needed because the client would lose
color information when wrapping and could not handle long lines of text.
Now that both of these problems are solved in the client we can replace
TextWrapper with simple code to split the message into multiple packets on
newlines and ensure chat colors carry across to the new packet.
Make EntityLiving call AI logic every tick again.
Rework PathfinderGoalSelector logic.
Adds UnsafeList for use in places where we use ArrayList and know we won't
get index out of range errors. Added usage to World's tickEntities, Chunk's
entitySlices to speed up searching for entities, and to PathfinderGoalSelector
to speed up dealing with AI goals.
Reworked logic in PathfinderGoalSelector with help from fullwall. This code
no longer uses an extra ArrayList for setting up goals and only updates which
goals should be run every other time it is called.
Removed only calling PathfinderGoalSelector every other tick from EntityLiving
as we now only setup new goals every other tick. This ensures existing goals
run every tick to properly update mob movement.
Reduce usage of getCubes as it is an expensive call.
Remove iterator usage and object creation from PathfinderGoalSelector
methods as these are called very often.
Update EntityLiving goal selectors less often as this is still quite an
expensive task.