ExtendedEntityDataCapability returning non-requested Capability
maxanier opened this issue ยท 1 comments
@RacerDelux has reported a modcompat issue between LLibrary and my mod Vampirism.
Not sure how far you have looked into this yet, so I will just explain what I found out:
It looks like the issue lies here. Even though it seems that this "get" would only be called on a ICapabilityProvider, if hasCapatibility has returned true beforehand, but that method is not (always) called.
Because of this Minecraft Forge always checks if it can provide the asked capability and returns null/super if not.
E.g. net.minecraftforge.common.model.animation.CapabilityAnimation.DefaultItemAnimationCapabilityProvider
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if(capability == ANIMATION_CAPABILITY) {
return ANIMATION_CAPABILITY.cast(asm);
}
return null;
}
I think the easiest solution would be implement a similar check in your code as well