Search in sources :

Example 71 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project meteor-client by MeteorDevelopment.

the class PotionTimersHud method render.

@Override
public void render(HudRenderer renderer) {
    double x = box.getX();
    double y = box.getY();
    if (isInEditor()) {
        renderer.text("Potion Timers 0:00", x, y, color);
        return;
    }
    int i = 0;
    for (StatusEffectInstance statusEffectInstance : mc.player.getStatusEffects()) {
        StatusEffect statusEffect = statusEffectInstance.getEffectType();
        int c = statusEffect.getColor();
        color.r = Color.toRGBAR(c);
        color.g = Color.toRGBAG(c);
        color.b = Color.toRGBAB(c);
        String text = getString(statusEffectInstance);
        renderer.text(text, x + box.alignX(renderer.textWidth(text)), y, color);
        color.r = color.g = color.b = 255;
        y += renderer.textHeight();
        if (i > 0)
            y += 2;
        i++;
    }
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 72 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project meteor-client by MeteorDevelopment.

the class PotionTimersHud method update.

@Override
public void update(HudRenderer renderer) {
    if (isInEditor()) {
        box.setSize(renderer.textWidth("Potion Timers 0:00"), renderer.textHeight());
        return;
    }
    double width = 0;
    double height = 0;
    int i = 0;
    for (StatusEffectInstance statusEffectInstance : mc.player.getStatusEffects()) {
        width = Math.max(width, renderer.textWidth(getString(statusEffectInstance)));
        height += renderer.textHeight();
        if (i > 0)
            height += 2;
        i++;
    }
    box.setSize(width, height);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 73 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project meteor-client by MeteorDevelopment.

the class Quiver method onActivate.

@Override
public void onActivate() {
    FindItemResult bow = InvUtils.findInHotbar(Items.BOW);
    if (!bow.isHotbar()) {
        error("No bow found... disabling.");
        toggle();
    }
    mc.options.useKey.setPressed(false);
    mc.interactionManager.stopUsingItem(mc.player);
    InvUtils.swap(bow.slot(), true);
    arrowSlots.clear();
    List<StatusEffect> usedEffects = new ArrayList<>();
    for (int i = mc.player.getInventory().size(); i > 0; i--) {
        if (i == mc.player.getInventory().selectedSlot)
            continue;
        ItemStack item = mc.player.getInventory().getStack(i);
        if (item.getItem() != Items.TIPPED_ARROW)
            continue;
        List<StatusEffectInstance> effects = PotionUtil.getPotionEffects(item);
        if (effects.isEmpty())
            continue;
        StatusEffect effect = effects.get(0).getEffectType();
        if (this.effects.get().contains(effect) && !usedEffects.contains(effect) && (!hasEffect(effect) || !checkEffects.get())) {
            usedEffects.add(effect);
            arrowSlots.add(i);
        }
    }
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) ArrayList(java.util.ArrayList) ItemStack(net.minecraft.item.ItemStack)

Example 74 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project fabricskyboxes by AMereBagatelle.

the class AbstractSkybox method checkEffect.

/*
		Check if player has an effect that should prevent skybox from showing
     */
protected boolean checkEffect() {
    ClientPlayerEntity player = MinecraftClient.getInstance().player;
    Objects.requireNonNull(player);
    Collection<StatusEffectInstance> activeEffects = player.getStatusEffects();
    if (!activeEffects.isEmpty()) {
        for (StatusEffectInstance statusEffectInstance : Ordering.natural().reverse().sortedCopy(activeEffects)) {
            StatusEffect statusEffect = statusEffectInstance.getEffectType();
            if (statusEffect.equals(StatusEffects.BLINDNESS)) {
                return false;
            }
        }
    }
    return true;
}
Also used : StatusEffect(net.minecraft.entity.effect.StatusEffect) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ClientPlayerEntity(net.minecraft.client.network.ClientPlayerEntity)

Example 75 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project bewitchment by MoriyaShiine.

the class SusceptibilityCurse method tick.

@Override
public void tick(LivingEntity target) {
    target.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 19, 1, true, false));
    target.addStatusEffect(new StatusEffectInstance(BWStatusEffects.SINKING, 19, 0, true, false));
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Aggregations

StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)107 PlayerEntity (net.minecraft.entity.player.PlayerEntity)18 LivingEntity (net.minecraft.entity.LivingEntity)17 StatusEffect (net.minecraft.entity.effect.StatusEffect)14 ItemStack (net.minecraft.item.ItemStack)14 Inject (org.spongepowered.asm.mixin.injection.Inject)13 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)9 Sprite (net.minecraft.client.texture.Sprite)4 AreaEffectCloudEntity (net.minecraft.entity.AreaEffectCloudEntity)4 Entity (net.minecraft.entity.Entity)4 Box (net.minecraft.util.math.Box)4 List (java.util.List)3 StatusEffectSpriteManager (net.minecraft.client.texture.StatusEffectSpriteManager)3 ImmutableMap (com.google.common.collect.ImmutableMap)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 EventHandler (mathax.client.eventbus.EventHandler)2 StatusEffectInstanceAccessor (mathax.client.mixin.StatusEffectInstanceAccessor)2 HWGEntity (mod.azure.hwg.entity.HWGEntity)2 ThirstManager (net.dehydration.thirst.ThirstManager)2