use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class AOEHelper method chainNearbyEntities.
// EXPLODING END
// CHAINING BEGIN
public static void chainNearbyEntities(LivingEntity user, LivingEntity target, float distance, int timeMultiplier) {
StatusEffectInstance chained = new StatusEffectInstance(StatusEffects.SLOWNESS, 100 * timeMultiplier, 100);
target.addStatusEffect(chained);
for (LivingEntity nearbyEntity : getAoeTargets(target, user, distance)) {
if (nearbyEntity != target) {
pullTowards(nearbyEntity, target);
nearbyEntity.addStatusEffect(chained);
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class AOECloudHelper method spawnWeakeningCloud.
// Poison Cloud
public static void spawnWeakeningCloud(LivingEntity user, LivingEntity target, int amplifier) {
AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(target.world, target.getX(), target.getY(), target.getZ());
areaEffectCloudEntity.setOwner(user);
areaEffectCloudEntity.setRadius(5.0F);
areaEffectCloudEntity.setRadiusOnUse(-0.5F);
areaEffectCloudEntity.setWaitTime(10);
areaEffectCloudEntity.setDuration(60);
StatusEffectInstance weakening = new StatusEffectInstance(StatusEffects.WEAKNESS, 60, amplifier);
areaEffectCloudEntity.addEffect(weakening);
target.world.spawnEntity(areaEffectCloudEntity);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class AOECloudHelper method spawnRegenCloudAtPos.
// Regen Arrow
public static void spawnRegenCloudAtPos(LivingEntity user, boolean arrow, BlockPos blockPos, int amplifier) {
int inGroundMitigator = arrow ? 1 : 0;
AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(user.world, blockPos.getX(), blockPos.getY() + inGroundMitigator, blockPos.getZ());
areaEffectCloudEntity.setOwner(user);
areaEffectCloudEntity.setRadius(5.0F);
areaEffectCloudEntity.setRadiusOnUse(-0.5F);
areaEffectCloudEntity.setWaitTime(10);
areaEffectCloudEntity.setDuration(100);
StatusEffectInstance regeneration = new StatusEffectInstance(StatusEffects.REGENERATION, 100, amplifier);
areaEffectCloudEntity.addEffect(regeneration);
user.world.spawnEntity(areaEffectCloudEntity);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class RushdownEnchantmentMixin method onRushdownEnchantmentKill.
@Inject(at = @At("HEAD"), method = "onDeath", cancellable = true)
private void onRushdownEnchantmentKill(DamageSource source, CallbackInfo ci) {
if (!(source.getAttacker() instanceof PlayerEntity))
return;
LivingEntity user = (LivingEntity) source.getAttacker();
ItemStack mainHandStack = null;
if (user != null) {
mainHandStack = user.getMainHandStack();
}
boolean uniqueWeaponFlag = false;
if (McdwEnchantsConfig.getValue("rushdown")) {
if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.RUSHDOWN, mainHandStack) >= 1)) {
int level = EnchantmentHelper.getLevel(EnchantsRegistry.RUSHDOWN, mainHandStack);
float rushdownRand = user.getRandom().nextFloat();
if (rushdownRand <= 0.1F) {
StatusEffectInstance rushdown = new StatusEffectInstance(StatusEffects.SPEED, level * 100, 2, false, false);
user.addStatusEffect(rushdown);
}
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class StunningEnchantmentMixin method applyStunningEnchantmentDamage.
@Inject(method = "applyDamage(Lnet/minecraft/entity/damage/DamageSource;F)V", at = @At("HEAD"))
public void applyStunningEnchantmentDamage(DamageSource source, float amount, CallbackInfo info) {
if (!(source.getAttacker() instanceof PlayerEntity))
return;
LivingEntity user = (LivingEntity) source.getAttacker();
LivingEntity target = (LivingEntity) (Object) this;
if (source.getSource() instanceof LivingEntity) {
if (amount != 0.0F) {
ItemStack mainHandStack = null;
if (user != null) {
mainHandStack = user.getMainHandStack();
}
boolean uniqueWeaponFlag = false;
if (McdwEnchantsConfig.getValue("stunning")) {
if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.STUNNING, mainHandStack) >= 1)) {
int level = EnchantmentHelper.getLevel(EnchantsRegistry.STUNNING, mainHandStack);
float chance = user.getRandom().nextFloat();
if (chance <= 0.2 + level * 0.15) {
target.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 60, 10));
target.addStatusEffect(new StatusEffectInstance(StatusEffects.NAUSEA, 60, 1));
// this.world.sendEntityStatus(this,(byte)35);
}
}
}
}
}
}
Aggregations