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);
}
}
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);
}
}
}
}
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;
}
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();
}
}
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);
}
Aggregations