Search in sources :

Example 1 with EntityGhastQueen

use of nex.entity.boss.EntityGhastQueen in project NetherEx by LogicTechCorp.

the class TileEntityUrnOfSorrow method update.

@Override
public void update() {
    if (BlockUrnOfSorrow.EnumType.fromMeta(getBlockMetadata()) == BlockUrnOfSorrow.EnumType.FULL) {
        ItemStack stack = getInventory().getStackInSlot(0);
        if (stack.getItem() == Items.GHAST_TEAR) {
            if (getSummoningTime() == 0) {
                getWorld().playSound(null, getPos(), NetherExSoundEvents.ENTITY_SUMMON_GHAST_QUEEN, SoundCategory.AMBIENT, 0.5F, 1.0F);
            }
            setSummoningTime(getSummoningTime() + 1);
            setCanBreak(false);
        }
        if (getSummoningTime() / 20.0F >= 6.8F) {
            EntityGhastQueen ghastQueen = new EntityGhastQueen(getWorld());
            ghastQueen.setPosition(getPos().getX(), getPos().getY() + 7, getPos().getZ());
            ghastQueen.setUrnPos(getPos());
            world.playSound(null, getPos().getX(), getPos().getY() + 7, getPos().getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.AMBIENT, 4.0F, (1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
            if (!getWorld().isRemote) {
                getWorld().spawnEntity(ghastQueen);
            }
            getInventory().setStackInSlot(0, ItemStack.EMPTY);
            getWorld().setBlockState(pos, NetherExBlocks.TILE_URN_SORROW.getDefaultState().withProperty(BlockUrnOfSorrow.TYPE, BlockUrnOfSorrow.EnumType.EMPTY));
            setSummoningTime(0);
        }
    }
}
Also used : EntityGhastQueen(nex.entity.boss.EntityGhastQueen) ItemStack(net.minecraft.item.ItemStack)

Example 2 with EntityGhastQueen

use of nex.entity.boss.EntityGhastQueen in project NetherEx by LogicTechCorp.

the class EntityGhastlingFireball method onImpact.

@Override
protected void onImpact(RayTraceResult result) {
    if (!world.isRemote) {
        if (result.entityHit != null && !(result.entityHit instanceof EntityGhastQueen)) {
            result.entityHit.attackEntityFrom(new EntityDamageSourceIndirect("ghastlingFireball", this, shootingEntity).setFireDamage().setProjectile(), 6.0F);
            applyEnchantments(shootingEntity, result.entityHit);
        }
        boolean flag = world.getGameRules().getBoolean("mobGriefing");
        world.newExplosion(null, posX, posY, posZ, (float) explosionPower, flag, flag);
        setDead();
    }
}
Also used : EntityDamageSourceIndirect(net.minecraft.util.EntityDamageSourceIndirect) EntityGhastQueen(nex.entity.boss.EntityGhastQueen)

Aggregations

EntityGhastQueen (nex.entity.boss.EntityGhastQueen)2 ItemStack (net.minecraft.item.ItemStack)1 EntityDamageSourceIndirect (net.minecraft.util.EntityDamageSourceIndirect)1