Issue title: NPE in CapabilityDispatcher
 Issue body: This issue appears with the following mods on world load:
**Forge:** 407-397-0304 (currently latest)
**Custom NPCs:** 1.11.2(10may17) ([Download](https://minecraft.curseforge.com/projects/custom-npcs/files/2418212))
**Wearable Backpacks:** 2.3.2 ([Download](https://github.com/copygirl/WearableBackpacks/releases/tag/v2.3.2))

Custom NPCs issue reported [here](https://minecraft.curseforge.com/projects/custom-npcs/issues/1840).

**Full crash log:** [Here](https://gist.github.com/copygirl/61846b9ff7a1b81ba609a487b64a100d)

## Stacktrace
```
java.lang.NullPointerException: Ticking entity
    at net.minecraftforge.common.capabilities.CapabilityDispatcher.getCapability(CapabilityDispatcher.java:108)
    at net.minecraft.entity.Entity.getCapability(Entity.java:3037)
    at net.minecraft.entity.EntityLivingBase.getCapability(EntityLivingBase.java:2859)
    at net.minecraft.entity.player.EntityPlayer.getCapability(EntityPlayer.java:2636)
    at net.mcft.copy.backpacks.ProxyCommon.onLivingUpdate(ProxyCommon.java:173)
    ...
```

### Relevant code
[CapabilityDispatcher.java:108](https://github.com/MinecraftForge/MinecraftForge/blob/c545b8ecd4e96107ccf134c8fd89906357d586ad/src/main/java/net/minecraftforge/common/capabilities/CapabilityDispatcher.java#L108)
[ProxyCommon.java:173](https://github.com/copygirl/WearableBackpacks/blob/master/src/main/java/net/mcft/copy/backpacks/ProxyCommon.java#L173)
(Custom NPCs is not open source?)

## Other notes
Could it be that Custom NPCs registers a `ICapabilityProvider` which is `null` or something causing it to be passed down there? Perhaps there should be a sanity check where the error might originate so the proper mod is being attributed to error instead of the one simply accessing capabilities?
 Comments: 
 Comment 0: i did try it and yes it npes on world load 
then i tried to put it in idea intellij added WB and CNPS (deodf using BON2) as a lib
but that works just fine :(

can this go wrong??
`    public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
        return capability == MARKDATA_CAPABILITY;
    }

    public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
        return this.hasCapability(capability, facing)?this:null;
    }`
 Comment 1: I've poked around the CNPS mod and can confirm that there is a case were it attaches a null `ICapabilityProvider` to entities using the `AttachCapabilitiesEvent`. That is the cause of the NPE in `CapabilityDispatcher`. Therefore, it is a mod issue. 

The most Forge could do is catch and log attempts to add a null `ICapabilityProvider` in `AttachCapabilitiesEvent`. However, I don't think it is necessary as this looks to be an isolated (or rare) issue. Of course, Lex or another Forge dev have the final say on that. 
 Comment 2: If you attach a null you're gunna make things explode.
This isn't on us to fix.
{'source': 'GithubIssues', 'repo_name_with_owner': 'MinecraftForge/MinecraftForge', 'issue_id': 228309926, 'repo_stars': 6826.0}