I just started trying to develop a sanity system for my mod, but the following has been giving me 2 errors in my event class:
@SubscribeEvent
public static void onAttachCapabilitiesPlayer(AttachCapabilitiesEvent<Entity> event) {
if(event.getObject() instanceof Player) {
if(!event.getObject().getCapability(PlayerSanityProvider.PLAYER_SANITY).isPresent()) {
event.addCapability(new ResourceLocation(CorridorsBackrooms.MOD_ID, "properties"), new PlayerSanityProvider());
}
}
}
The errors:
Inconvertible types; cannot cast 'javax.swing.text.html.parser.Entity' to 'net.minecraft.world.entity.player.Player'
And:
Cannot resolve method 'getCapability' in 'Entity'
I was told that this meant that I imported the wrong entity class, the world class Player instead of the entity class Player. Basically I'm asking how I can import the entity class Player to this event class, or at least why it hadn't been imported in the first place