Search in sources :

Example 1 with DemonEntity

use of mod.azure.doom.entity.DemonEntity in project MCDoom by AzureDoom.

the class TotemEntity method applyEffects.

private void applyEffects() {
    if (!this.world.isClient()) {
        Box axisalignedbb = (new Box(this.pos)).expand(40).stretch(0.0D, (double) this.world.getHeight(), 0.0D);
        List<DemonEntity> list = this.world.getNonSpectatingEntities(DemonEntity.class, axisalignedbb);
        for (DemonEntity entity : list) {
            entity.addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 1000, 1));
            entity.addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 1000, 1));
            entity.setGlowing(true);
        }
    }
}
Also used : DemonEntity(mod.azure.doom.entity.DemonEntity) StatusEffectInstance(net.minecraft.entity.effect.StatusEffectInstance) Box(net.minecraft.util.math.Box)

Example 2 with DemonEntity

use of mod.azure.doom.entity.DemonEntity in project MCDoom by AzureDoom.

the class ChainsawAnimated method doDeathCheck.

private void doDeathCheck(LivingEntity user, Entity target, ItemStack stack) {
    Random rand = new Random();
    List<Item> givenList = Arrays.asList(DoomItems.CHAINGUN_BULLETS, DoomItems.SHOTGUN_SHELLS, DoomItems.ARGENT_BOLT, DoomItems.SHOTGUN_SHELLS, DoomItems.ENERGY_CELLS, DoomItems.ROCKET);
    if (target instanceof DemonEntity && !(target instanceof PlayerEntity)) {
        if (((LivingEntity) target).isDead()) {
            if (user instanceof PlayerEntity) {
                PlayerEntity playerentity = (PlayerEntity) user;
                if (stack.getDamage() < (stack.getMaxDamage() - 1) && !playerentity.getItemCooldownManager().isCoolingDown(this)) {
                    playerentity.getItemCooldownManager().set(this, 18);
                    for (int i = 0; i < 5; ) {
                        int randomIndex = rand.nextInt(givenList.size());
                        Item randomElement = givenList.get(randomIndex);
                        target.dropItem(randomElement);
                        target.dropItem(randomElement);
                        break;
                    }
                }
            }
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Item(net.minecraft.item.Item) DemonEntity(mod.azure.doom.entity.DemonEntity) Random(java.util.Random) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 3 with DemonEntity

use of mod.azure.doom.entity.DemonEntity in project MCDoom by AzureDoom.

the class Chainsaw method doDeathCheck.

private void doDeathCheck(LivingEntity user, Entity target, ItemStack stack) {
    Random rand = new Random();
    List<Item> givenList = Arrays.asList(DoomItems.CHAINGUN_BULLETS, DoomItems.SHOTGUN_SHELLS, DoomItems.ARGENT_BOLT, DoomItems.SHOTGUN_SHELLS, DoomItems.ENERGY_CELLS, DoomItems.ROCKET);
    if (target instanceof DemonEntity && !(target instanceof PlayerEntity)) {
        if (((LivingEntity) target).isDead()) {
            if (user instanceof PlayerEntity) {
                PlayerEntity playerentity = (PlayerEntity) user;
                if (stack.getDamage() < (stack.getMaxDamage() - 1) && !playerentity.getItemCooldownManager().isCoolingDown(this)) {
                    playerentity.getItemCooldownManager().set(this, 18);
                    for (int i = 0; i < 5; ) {
                        int randomIndex = rand.nextInt(givenList.size());
                        Item randomElement = givenList.get(randomIndex);
                        target.dropItem(randomElement);
                        target.dropItem(randomElement);
                        break;
                    }
                }
            }
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) Item(net.minecraft.item.Item) DemonEntity(mod.azure.doom.entity.DemonEntity) Random(java.util.Random) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Example 4 with DemonEntity

use of mod.azure.doom.entity.DemonEntity in project MCDoom by AzureDoom.

the class TotemEntity method removeEffects.

private void removeEffects() {
    if (!this.world.isClient()) {
        Box axisalignedbb = (new Box(this.pos)).expand(40).stretch(0.0D, (double) this.world.getHeight(), 0.0D);
        List<DemonEntity> list = this.world.getNonSpectatingEntities(DemonEntity.class, axisalignedbb);
        for (DemonEntity entity : list) {
            entity.setGlowing(false);
            entity.clearStatusEffects();
        }
    }
}
Also used : DemonEntity(mod.azure.doom.entity.DemonEntity) Box(net.minecraft.util.math.Box)

Example 5 with DemonEntity

use of mod.azure.doom.entity.DemonEntity in project MCDoom by AzureDoom.

the class PossessedScientistEntity method attack.

@Override
public void attack(LivingEntity target, float pullProgress) {
    Vec3d vec3d = target.getVelocity();
    double d = target.getX() + vec3d.x - this.getX();
    double e = target.getEyeY() - (double) 1.1f - this.getY();
    double f = target.getZ() + vec3d.z - this.getZ();
    double g = Math.sqrt(d * d + f * f);
    Potion potion;
    if (target instanceof DemonEntity) {
        potion = target.getHealth() <= 4.0f ? Potions.HEALING : Potions.REGENERATION;
        this.setTarget(null);
    } else {
        potion = Potions.POISON;
    }
    PotionEntity potionEntity = new PotionEntity(this.world, this);
    potionEntity.setItem(PotionUtil.setPotion(new ItemStack(Items.SPLASH_POTION), potion));
    potionEntity.setPitch(potionEntity.getPitch() - -20.0f);
    potionEntity.setVelocity(d, e + g * 0.2, f, 0.75f, 8.0f);
    if (!this.isSilent()) {
        this.world.playSound(null, this.getX(), this.getY(), this.getZ(), SoundEvents.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0f, 0.8f + this.random.nextFloat() * 0.4f);
    }
    this.world.spawnEntity(potionEntity);
}
Also used : DemonEntity(mod.azure.doom.entity.DemonEntity) Potion(net.minecraft.potion.Potion) ItemStack(net.minecraft.item.ItemStack) Vec3d(net.minecraft.util.math.Vec3d) PotionEntity(net.minecraft.entity.projectile.thrown.PotionEntity)

Aggregations

DemonEntity (mod.azure.doom.entity.DemonEntity)5 Random (java.util.Random)2 LivingEntity (net.minecraft.entity.LivingEntity)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 Item (net.minecraft.item.Item)2 Box (net.minecraft.util.math.Box)2 StatusEffectInstance (net.minecraft.entity.effect.StatusEffectInstance)1 PotionEntity (net.minecraft.entity.projectile.thrown.PotionEntity)1 ItemStack (net.minecraft.item.ItemStack)1 Potion (net.minecraft.potion.Potion)1 Vec3d (net.minecraft.util.math.Vec3d)1