Search in sources :

Example 1 with PerkExperienceRevealer

use of hellfirepvp.astralsorcery.common.item.base.PerkExperienceRevealer in project AstralSorcery by HellFirePvP.

the class PerkExperienceRenderer method tick.

@Override
public void tick(TickEvent.Type type, Object... context) {
    PlayerEntity player = Minecraft.getInstance().player;
    if (player != null) {
        ItemStack held = player.getHeldItem(Hand.MAIN_HAND);
        if (!held.isEmpty() && held.getItem() instanceof PerkExperienceRevealer && ((PerkExperienceRevealer) held.getItem()).shouldReveal(held)) {
            revealExperience(20);
        }
        held = player.getHeldItem(Hand.OFF_HAND);
        if (!held.isEmpty() && held.getItem() instanceof PerkExperienceRevealer && ((PerkExperienceRevealer) held.getItem()).shouldReveal(held)) {
            revealExperience(20);
        }
    }
    revealTicks--;
    if ((revealTicks - fadeTicks) < 0) {
        if (visibilityReveal > 0) {
            visibilityReveal = Math.max(0, visibilityReveal - visibilityChange);
        }
    } else {
        if (visibilityReveal < 1) {
            visibilityReveal = Math.min(1, visibilityReveal + visibilityChange);
        }
    }
}
Also used : PerkExperienceRevealer(hellfirepvp.astralsorcery.common.item.base.PerkExperienceRevealer) ItemStack(net.minecraft.item.ItemStack) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

PerkExperienceRevealer (hellfirepvp.astralsorcery.common.item.base.PerkExperienceRevealer)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1