Search in sources :

Example 1 with UserManager

use of com.jadarstudios.developercapes.user.UserManager in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class RenderEventHandler method renderPlayer.

// mmdanggg2: renderPlayerEvent seems to be getting depreciated so this will
// do for now.
@SubscribeEvent
public void renderPlayer(RenderLivingEvent.Pre event) {
    if (event.getEntity() instanceof AbstractClientPlayer) {
        AbstractClientPlayer player = (AbstractClientPlayer) event.getEntity();
        UserManager manager = UserManager.getInstance();
        User user = manager.getUser(player.getUniqueID().toString());
        if (user == null)
            return;
        ICape cape = user.capes.get(0);
        if (cape == null)
            return;
        boolean flag = cape.isTextureLoaded(player);
        if (!flag)
            cape.loadTexture(player);
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) User(com.jadarstudios.developercapes.user.User) UserManager(com.jadarstudios.developercapes.user.UserManager) ICape(com.jadarstudios.developercapes.cape.ICape) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

ICape (com.jadarstudios.developercapes.cape.ICape)1 User (com.jadarstudios.developercapes.user.User)1 UserManager (com.jadarstudios.developercapes.user.UserManager)1 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1