Store reference to ItemStack count since inventory modifies it
Add for empty effects before checking for a particular effect

All living entities currently check for potion effects at least two times
every tick. Effects are stored in a HashMap which makes such checks
relatively efficient. However, most living entities will always have zero
effects and java's HashMap does not check this before attempting a lookup.
To avoid doing unneeded work we add this check ourselves before calling
containsKey on the Map. This completely removes looking up potion effects
from most profiling runs and dramatically reduces calls to containsKey.