Search in sources :

Example 66 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsArmors by chronosacaria.

the class EnchantmentEffects method applyCowardice.

// Effects for ServerPlayerEntityMixin
public static void applyCowardice(ServerPlayerEntity player) {
    if (!Mcda.CONFIG.mcdaEnableEnchantAndEffectConfig.enableEnchantment.get(COWARDICE))
        return;
    if (player.getHealth() == player.getMaxHealth()) {
        int cowardiceLevel = EnchantmentHelper.getEquipmentLevel(EnchantsRegistry.enchants.get(COWARDICE), player);
        if (cowardiceLevel == 0)
            return;
        StatusEffectInstance strengthBoost = new StatusEffectInstance(StatusEffects.STRENGTH, 42, cowardiceLevel - 1, false, false);
        player.addStatusEffect(strengthBoost);
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 67 with StatusEffectInstance

use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsArmors by chronosacaria.

the class ItemStackMixin method useEmeraldToChargeArmor.

@Inject(method = "use", at = @At("HEAD"))
public void useEmeraldToChargeArmor(World world, PlayerEntity user, Hand hand, CallbackInfoReturnable<TypedActionResult<ItemStack>> cir) {
    ItemStack getMainHandStack = user.getMainHandStack();
    if (Mcda.CONFIG.mcdaEnableEnchantAndEffectConfig.enableArmorEffect.get(ArmorEffectID.GILDED_HERO) && CleanlinessHelper.hasArmorSet(user, ArmorSets.GILDED)) {
        if (getMainHandStack.getItem() == Items.EMERALD) {
            int decrementAmount = 10;
            if (getMainHandStack.getCount() >= decrementAmount) {
                getMainHandStack.decrement(decrementAmount);
                StatusEffectInstance hov = new StatusEffectInstance(StatusEffects.HERO_OF_THE_VILLAGE, 42, 0, false, false);
                user.addStatusEffect(hov);
                user.world.playSound(null, user.getX(), user.getY(), user.getZ(), SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.PLAYERS, 0.8F, 0.8F);
            }
        }
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ItemStack(net.minecraft.item.ItemStack) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 68 with StatusEffectInstance

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

the class StatusEffectListSettingScreen method getPotionStack.

private ItemStack getPotionStack(StatusEffect effect) {
    ItemStack potion = Items.POTION.getDefaultStack();
    potion.getOrCreateNbt().putInt("CustomPotionColor", PotionUtil.getColor(new Potion(new StatusEffectInstance(effect))));
    return potion;
}
Also used : Potion(net.minecraft.potion.Potion) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) ItemStack(net.minecraft.item.ItemStack)

Example 69 with StatusEffectInstance

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

the class CrystalAura method doBreak.

private void doBreak(Entity crystal) {
    // Anti weakness
    if (antiWeakness.get()) {
        StatusEffectInstance weakness = mc.player.getStatusEffect(StatusEffects.WEAKNESS);
        StatusEffectInstance strength = mc.player.getStatusEffect(StatusEffects.STRENGTH);
        // Check for strength
        if (weakness != null && (strength == null || strength.getAmplifier() <= weakness.getAmplifier())) {
            // Check if the item in your hand is already valid
            if (!isValidWeaknessItem(mc.player.getMainHandStack())) {
                // Find valid item to break with
                if (!InvUtils.swap(InvUtils.findInHotbar(this::isValidWeaknessItem).slot(), false))
                    return;
                switchTimer = 1;
                return;
            }
        }
    }
    // Rotate and attack
    boolean attacked = true;
    if (rotate.get()) {
        double yaw = Rotations.getYaw(crystal);
        double pitch = Rotations.getPitch(crystal, Target.Feet);
        if (doYawSteps(yaw, pitch)) {
            setRotation(true, crystal.getPos(), 0, 0);
            Rotations.rotate(yaw, pitch, 50, () -> attackCrystal(crystal));
            breakTimer = breakDelay.get();
        } else {
            attacked = false;
        }
    } else {
        attackCrystal(crystal);
        breakTimer = breakDelay.get();
    }
    if (attacked) {
        // Update state
        removed.add(crystal.getId());
        attemptedBreaks.put(crystal.getId(), attemptedBreaks.get(crystal.getId()) + 1);
        waitingToExplode.put(crystal.getId(), 0);
        // Break render
        breakRenderPos.set(crystal.getBlockPos().down());
        breakRenderTimer = renderBreakTime.get();
    }
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance)

Example 70 with StatusEffectInstance

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

the class SpeedMine method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    if (mode.get() == Mode.Normal)
        return;
    int amplifier = mode.get() == Mode.Haste2 ? 1 : 0;
    if (!mc.player.hasStatusEffect(HASTE)) {
        mc.player.addStatusEffect(new StatusEffectInstance(HASTE, 255, amplifier, false, false, false));
    }
    StatusEffectInstance effect = mc.player.getStatusEffect(HASTE);
    ((StatusEffectInstanceAccessor) effect).setAmplifier(amplifier);
    if (effect.getDuration() < 20)
        ((StatusEffectInstanceAccessor) effect).setDuration(20);
}
Also used : StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) StatusEffectInstanceAccessor(meteordevelopment.meteorclient.mixin.StatusEffectInstanceAccessor) EventHandler(meteordevelopment.orbit.EventHandler)

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