Bit off-course from the original question, but I've changed my getCapability code to this
@Override
public <T> LazyOptional<T> getCapability(Capability<T> capability, Direction side)
{
return capability == STATUS_CAP ? lazyStatus.cast() : LazyOptional.empty();
}
based off of what I found in the forge docs on capabilities, but capability is now never equaling STATUS_CAP, so I'm not sure what's going wrong
Here's what the STATUS_CAP code looks like:
@CapabilityInject(IStatus.class)
public static final Capability<IStatus> STATUS_CAP = null;
And also the lazyStatus incase that's important
private static final LazyOptional<IStatus> lazyStatus = LazyOptional.of(Status::new);
Edit: It also looks like the getCapability function isn't used at all? At least that's what I've gotten from placing random System.out.println's everywhere. I'm guessing I'm not registering the capability correctly
@SubscribeEvent
public void attachCapability(AttachCapabilitiesEvent<Entity> event)
{
if (!(event.getObject() instanceof PlayerEntity)) return;
event.addCapability(new ResourceLocation(Reference.MODID, "status"),
new StatusProvider());
}
but this seems to be what the docs say to do so I'm not sure if anything's wrong with it